diff options
Diffstat (limited to 'indra/llui/lltoolbar.h')
-rw-r--r-- | indra/llui/lltoolbar.h | 92 |
1 files changed, 88 insertions, 4 deletions
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index dd454e3f0b..85cd6d5170 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -32,28 +32,112 @@ #include "lllayoutstack.h" #include "llbutton.h" + +class LLCommand; + + +class LLToolBarButton : public LLButton +{ +public: + struct Params : public LLInitParam::Block<Params, LLButton::Params> + { + }; + + LLToolBarButton(const Params& p) : LLButton(p) {} +}; + + +namespace LLToolBarEnums +{ + enum ButtonType + { + BTNTYPE_ICONS_ONLY = 0, + BTNTYPE_ICONS_WITH_TEXT, + + BTNTYPE_COUNT + }; + + enum SideType + { + SIDE_NONE = 0, + SIDE_BOTTOM, + SIDE_LEFT, + SIDE_RIGHT, + SIDE_TOP, + }; +} + +// NOTE: This needs to occur before Param block declaration for proper compilation. +namespace LLInitParam +{ + template<> + struct TypeValues<LLToolBarEnums::ButtonType> : public TypeValuesHelper<LLToolBarEnums::ButtonType> + { + static void declareValues(); + }; + + template<> + struct TypeValues<LLToolBarEnums::SideType> : public TypeValuesHelper<LLToolBarEnums::SideType> + { + static void declareValues(); + }; +} + + class LLToolBar : public LLUICtrl { public: + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { - Mandatory<LLLayoutStack::ELayoutOrientation> orientation; - Multiple<LLButton::Params> buttons; + Mandatory<LLToolBarEnums::ButtonType> button_display_mode; + Mandatory<LLToolBarEnums::SideType> side; + + Optional<LLToolBarButton::Params> button_icon, + button_icon_and_text; + + Optional<bool> wrap; + Optional<S32> min_button_width, + max_button_width; + // get rid of this + Multiple<LLToolBarButton::Params> buttons; + + Optional<LLUIImage*> background_image; Params(); }; + // virtuals void draw(); + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + + bool addCommand(LLCommand * command); protected: friend class LLUICtrlFactory; LLToolBar(const Params&); + void initFromParams(const Params&); private: - LLLayoutStack::ELayoutOrientation mOrientation; - LLLayoutStack* mStack; + void updateLayoutAsNeeded(); + + std::list<LLToolBarButton*> mButtons; + LLToolBarEnums::ButtonType mButtonType; + LLLayoutStack* mCenteringStack; + LLLayoutStack* mWrapStack; + LLLayoutPanel* mCenterPanel; + LLToolBarEnums::SideType mSideType; + + bool mWrap; + bool mNeedsLayout; + S32 mMinButtonWidth, + mMaxButtonWidth; + + LLUIImagePtr mBackgroundImage; + + LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; }; |