lltool.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLTOOL_H
00033 #define LL_LLTOOL_H
00034 
00035 #include "llkeyboard.h"
00036 #include "llmousehandler.h"
00037 #include "llcoord.h"
00038 #include "v3math.h"
00039 #include "v3dmath.h"
00040 
00041 class LLViewerObject;
00042 class LLToolComposite;
00043 class LLView;
00044 class LLPanel;
00045 
00046 class LLTool
00047 :       public LLMouseHandler
00048 {
00049 public:
00050         LLTool( const LLString& name, LLToolComposite* composite = NULL );
00051         virtual ~LLTool();
00052 
00053         // Hack to support LLFocusMgr
00054         virtual BOOL isView() { return FALSE; }
00055 
00056         // Virtual functions inherited from LLMouseHandler
00057         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00058         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00059         virtual BOOL    handleHover(S32 x, S32 y, MASK mask);
00060         virtual BOOL    handleScrollWheel(S32 x, S32 y, S32 clicks);
00061         virtual BOOL    handleDoubleClick(S32 x, S32 y, MASK mask);
00062         virtual BOOL    handleRightMouseDown(S32 x, S32 y, MASK mask);
00063         virtual BOOL    handleRightMouseUp(S32 x, S32 y, MASK mask);
00064         virtual BOOL    handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen);
00065                 // Return FALSE to allow context menu to be shown.
00066         virtual void    screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
00067                                                         { *local_x = screen_x; *local_y = screen_y;     }
00068         virtual void    localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
00069                                                         { *screen_x = local_x; *screen_y = local_y;     }
00070 
00071         virtual const LLString& getName() const { return mName; }
00072 
00073         // New virtual functions
00074         virtual LLViewerObject* getEditingObject()              { return NULL; }
00075         virtual LLVector3d              getEditingPointGlobal() { return LLVector3d(); }
00076         virtual BOOL                    isEditing()                             { return (getEditingObject() != NULL); }
00077         virtual void                    stopEditing()                   {}
00078 
00079         virtual BOOL                    clipMouseWhenDown()             { return TRUE; }
00080 
00081         virtual void                    handleSelect()                  { }     // do stuff when your tool is selected
00082         virtual void                    handleDeselect()                { }     // clean up when your tool is deselected
00083 
00084         virtual LLTool*                 getOverrideTool(MASK mask);
00085 
00086         // isAlwaysRendered() - return true if this is a tool that should
00087         // always be rendered regardless of selection.
00088         virtual BOOL isAlwaysRendered() { return FALSE; }
00089 
00090         virtual void                    render() {}                             // draw tool specific 3D content in world
00091         virtual void                    draw();                                 // draw tool specific 2D overlay
00092 
00093         virtual BOOL                    handleKey(KEY key, MASK mask);
00094 
00095         // Note: NOT virtual.  Subclasses should call this version.
00096         void                                    setMouseCapture(BOOL b);
00097         BOOL                                    hasMouseCapture();
00098         virtual void                    onMouseCaptureLost() {}  // override this one as needed.
00099 
00100 protected:
00101         LLToolComposite*        mComposite;  // Composite will handle mouse captures.
00102         LLString                        mName;
00103         
00104 public:
00105         static const LLString sNameNull;
00106 };
00107 
00108 #endif

Generated on Thu Jul 1 06:09:19 2010 for Second Life Viewer by  doxygen 1.4.7