diff options
author | Richard Linden <none@none> | 2011-09-20 16:37:21 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2011-09-20 16:37:21 -0700 |
commit | 64f30a302dfbcaf56502676fa4b8d8a06f355b40 (patch) | |
tree | 33cc60eb960181fa35142c7dffcb26f4efef9e2e /indra/llui/lllayoutstack.cpp | |
parent | 3df9545017a4835e162801d3e8a13d68c8bc44ad (diff) |
EXP-1228 FIX Create toolbar widget class that displays list of buttons horizontally or vertically
buttons are now centered and sized according to content
created floater_test_toolbar.xml to test
Diffstat (limited to 'indra/llui/lllayoutstack.cpp')
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a250404292..0d1f608e61 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -55,6 +55,7 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), + mFitContent(p.fit_content), mCollapsed(FALSE), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible @@ -104,6 +105,14 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati } } +void LLLayoutPanel::fitToContent() +{ + if (mFitContent) + { + setShape(calcBoundingRect()); + } +} + // // LLLayoutStack // @@ -324,6 +333,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize) for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); + panelp->fitToContent(); if (panelp->getVisible()) { if (mAnimate) @@ -478,7 +488,9 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { // shrink proportionally to amount over minimum // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) : 0; + delta_size = (shrink_headroom_available > 0) + ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) + : 0; shrink_headroom_available -= (cur_width - relevant_min); } else |