summaryrefslogtreecommitdiff
path: root/indra/llui/lllayoutstack.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lllayoutstack.h')
-rw-r--r--indra/llui/lllayoutstack.h78
1 files changed, 64 insertions, 14 deletions
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 6fcc8e2ac3..e19ef403ef 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -28,16 +28,21 @@
#ifndef LL_LLLAYOUTSTACK_H
#define LL_LLLAYOUTSTACK_H
-#include "llview.h"
+#include "llpanel.h"
class LLPanel;
+class LLLayoutPanel;
+
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
+ struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
+ {};
+
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- Optional<std::string> orientation;
+ Mandatory<std::string> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
@@ -45,6 +50,8 @@ public:
Params();
};
+ typedef LayoutStackRegistry child_registry_t;
+
typedef enum e_layout_orientation
{
HORIZONTAL,
@@ -56,6 +63,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);
@@ -68,7 +76,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(); }
@@ -82,20 +90,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);
@@ -110,19 +116,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<LayoutPanel*> e_panel_list_t;
+ typedef std::vector<LLLayoutPanel*> 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
@@ -134,4 +139,49 @@ private:
bool mClip;
}; // end class LLLayoutStack
+class LLLayoutPanel : public LLPanel
+{
+friend class LLLayoutStack;
+friend class LLUICtrlFactory;
+public:
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<S32> min_dim,
+ max_dim;
+ Optional<bool> 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();
+
+ void initFromParams(const Params& p);
+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