diff options
Diffstat (limited to 'linden/indra/llui/llbutton.cpp')
-rw-r--r-- | linden/indra/llui/llbutton.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index de8b82e..aa50a6e 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp | |||
@@ -89,7 +89,8 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co | |||
89 | mCurGlowStrength(0.f), | 89 | mCurGlowStrength(0.f), |
90 | mNeedsHighlight(FALSE), | 90 | mNeedsHighlight(FALSE), |
91 | mCommitOnReturn(TRUE), | 91 | mCommitOnReturn(TRUE), |
92 | mImagep( NULL ) | 92 | mImagep( NULL ), |
93 | mIsDirty( FALSE ) | ||
93 | { | 94 | { |
94 | mUnselectedLabel = name; | 95 | mUnselectedLabel = name; |
95 | mSelectedLabel = name; | 96 | mSelectedLabel = name; |
@@ -216,6 +217,9 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const LL | |||
216 | mHighlightColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedFgColor" ) ); | 217 | mHighlightColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedFgColor" ) ); |
217 | mUnselectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedBgColor" ) ); | 218 | mUnselectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedBgColor" ) ); |
218 | mSelectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonSelectedBgColor" ) ); | 219 | mSelectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonSelectedBgColor" ) ); |
220 | |||
221 | mImageOverlayAlignment = LLFontGL::HCENTER; | ||
222 | mImageOverlayColor = LLColor4::white; | ||
219 | } | 223 | } |
220 | 224 | ||
221 | LLButton::~LLButton() | 225 | LLButton::~LLButton() |
@@ -271,8 +275,12 @@ void LLButton::onCommit() | |||
271 | { | 275 | { |
272 | (*mClickedCallback)( mCallbackUserData ); | 276 | (*mClickedCallback)( mCallbackUserData ); |
273 | } | 277 | } |
278 | |||
279 | mIsDirty = TRUE; | ||
274 | } | 280 | } |
275 | 281 | ||
282 | |||
283 | |||
276 | BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) | 284 | BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) |
277 | { | 285 | { |
278 | BOOL handled = FALSE; | 286 | BOOL handled = FALSE; |
@@ -282,7 +290,8 @@ BOOL LLButton::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) | |||
282 | { | 290 | { |
283 | (*mClickedCallback)( mCallbackUserData ); | 291 | (*mClickedCallback)( mCallbackUserData ); |
284 | } | 292 | } |
285 | handled = TRUE; | 293 | handled = TRUE; |
294 | mIsDirty = TRUE; | ||
286 | } | 295 | } |
287 | return handled; | 296 | return handled; |
288 | } | 297 | } |
@@ -299,6 +308,7 @@ BOOL LLButton::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent ) | |||
299 | (*mClickedCallback)( mCallbackUserData ); | 308 | (*mClickedCallback)( mCallbackUserData ); |
300 | } | 309 | } |
301 | handled = TRUE; | 310 | handled = TRUE; |
311 | mIsDirty = TRUE; | ||
302 | } | 312 | } |
303 | } | 313 | } |
304 | return handled; | 314 | return handled; |
@@ -359,6 +369,8 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) | |||
359 | { | 369 | { |
360 | (*mClickedCallback)( mCallbackUserData ); | 370 | (*mClickedCallback)( mCallbackUserData ); |
361 | } | 371 | } |
372 | |||
373 | mIsDirty = TRUE; | ||
362 | } | 374 | } |
363 | 375 | ||
364 | mMouseDownTimer.stop(); | 376 | mMouseDownTimer.stop(); |
@@ -618,7 +630,7 @@ void LLButton::draw() | |||
618 | // draw overlay image | 630 | // draw overlay image |
619 | if (mImageOverlay.notNull()) | 631 | if (mImageOverlay.notNull()) |
620 | { | 632 | { |
621 | const S32 IMG_PAD = 4; | 633 | const S32 IMG_PAD = 5; |
622 | // get max width and height (discard level 0) | 634 | // get max width and height (discard level 0) |
623 | S32 overlay_width = mImageOverlay->getWidth(0); | 635 | S32 overlay_width = mImageOverlay->getWidth(0); |
624 | S32 overlay_height = mImageOverlay->getHeight(0); | 636 | S32 overlay_height = mImageOverlay->getHeight(0); |
@@ -639,7 +651,7 @@ void LLButton::draw() | |||
639 | overlay_width, | 651 | overlay_width, |
640 | overlay_height, | 652 | overlay_height, |
641 | mImageOverlay, | 653 | mImageOverlay, |
642 | LLColor4::white); | 654 | mImageOverlayColor); |
643 | break; | 655 | break; |
644 | case LLFontGL::HCENTER: | 656 | case LLFontGL::HCENTER: |
645 | gl_draw_scaled_image( | 657 | gl_draw_scaled_image( |
@@ -648,7 +660,7 @@ void LLButton::draw() | |||
648 | overlay_width, | 660 | overlay_width, |
649 | overlay_height, | 661 | overlay_height, |
650 | mImageOverlay, | 662 | mImageOverlay, |
651 | LLColor4::white); | 663 | mImageOverlayColor); |
652 | break; | 664 | break; |
653 | case LLFontGL::RIGHT: | 665 | case LLFontGL::RIGHT: |
654 | gl_draw_scaled_image( | 666 | gl_draw_scaled_image( |
@@ -657,7 +669,7 @@ void LLButton::draw() | |||
657 | overlay_width, | 669 | overlay_width, |
658 | overlay_height, | 670 | overlay_height, |
659 | mImageOverlay, | 671 | mImageOverlay, |
660 | LLColor4::white); | 672 | mImageOverlayColor); |
661 | break; | 673 | break; |
662 | default: | 674 | default: |
663 | // draw nothing | 675 | // draw nothing |
@@ -761,6 +773,7 @@ void LLButton::setToggleState(BOOL b) | |||
761 | void LLButton::setValue(const LLSD& value ) | 773 | void LLButton::setValue(const LLSD& value ) |
762 | { | 774 | { |
763 | mToggleState = value.asBoolean(); | 775 | mToggleState = value.asBoolean(); |
776 | mIsDirty = FALSE; | ||
764 | } | 777 | } |
765 | 778 | ||
766 | LLSD LLButton::getValue() const | 779 | LLSD LLButton::getValue() const |
@@ -876,7 +889,7 @@ void LLButton::setHoverImages( const LLString& image_name, const LLString& selec | |||
876 | setImageHoverSelected(selected_name); | 889 | setImageHoverSelected(selected_name); |
877 | } | 890 | } |
878 | 891 | ||
879 | void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment) | 892 | void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment, const LLColor4& color) |
880 | { | 893 | { |
881 | if (image_name.empty()) | 894 | if (image_name.empty()) |
882 | { | 895 | { |
@@ -887,6 +900,7 @@ void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alig | |||
887 | LLUUID overlay_image_id = LLUI::findAssetUUIDByName(image_name); | 900 | LLUUID overlay_image_id = LLUI::findAssetUUIDByName(image_name); |
888 | mImageOverlay = LLUI::sImageProvider->getUIImageByID(overlay_image_id); | 901 | mImageOverlay = LLUI::sImageProvider->getUIImageByID(overlay_image_id); |
889 | mImageOverlayAlignment = alignment; | 902 | mImageOverlayAlignment = alignment; |
903 | mImageOverlayColor = color; | ||
890 | } | 904 | } |
891 | } | 905 | } |
892 | 906 | ||