summaryrefslogtreecommitdiff
path: root/indra/llui/llbutton.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/llbutton.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/llbutton.cpp')
-rw-r--r--indra/llui/llbutton.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 4f0c0d31bd..f40d99c024 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -732,16 +732,7 @@ void LLButton::draw()
}
// Unselected label assignments
- LLWString label;
-
- if( getToggleState() )
- {
- label = mSelectedLabel;
- }
- else
- {
- label = mUnselectedLabel;
- }
+ LLWString label = getCurrentLabel();
// overlay with keyboard focus border
if (hasFocus())
@@ -988,6 +979,23 @@ void LLButton::setLabelSelected( const LLStringExplicit& label )
mSelectedLabel = label;
}
+bool LLButton::labelIsTruncated() const
+{
+ return getCurrentLabel().getString().size() > mLastDrawCharsCount;
+}
+
+const LLUIString& LLButton::getCurrentLabel() const
+{
+ if( getToggleState() )
+ {
+ return mSelectedLabel;
+ }
+ else
+ {
+ return mUnselectedLabel;
+ }
+}
+
void LLButton::setImageUnselected(LLPointer<LLUIImage> image)
{
mImageUnselected = image;
@@ -999,16 +1007,7 @@ void LLButton::setImageUnselected(LLPointer<LLUIImage> image)
void LLButton::autoResize()
{
- LLUIString label;
- if(getToggleState())
- {
- label = mSelectedLabel;
- }
- else
- {
- label = mUnselectedLabel;
- }
- resize(label);
+ resize(getCurrentLabel());
}
void LLButton::resize(LLUIString label)