diff options
Diffstat (limited to 'indra/newview/llbottomtray.h')
-rw-r--r-- | indra/newview/llbottomtray.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index bd9d35f209..14a29895f5 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -47,6 +47,30 @@ class LLBottomTrayLite; extern template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); #endif +/** + * Class for buttons that should have drag'n'drop ability in bottomtray. + * These buttons pass mouse events handling to bottomtray. + */ +class LLBottomtrayButton : public LLButton +{ +public: + struct Params : public LLInitParam::Block<Params, LLButton::Params> + { + Params(){} + }; + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + +protected: + LLBottomtrayButton(const Params& p) + : LLButton(p) + { + + } + friend class LLUICtrlFactory; +}; + class LLBottomTray : public LLSingleton<LLBottomTray> , public LLPanel @@ -101,6 +125,18 @@ public: */ LLIMChiclet* createIMChiclet(const LLUUID& session_id); + // Below are methods that were introduced or overriden in bottomtray to handle drag'n'drop + + virtual void draw(); + + /** + * These three methods handle drag'n'drop, they may be called directly from child buttons. + */ + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + void onDraggableButtonMouseDown(LLUICtrl* button, S32 x, S32 y, MASK mask); + void onDraggableButtonMouseUp(LLUICtrl* button, S32 x, S32 y, MASK mask); + + private: typedef enum e_resize_status_type { @@ -134,6 +170,29 @@ private: | RS_BUTTON_BUILD | RS_BUTTON_SEARCH | RS_BUTTON_WORLD_MAP | RS_BUTTON_MINI_MAP }EResizeState; + // Below are three methods that were introduced to handle drag'n'drop + + /** + * finds a panel under the specified LOCAL point + */ + LLPanel* findChildPanelByLocalCoords(S32 x, S32 y); + + /** + * checks whether the cursor is over an area where the dragged button may be dropped + */ + bool isCursorOverDraggableArea(S32 x, S32 y); + + /** + * Updates process(shrink/show/hide) order of buttons and order in which they'll be stored for further save/load. + * It is called when dragged button is dropped + */ + void updateButtonsOrdersAfterDnD(); + + // saves order of buttons to file on disk + void saveButtonsOrder(); + // reads order of buttons from file on disk + void loadButtonsOrder(); + /** * Updates child controls size and visibility when it is necessary to reduce total width. * @@ -360,6 +419,13 @@ private: * Contains order in which child buttons should be processed in show/hide, extend/shrink methods. */ resize_state_vec_t mButtonsProcessOrder; + /** + * Contains order in which child buttons are shown. + * It traces order of all bottomtray buttons that may change place via drag'n'drop and should + * save and load it between sessions. mButtonsProcessOrder is not enough for it because it contains only + * buttons that may be hidden. + */ + resize_state_vec_t mButtonsOrder; protected: @@ -381,6 +447,38 @@ protected: LLButton* mMovementButton; LLBottomTrayLite* mBottomTrayLite; bool mIsInLiteMode; + + // Drag'n'Drop + + /** + * Is true if mouse down happened on draggable button. + * Set false whether on drag start or on mouse up. + */ + bool mCheckForDrag; + /** + * These two variables hold corrdinates of mouse down on draggable button. + * They are used to compare with current coordinates of cursor and determine whether drag'n'drop should start. + */ + S32 mStartX; + S32 mStartY; + /** + * True if drag'n'drop is happening. + */ + bool mDragStarted; + + /** + * Pointer to panel which is currently dragged (though it seems to user that button is dragged, + * we are changing place of layout panel). + */ + LLPanel* mDraggedItem; + /** + * Panel before which the dragged button will be inserted. + */ + LLPanel* mLandingTab; + /** + * Image used to show position where dragged button will be dropped. + */ + LLUIImage* mImageDragIndication; }; #endif // LL_LLBOTTOMPANEL_H |