summaryrefslogtreecommitdiff
path: root/indra/llui/lllayoutstack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lllayoutstack.cpp')
-rw-r--r--indra/llui/lllayoutstack.cpp74
1 files changed, 45 insertions, 29 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index f407fe471c..a0275b6ed5 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -47,47 +47,47 @@ LLLayoutPanel::LLLayoutPanel(const Params& p)
mMaxDim(p.max_dim),
mAutoResize(p.auto_resize),
mUserResize(p.user_resize),
- mCollapsed(FALSE),
- mCollapseAmt(0.f),
- mVisibleAmt(1.f), // default to fully visible
- mResizeBar(NULL)
-{
+ mCollapsed(FALSE),
+ mCollapseAmt(0.f),
+ mVisibleAmt(1.f), // default to fully visible
+ mResizeBar(NULL)
+ {
// panels initialized as hidden should not start out partially visible
if (!getVisible())
- {
+ {
mVisibleAmt = 0.f;
- }
-}
+ }
+ }
void LLLayoutPanel::initFromParams(const Params& p)
-{
+ {
LLPanel::initFromParams(p);
setFollowsNone();
-}
+ }
LLLayoutPanel::~LLLayoutPanel()
-{
- // probably not necessary, but...
- delete mResizeBar;
- mResizeBar = NULL;
-}
+ {
+ // probably not necessary, but...
+ delete mResizeBar;
+ mResizeBar = NULL;
+ }
F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation)
-{
- if (orientation == LLLayoutStack::HORIZONTAL)
{
- F32 collapse_amt =
+ if (orientation == LLLayoutStack::HORIZONTAL)
+ {
+ F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth()));
- return mVisibleAmt * collapse_amt;
- }
- else
+ return mVisibleAmt * collapse_amt;
+ }
+ else
{
- F32 collapse_amt =
+ F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight())));
- return mVisibleAmt * collapse_amt;
+ return mVisibleAmt * collapse_amt;
+ }
}
-}
//
// LLLayoutStack
@@ -172,14 +172,14 @@ BOOL LLLayoutStack::postBuild()
}
bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
-{
+ {
LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
- if (panelp)
- {
+ if (panelp)
+ {
mPanels.push_back(panelp);
- }
+ }
return LLView::addChild(child, tab_group);
-}
+ }
S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
@@ -206,6 +206,22 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
return cur_width;
}
+void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front)
+{
+ LayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move);
+ LayoutPanel* embedded_target_panel = move_to_front ? *mPanels.begin() : findEmbeddedPanel(target_panel);
+
+ if (!embedded_panel_to_move || !embedded_target_panel || embedded_panel_to_move == embedded_target_panel)
+ {
+ llwarns << "One of the panels was not found in stack or NULL was passed instead of valid panel" << llendl;
+ return;
+ }
+ e_panel_list_t::iterator it = std::find(mPanels.begin(), mPanels.end(), embedded_panel_to_move);
+ mPanels.erase(it);
+ it = move_to_front ? mPanels.begin() : std::find(mPanels.begin(), mPanels.end(), embedded_target_panel);
+ mPanels.insert(it, embedded_panel_to_move);
+}
+
void LLLayoutStack::addPanel(LLLayoutPanel* panel, EAnimate animate)
{
addChild(panel);