lltoolcomp.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_TOOLCOMP_H
00033 #define LL_TOOLCOMP_H
00034 
00035 #include "lltool.h"
00036 
00037 class LLManip;
00038 class LLToolSelectRect;
00039 class LLToolPlacer;
00040 
00041 class LLView;
00042 class LLTextBox;
00043 
00044 //-----------------------------------------------------------------------
00045 // LLToolComposite
00046 
00047 class LLToolComposite : public LLTool
00048 {
00049 public:
00050         LLToolComposite(const LLString& name);
00051 
00052     virtual BOOL                        handleMouseDown(S32 x, S32 y, MASK mask) = 0;   // Sets the current tool
00053     virtual BOOL                        handleMouseUp(S32 x, S32 y, MASK mask);                 // Returns to the default tool
00054         virtual BOOL                    handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
00055 
00056         // Map virtual functions to the currently active internal tool
00057     virtual BOOL                        handleHover(S32 x, S32 y, MASK mask)                    { return mCur->handleHover( x, y, mask ); }
00058         virtual BOOL                    handleScrollWheel(S32 x, S32 y, S32 clicks)             { return mCur->handleScrollWheel( x, y, clicks ); }
00059         virtual BOOL                    handleRightMouseDown(S32 x, S32 y, MASK mask)   { return mCur->handleRightMouseDown( x, y, mask ); }
00060 
00061         virtual LLViewerObject* getEditingObject()                                                              { return mCur->getEditingObject(); }
00062         virtual LLVector3d              getEditingPointGlobal()                                                 { return mCur->getEditingPointGlobal(); }
00063         virtual BOOL                    isEditing()                                                                             { return mCur->isEditing(); }
00064         virtual void                    stopEditing()                                                                   { mCur->stopEditing(); mCur = mDefault; }
00065 
00066         virtual BOOL                    clipMouseWhenDown()                                                             { return mCur->clipMouseWhenDown(); }
00067 
00068         virtual void                    handleSelect();
00069         virtual void                    handleDeselect()                                                                { mCur->handleDeselect(); mCur = mDefault; mSelected = FALSE; }
00070 
00071         virtual void                    render()                                                                                { mCur->render(); }
00072         virtual void                    draw()                                                                                  { mCur->draw(); }
00073 
00074         virtual BOOL                    handleKey(KEY key, MASK mask)                                   { return mCur->handleKey( key, mask ); }
00075 
00076         virtual void                    onMouseCaptureLost();
00077 
00078         virtual void                    screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
00079                                                                 { mCur->screenPointToLocal(screen_x, screen_y, local_x, local_y); }
00080 
00081         virtual void                    localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
00082                                                                 { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); }
00083 
00084         BOOL                                    isSelecting();
00085 protected:
00086         void                                    setCurrentTool( LLTool* new_tool );
00087         LLTool*                                 getCurrentTool()                                                                { return mCur; }
00088         // In hover handler, call this to auto-switch tools
00089         void                                    setToolFromMask( MASK mask, LLTool *normal );
00090 
00091 protected:
00092         LLTool*                                 mCur;           // The tool to which we're delegating.
00093         LLTool*                                 mDefault;
00094         BOOL                                    mSelected;
00095         BOOL                                    mMouseDown;
00096         LLManip*                                mManip;
00097         LLToolSelectRect*               mSelectRect;
00098 
00099 public:
00100         static const LLString sNameComp;
00101 };
00102 
00103 
00104 //-----------------------------------------------------------------------
00105 // LLToolCompTranslate
00106 
00107 class LLToolCompInspect : public LLToolComposite
00108 {
00109 public:
00110         LLToolCompInspect();
00111         virtual ~LLToolCompInspect();
00112 
00113         // Overridden from LLToolComposite
00114     virtual BOOL                handleMouseDown(S32 x, S32 y, MASK mask);
00115     virtual BOOL                handleDoubleClick(S32 x, S32 y, MASK mask);
00116 
00117         static void pickCallback(S32 x, S32 y, MASK mask);
00118 };
00119 
00120 //-----------------------------------------------------------------------
00121 // LLToolCompTranslate
00122 
00123 class LLToolCompTranslate : public LLToolComposite
00124 {
00125 public:
00126         LLToolCompTranslate();
00127         virtual ~LLToolCompTranslate();
00128 
00129         // Overridden from LLToolComposite
00130         virtual BOOL            handleMouseDown(S32 x, S32 y, MASK mask);
00131         virtual BOOL            handleDoubleClick(S32 x, S32 y, MASK mask);
00132         virtual BOOL            handleHover(S32 x, S32 y, MASK mask);
00133         virtual BOOL            handleMouseUp(S32 x, S32 y, MASK mask);                 // Returns to the default tool
00134         virtual void            render();
00135 
00136         virtual LLTool*         getOverrideTool(MASK mask);
00137 
00138         static void pickCallback(S32 x, S32 y, MASK mask);
00139 };
00140 
00141 //-----------------------------------------------------------------------
00142 // LLToolCompScale
00143 
00144 class LLToolCompScale : public LLToolComposite
00145 {
00146 public:
00147         LLToolCompScale();
00148         virtual ~LLToolCompScale();
00149 
00150         // Overridden from LLToolComposite
00151     virtual BOOL                handleMouseDown(S32 x, S32 y, MASK mask);
00152     virtual BOOL                handleDoubleClick(S32 x, S32 y, MASK mask);
00153     virtual BOOL                handleHover(S32 x, S32 y, MASK mask);
00154         virtual BOOL            handleMouseUp(S32 x, S32 y, MASK mask);                 // Returns to the default tool
00155         virtual void            render();
00156 
00157         virtual LLTool*         getOverrideTool(MASK mask);
00158         
00159         static void pickCallback(S32 x, S32 y, MASK mask);
00160 };
00161 
00162 
00163 //-----------------------------------------------------------------------
00164 // LLToolCompRotate
00165 
00166 class LLToolCompRotate : public LLToolComposite
00167 {
00168 public:
00169         LLToolCompRotate();
00170         virtual ~LLToolCompRotate();
00171 
00172         // Overridden from LLToolComposite
00173     virtual BOOL                handleMouseDown(S32 x, S32 y, MASK mask);
00174     virtual BOOL                handleDoubleClick(S32 x, S32 y, MASK mask);
00175     virtual BOOL                handleHover(S32 x, S32 y, MASK mask);
00176         virtual BOOL            handleMouseUp(S32 x, S32 y, MASK mask);
00177         virtual void            render();
00178 
00179         virtual LLTool*         getOverrideTool(MASK mask);
00180 
00181         static void pickCallback(S32 x, S32 y, MASK mask);
00182 
00183 protected:
00184 };
00185 
00186 //-----------------------------------------------------------------------
00187 // LLToolCompCreate
00188 
00189 class LLToolCompCreate : public LLToolComposite
00190 {
00191 public:
00192         LLToolCompCreate();
00193         virtual ~LLToolCompCreate();
00194 
00195         // Overridden from LLToolComposite
00196     virtual BOOL                handleMouseDown(S32 x, S32 y, MASK mask);
00197     virtual BOOL                handleDoubleClick(S32 x, S32 y, MASK mask);
00198         virtual BOOL            handleMouseUp(S32 x, S32 y, MASK mask);
00199         
00200         static void pickCallback(S32 x, S32 y, MASK mask);
00201 protected:
00202         LLToolPlacer*           mPlacer;
00203         BOOL                            mObjectPlacedOnMouseDown;
00204 };
00205 
00206 
00207 //-----------------------------------------------------------------------
00208 // LLToolCompGun
00209 
00210 class LLToolGun;
00211 class LLToolGrab;
00212 class LLToolSelect;
00213 
00214 class LLToolCompGun : public LLToolComposite
00215 {
00216 public:
00217         LLToolCompGun();
00218         virtual ~LLToolCompGun();
00219 
00220         // Overridden from LLToolComposite
00221     virtual BOOL                        handleHover(S32 x, S32 y, MASK mask);
00222         virtual BOOL                    handleMouseDown(S32 x, S32 y, MASK mask);
00223         virtual BOOL                    handleDoubleClick(S32 x, S32 y, MASK mask);
00224         virtual BOOL                    handleRightMouseDown(S32 x, S32 y, MASK mask);
00225         virtual BOOL                    handleMouseUp(S32 x, S32 y, MASK mask);
00226         virtual BOOL                    handleScrollWheel(S32 x, S32 y, S32 clicks);
00227         virtual void                    onMouseCaptureLost();
00228         virtual void                    handleSelect();
00229         virtual void                    handleDeselect();
00230 
00231 protected:
00232         LLToolGun*                      mGun;
00233         LLToolGrab*                     mGrab;
00234         LLTool*                         mNull;
00235 };
00236 
00237 extern LLToolCompInspect        *gToolInspect;
00238 extern LLToolCompTranslate      *gToolTranslate;
00239 extern LLToolCompScale          *gToolStretch;
00240 extern LLToolCompRotate         *gToolRotate;
00241 extern LLToolCompCreate         *gToolCreate;
00242 extern LLToolCompGun            *gToolGun;
00243 
00244 #endif  // LL_TOOLCOMP_H

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