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         
00054         virtual BOOL isView() { return FALSE; }
00055 
00056         
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                 
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         
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()                  { }     
00082         virtual void                    handleDeselect()                { }     
00083 
00084         virtual LLTool*                 getOverrideTool(MASK mask);
00085 
00086         
00087         
00088         virtual BOOL isAlwaysRendered() { return FALSE; }
00089 
00090         virtual void                    render() {}                             
00091         virtual void                    draw();                                 
00092 
00093         virtual BOOL                    handleKey(KEY key, MASK mask);
00094 
00095         
00096         void                                    setMouseCapture(BOOL b);
00097         BOOL                                    hasMouseCapture();
00098         virtual void                    onMouseCaptureLost() {}  
00099 
00100 protected:
00101         LLToolComposite*        mComposite;  
00102         LLString                        mName;
00103         
00104 public:
00105         static const LLString sNameNull;
00106 };
00107 
00108 #endif