summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-09-08 18:21:03 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-09-08 18:21:03 +0100
commita2fb3fabc7926dd105393391f334baa78f232640 (patch)
tree8a45415f37f20ade3ee86488021466ca17976524 /indra/llui
parentbb51a764ece0f48161ddea1c519a7e427ccfdf23 (diff)
parenteb10840623b6f0386a7990ee946cfa5879094fb3 (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lllayoutstack.cpp16
-rw-r--r--indra/llui/lllayoutstack.h5
2 files changed, 21 insertions, 0 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 5cc9add1e2..0ff7557ead 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -368,6 +368,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(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index)
{
// panel starts off invisible (collapsed)
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index cd59ee3966..6fcc8e2ac3 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -72,6 +72,11 @@ public:
void removePanel(LLPanel* panel);
void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
S32 getNumPanels() { return mPanels.size(); }
+ /**
+ * Moves panel_to_move before target_panel inside layout stack (both panels should already be there).
+ * If move_to_front is true target_panel is ignored and panel_to_move is moved to the beginning of mPanels
+ */
+ void movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front = false);
void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
void setPanelUserResize(const std::string& panel_name, BOOL user_resize);