summaryrefslogtreecommitdiff
path: root/indra/llui/lltoolbar.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-10-12 18:16:59 -0700
committerRichard Nelson <richard@lindenlab.com>2011-10-12 18:16:59 -0700
commit9206226a377c88d34036ebd8a3ac6d9d55bc4146 (patch)
tree7b5515350c49018773c4021c202edb619ffe2318 /indra/llui/lltoolbar.cpp
parent17731c50a8ad2c465654db3cf88bcc2e885e2716 (diff)
tooltips now only show labels for toolbar buttons when label is hidden or truncated
tooltips are no longer instantaneous once a tooltip is visible
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r--indra/llui/lltoolbar.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index a75a1552fc..fc5ec5ea26 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -193,9 +193,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;
@@ -688,13 +688,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);
@@ -886,3 +883,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();
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+