summaryrefslogtreecommitdiff
path: root/indra/llui/lltabcontainer.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lltabcontainer.h')
-rw-r--r--indra/llui/lltabcontainer.h133
1 files changed, 71 insertions, 62 deletions
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 8117cdee9b..ac8232bbb1 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -37,7 +37,7 @@
#include "lltextbox.h"
#include "llframetimer.h"
-extern const S32 TABCNTR_HEADER_HEIGHT;
+class LLTabTuple;
class LLTabContainer : public LLPanel
{
@@ -56,8 +56,38 @@ public:
RIGHT_OF_CURRENT
} eInsertionPoint;
- LLTabContainer( const std::string& name, const LLRect& rect, TabPosition pos,
- BOOL bordered, BOOL is_vertical);
+ struct TabPositions : public LLInitParam::TypeValuesHelper<LLTabContainer::TabPosition, TabPositions>
+ {
+ static void declareValues();
+ };
+
+ struct Params
+ : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<TabPosition, TabPositions> tab_position;
+ Optional<S32> tab_width,
+ tab_min_width,
+ tab_max_width;
+ Optional<bool> hide_tabs;
+ Optional<S32> tab_padding_right;
+
+ Optional<LLUIImage*> tab_top_image_unselected,
+ tab_top_image_selected,
+ tab_bottom_image_unselected,
+ tab_bottom_image_selected,
+ tab_left_image_unselected,
+ tab_left_image_selected;
+
+ Params();
+ };
+
+protected:
+ LLTabContainer(const Params&);
+ friend class LLUICtrlFactory;
+
+public:
+ //LLTabContainer( const std::string& name, const LLRect& rect, TabPosition pos,
+ // BOOL bordered, BOOL is_vertical);
/*virtual*/ ~LLTabContainer();
@@ -74,17 +104,30 @@ public:
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType type, void* cargo_data,
EAcceptance* accept, std::string& tooltip);
- /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
/*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const;
+ /*virtual*/ void initFromParams(const LLPanel::Params& p);
+ /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
+ /*virtual*/ BOOL postBuild();
+
+ struct TabPanelParams : public LLInitParam::Block<TabPanelParams>
+ {
+ Mandatory<LLPanel*> panel;
+
+ Optional<std::string> label;
+ Optional<bool> select_tab,
+ is_placeholder;
+ Optional<S32> indent;
+ Optional<eInsertionPoint> insert_at;
+ Optional<void*> user_data;
+
+ TabPanelParams()
+ : panel("panel", NULL),
+ insert_at("insert_at", END)
+ {}
+ };
- void addTabPanel(LLPanel* child,
- const std::string& label,
- BOOL select = FALSE,
- void (*on_tab_clicked)(void*, bool) = NULL,
- void* userdata = NULL,
- S32 indent = 0,
- BOOL placeholder = FALSE,
- eInsertionPoint insertion_point = END);
+ void addTabPanel(LLPanel* panel);
+ void addTabPanel(const TabPanelParams& panel);
void addPlaceholder(LLPanel* child, const std::string& label);
void removeTabPanel( LLPanel* child );
void lockTabs(S32 num_tabs = 0);
@@ -108,7 +151,6 @@ public:
BOOL selectTabPanel( LLPanel* child );
BOOL selectTab(S32 which);
BOOL selectTabByName(const std::string& title);
- BOOL setTab(S32 which);
BOOL getTabPanelFlashing(LLPanel* child);
void setTabPanelFlashing(LLPanel* child, BOOL state);
@@ -119,10 +161,6 @@ public:
void setTopBorderHeight(S32 height);
S32 getTopBorderHeight() const;
- void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool));
- void setTabPrecommitChangeCallback(LLPanel* tab, void (*on_precommit)(void*, bool));
- void setTabUserData(LLPanel* tab, void* userdata);
-
void setRightTabBtnOffset( S32 offset );
void setPanelTitle(S32 index, const std::string& title);
@@ -134,51 +172,20 @@ public:
void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
- static void onCloseBtn(void* userdata);
- static void onTabBtn(void* userdata);
- static void onNextBtn(void* userdata);
- static void onNextBtnHeld(void* userdata);
- static void onPrevBtn(void* userdata);
- static void onPrevBtnHeld(void* userdata);
- static void onJumpFirstBtn( void* userdata );
- static void onJumpLastBtn( void* userdata );
-
- static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+ void onTabBtn( const LLSD& data, LLPanel* panel );
+ void onNextBtn(const LLSD& data);
+ void onNextBtnHeld(const LLSD& data);
+ void onPrevBtn(const LLSD& data);
+ void onPrevBtnHeld(const LLSD& data);
+ void onJumpFirstBtn( const LLSD& data );
+ void onJumpLastBtn( const LLSD& data );
private:
- // Structure used to map tab buttons to and from tab panels
- struct LLTabTuple
- {
- LLTabTuple( LLTabContainer* c, LLPanel* p, LLButton* b,
- void (*cb)(void*,bool), void* userdata, LLTextBox* placeholder = NULL,
- void (*pcb)(void*,bool) = NULL)
- :
- mTabContainer(c),
- mTabPanel(p),
- mButton(b),
- mOnChangeCallback( cb ),
- mPrecommitChangeCallback( pcb ),
- mUserData( userdata ),
- mOldState(FALSE),
- mPlaceholderText(placeholder),
- mPadding(0)
- {}
-
- LLTabContainer* mTabContainer;
- LLPanel* mTabPanel;
- LLButton* mButton;
- void (*mOnChangeCallback)(void*, bool);
- void (*mPrecommitChangeCallback)(void*,bool); // Precommit callback gets called before tab is changed and
- // can prevent it from being changed. onChangeCallback is called
- // immediately after tab is actually changed - Nyx
- void* mUserData;
- BOOL mOldState;
- LLTextBox* mPlaceholderText;
- S32 mPadding;
- };
void initButtons();
+ BOOL setTab(S32 which);
+
LLTabTuple* getTab(S32 index) { return mTabList[index]; }
LLTabTuple* getTabByPanel(LLPanel* child);
void insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_point);
@@ -207,7 +214,6 @@ private:
tuple_list_t mTabList;
S32 mCurrentTabIdx;
- S32 mNextTabIdx;
BOOL mTabsHidden;
BOOL mScrolled;
@@ -216,9 +222,6 @@ private:
S32 mScrollPosPixels;
S32 mMaxScrollPos;
- void (*mCloseCallback)(void*);
- void* mCallbackUserdata;
-
LLTextBox* mTitleBox;
S32 mTopBorderHeight;
@@ -240,7 +243,13 @@ private:
S32 mTotalTabWidth;
LLFrameTimer mDragAndDropDelayTimer;
-};
+ LLPointer<LLUIImage> mImageTopUnselected;
+ LLPointer<LLUIImage> mImageTopSelected;
+ LLPointer<LLUIImage> mImageBottomUnselected;
+ LLPointer<LLUIImage> mImageBottomSelected;
+ LLPointer<LLUIImage> mImageLeftUnselected;
+ LLPointer<LLUIImage> mImageLeftSelected;
+};
#endif // LL_TABCONTAINER_H