PageRenderTime 922ms CodeModel.GetById 173ms RepoModel.GetById 16ms app.codeStats 28ms

/indra/newview/lltool.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 108 lines | 56 code | 20 blank | 32 comment | 1 complexity | c5d9960ed48541b949cf8df5813bca2d MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltool.h
  3. * @brief LLTool class header file
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLTOOL_H
  27. #define LL_LLTOOL_H
  28. #include "llkeyboard.h"
  29. #include "llmousehandler.h"
  30. #include "llcoord.h"
  31. #include "v3math.h"
  32. #include "v3dmath.h"
  33. class LLViewerObject;
  34. class LLToolComposite;
  35. class LLView;
  36. class LLPanel;
  37. class LLTool
  38. : public LLMouseHandler
  39. {
  40. public:
  41. LLTool( const std::string& name, LLToolComposite* composite = NULL );
  42. virtual ~LLTool();
  43. // Hack to support LLFocusMgr
  44. virtual BOOL isView() const { return FALSE; }
  45. // Virtual functions inherited from LLMouseHandler
  46. virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
  47. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  48. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  49. virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
  50. virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
  51. virtual BOOL handleHover(S32 x, S32 y, MASK mask);
  52. virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  53. virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
  54. virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
  55. virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
  56. virtual BOOL handleToolTip(S32 x, S32 y, MASK mask);
  57. // Return FALSE to allow context menu to be shown.
  58. virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
  59. { *local_x = screen_x; *local_y = screen_y; }
  60. virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
  61. { *screen_x = local_x; *screen_y = local_y; }
  62. virtual const std::string& getName() const { return mName; }
  63. // New virtual functions
  64. virtual LLViewerObject* getEditingObject() { return NULL; }
  65. virtual LLVector3d getEditingPointGlobal() { return LLVector3d(); }
  66. virtual BOOL isEditing() { return (getEditingObject() != NULL); }
  67. virtual void stopEditing() {}
  68. virtual BOOL clipMouseWhenDown() { return TRUE; }
  69. virtual void handleSelect() { } // do stuff when your tool is selected
  70. virtual void handleDeselect() { } // clean up when your tool is deselected
  71. virtual LLTool* getOverrideTool(MASK mask);
  72. // isAlwaysRendered() - return true if this is a tool that should
  73. // always be rendered regardless of selection.
  74. virtual BOOL isAlwaysRendered() { return FALSE; }
  75. virtual void render() {} // draw tool specific 3D content in world
  76. virtual void draw(); // draw tool specific 2D overlay
  77. virtual BOOL handleKey(KEY key, MASK mask);
  78. // Note: NOT virtual. Subclasses should call this version.
  79. void setMouseCapture(BOOL b);
  80. BOOL hasMouseCapture();
  81. virtual void onMouseCaptureLost() {} // override this one as needed.
  82. protected:
  83. LLToolComposite* mComposite; // Composite will handle mouse captures.
  84. std::string mName;
  85. public:
  86. static const std::string sNameNull;
  87. };
  88. #endif