diff options
Diffstat (limited to 'indra/llui/lltoolbar.h')
-rw-r--r-- | indra/llui/lltoolbar.h | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 3c317e10a2..a35f6d9db1 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -35,9 +35,11 @@ #include "llcommandmanager.h" #include "llassettype.h" -typedef boost::function<void (S32 x, S32 y, const LLUUID& uuid)> startdrag_callback_t; -typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> handledrag_callback_t; -typedef boost::function<BOOL (EDragAndDropType type, void* data, const LLUUID& uuid)> handledrop_callback_t; +class LLToolBar; + +typedef boost::function<void (S32 x, S32 y, const LLUUID& uuid)> tool_startdrag_callback_t; +typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t; +typedef boost::function<BOOL (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t; class LLToolBarButton : public LLButton { @@ -61,18 +63,17 @@ public: BOOL handleHover(S32 x, S32 y, MASK mask); void setCommandId(const LLCommandId& id) { mId = id; } - void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; } - void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; } + void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } private: LLCommandId mId; S32 mMouseDownX; S32 mMouseDownY; LLUI::RangeS32 mWidthRange; S32 mDesiredHeight; - bool mIsDragged; - startdrag_callback_t mStartDragItemCallback; - handledrag_callback_t mHandleDragItemCallback; - LLUUID mUUID; + bool mIsDragged; + tool_startdrag_callback_t mStartDragItemCallback; + tool_handledrag_callback_t mHandleDragItemCallback; }; @@ -143,19 +144,21 @@ public: // virtuals void draw(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + int getRankFromPosition(S32 x, S32 y); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - - bool addCommand(const LLCommandId& commandId); + + bool addCommand(const LLCommandId& commandId, int rank = -1); + bool removeCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); - void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; } - void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; } - void setHandleDropCallback(handledrop_callback_t cb) { mHandleDropCallback = cb; } + void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } + void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } LLToolBarButton* createButton(const LLCommandId& id); @@ -165,10 +168,10 @@ protected: ~LLToolBar(); void initFromParams(const Params&); - startdrag_callback_t mStartDragItemCallback; - handledrag_callback_t mHandleDragItemCallback; - handledrop_callback_t mHandleDropCallback; - bool mDragAndDropTarget; + tool_startdrag_callback_t mStartDragItemCallback; + tool_handledrag_callback_t mHandleDragItemCallback; + tool_handledrop_callback_t mHandleDropCallback; + bool mDragAndDropTarget; public: // Methods used in loading and saving toolbar settings @@ -185,7 +188,6 @@ private: BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); - LLUUID mUUID; const bool mReadOnly; std::list<LLToolBarButton*> mButtons; |