From 0daa627db4f1bba2f69ec717426b26593674d14c Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 24 Aug 2010 11:44:28 -0700 Subject: removed LLLayoutStack::fromXML custom xml parsing --- indra/llui/lllayoutstack.h | 74 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 13 deletions(-) (limited to 'indra/llui/lllayoutstack.h') diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index e454454fe2..cc5bd6cf65 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -34,13 +34,18 @@ #ifndef LL_LLLAYOUTSTACK_H #define LL_LLLAYOUTSTACK_H -#include "llview.h" +#include "llpanel.h" class LLPanel; +class LLLayoutPanel; + class LLLayoutStack : public LLView, public LLInstanceTracker { public: + struct LayoutStackRegistry : public LLChildRegistry + {}; + struct Params : public LLInitParam::Block { Optional orientation; @@ -51,6 +56,8 @@ public: Params(); }; + typedef LayoutStackRegistry child_registry_t; + typedef enum e_layout_orientation { HORIZONTAL, @@ -62,6 +69,7 @@ public: /*virtual*/ void draw(); /*virtual*/ void removeChild(LLView*); /*virtual*/ BOOL postBuild(); + /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); @@ -74,7 +82,7 @@ public: ANIMATE } EAnimate; - void addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX); + void addPanel(LLLayoutPanel* panel, EAnimate animate = NO_ANIMATE); void removePanel(LLPanel* panel); void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE); S32 getNumPanels() { return mPanels.size(); } @@ -83,20 +91,18 @@ public: void setPanelUserResize(const std::string& panel_name, BOOL user_resize); /** - * Gets minimal width and/or height of the specified by name panel. + * Gets minimal dimension along layout_stack axis of the specified by name panel. * - * If it is necessary to get only the one dimension pass NULL for another one. * @returns true if specified by panel_name internal panel exists, false otherwise. */ - bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp); + bool getPanelMinSize(const std::string& panel_name, S32* min_dimp); /** - * Gets maximal width and/or height of the specified by name panel. + * Gets maximal dimension along layout_stack axis of the specified by name panel. * - * If it is necessary to get only the one dimension pass NULL for another one. * @returns true if specified by panel_name internal panel exists, false otherwise. */ - bool getPanelMaxSize(const std::string& panel_name, S32* max_width, S32* max_height); + bool getPanelMaxSize(const std::string& panel_name, S32* max_dim); void updateLayout(BOOL force_resize = FALSE); @@ -111,19 +117,18 @@ protected: friend class LLUICtrlFactory; private: - struct LayoutPanel; - + void createResizeBars(); void calcMinExtents(); S32 getDefaultHeight(S32 cur_height); S32 getDefaultWidth(S32 cur_width); const ELayoutOrientation mOrientation; - typedef std::vector e_panel_list_t; + typedef std::vector e_panel_list_t; e_panel_list_t mPanels; - LayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; - LayoutPanel* findEmbeddedPanelByName(const std::string& name) const; + LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const; + LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const; S32 mMinWidth; // calculated by calcMinExtents S32 mMinHeight; // calculated by calcMinExtents @@ -135,4 +140,47 @@ private: bool mClip; }; // end class LLLayoutStack +class LLLayoutPanel : public LLPanel +{ +friend LLLayoutStack; +friend class LLUICtrlFactory; +public: + struct Params : public LLInitParam::Block + { + Optional min_dim, + max_dim; + Optional user_resize, + auto_resize; + + Params() + : min_dim("min_dim", 0), + max_dim("max_dim", 0), + user_resize("user_resize", true), + auto_resize("auto_resize", true) + { + addSynonym(min_dim, "min_width"); + addSynonym(min_dim, "min_height"); + addSynonym(max_dim, "max_width"); + addSynonym(max_dim, "max_height"); + } + }; + + ~LLLayoutPanel(); +protected: + LLLayoutPanel(const Params& p) ; + + + F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); + + S32 mMinDim; + S32 mMaxDim; + BOOL mAutoResize; + BOOL mUserResize; + BOOL mCollapsed; + class LLResizeBar* mResizeBar; + F32 mVisibleAmt; + F32 mCollapseAmt; +}; + + #endif -- cgit v1.2.3 From 92db224e8624c22eb9e8516662685c68cb819e69 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Aug 2010 16:46:37 -0700 Subject: fixed regressions from changing layout panel to be a derived widget class --- indra/llui/lllayoutstack.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui/lllayoutstack.h') diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index cc5bd6cf65..9bcfa2c957 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -166,6 +166,8 @@ public: }; ~LLLayoutPanel(); + + void initFromParams(const Params& p); protected: LLLayoutPanel(const Params& p) ; -- cgit v1.2.3 From 2f0d1f98834a37063c1ebde2c518bf20854381e2 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 26 Aug 2010 11:19:43 -0700 Subject: Fix for a mac build error. --- indra/llui/lllayoutstack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/lllayoutstack.h') diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 9bcfa2c957..e62c9776cb 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -142,7 +142,7 @@ private: class LLLayoutPanel : public LLPanel { -friend LLLayoutStack; +friend class LLLayoutStack; friend class LLUICtrlFactory; public: struct Params : public LLInitParam::Block -- cgit v1.2.3 From ead46208b02f31c8ed06242a016501d57c90abfb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 26 Aug 2010 12:33:31 -0700 Subject: made layoutstack orientation mandatory --- indra/llui/lllayoutstack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/lllayoutstack.h') diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 9bcfa2c957..c7e27b6866 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -48,7 +48,7 @@ public: struct Params : public LLInitParam::Block { - Optional orientation; + Mandatory orientation; Optional border_size; Optional animate, clip; -- cgit v1.2.3