diff options
author | Merov Linden <merov@lindenlab.com> | 2011-10-12 19:49:09 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-10-12 19:49:09 -0700 |
commit | 303579309d805ce8f48dc0af3b19eaa38533dfe8 (patch) | |
tree | 19d86c250a2d2f6e6806c972d7eaeedbccf5bb84 /indra/llui/lltoolbar.cpp | |
parent | c14aa1b64e1190ff4bd7deef864d5393988e7f91 (diff) | |
parent | 8affdabac33abbe63bea028dc92620550c06aff4 (diff) |
Pull from richard/viewer-experience-fui
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 5e025f6a45..3ea0968bfc 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -194,9 +194,9 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH(LLCommandId::Params params, p.commands) + BOOST_FOREACH(LLCommandId id, p.commands) { - addCommand(params); + addCommand(id); } mNeedsLayout = true; @@ -452,17 +452,17 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) { // We hit passed the end of the list so put the insertion point at the end if (orientation == LLLayoutStack::HORIZONTAL) - { + { mDragx = button_rect.mRight + mPadRight; mDragy = button_rect.mTop + mPadTop; - } - else - { + } + else + { mDragx = button_rect.mLeft - mPadLeft; mDragy = button_rect.mBottom - mPadBottom; } } - + // Update the "girth" of the caret, i.e. the width or height (depending of orientation) if (orientation == LLLayoutStack::HORIZONTAL) { @@ -744,13 +744,10 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) LLCommand* commandp = LLCommandManager::instance().getCommand(id); if (!commandp) return NULL; - std::string label = LLTrans::getString(commandp->labelRef()); - std::string tooltip = label + "\n" + LLTrans::getString(commandp->tooltipRef()); - LLToolBarButton::Params button_p; button_p.name = id.name(); - button_p.label = label; - button_p.tool_tip = tooltip; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.tool_tip = LLTrans::getString(commandp->tooltipRef()); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); @@ -948,3 +945,28 @@ void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent) { LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent); } + +const std::string LLToolBarButton::getToolTip() const +{ + std::string tooltip; + if (labelIsTruncated() || getCurrentLabel().empty()) + { + return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip(); + } + else + { + return LLView::getToolTip(); + } +} + + + + + + + + + + + + |