diff options
author | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
commit | b235c59d60472f818a9142c0886b95a0ff4191d7 (patch) | |
tree | d323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/llui/lltextbox.cpp | |
parent | Second Life viewer sources 1.18.5.3 (diff) | |
download | meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2 meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz |
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/llui/lltextbox.cpp')
-rw-r--r-- | linden/indra/llui/lltextbox.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/linden/indra/llui/lltextbox.cpp b/linden/indra/llui/lltextbox.cpp index c0b0788..efd4245 100644 --- a/linden/indra/llui/lltextbox.cpp +++ b/linden/indra/llui/lltextbox.cpp | |||
@@ -49,6 +49,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t | |||
49 | mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), | 49 | mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), |
50 | mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), | 50 | mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), |
51 | mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ), | 51 | mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ), |
52 | mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), | ||
53 | mHoverActive( FALSE ), | ||
54 | mHasHover( FALSE ), | ||
52 | mBackgroundVisible( FALSE ), | 55 | mBackgroundVisible( FALSE ), |
53 | mBorderVisible( FALSE ), | 56 | mBorderVisible( FALSE ), |
54 | mFontStyle(LLFontGL::DROP_SHADOW_SOFT), | 57 | mFontStyle(LLFontGL::DROP_SHADOW_SOFT), |
@@ -74,6 +77,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width, | |||
74 | mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), | 77 | mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), |
75 | mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), | 78 | mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), |
76 | mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), | 79 | mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), |
80 | mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), | ||
81 | mHoverActive( FALSE ), | ||
82 | mHasHover( FALSE ), | ||
77 | mBackgroundVisible(FALSE), | 83 | mBackgroundVisible(FALSE), |
78 | mBorderVisible(FALSE), | 84 | mBorderVisible(FALSE), |
79 | mFontStyle(LLFontGL::DROP_SHADOW_SOFT), | 85 | mFontStyle(LLFontGL::DROP_SHADOW_SOFT), |
@@ -161,6 +167,16 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) | |||
161 | return handled; | 167 | return handled; |
162 | } | 168 | } |
163 | 169 | ||
170 | BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) | ||
171 | { | ||
172 | if(mHoverActive) | ||
173 | { | ||
174 | mHasHover = TRUE; // This should be set every frame during a hover. | ||
175 | return TRUE; | ||
176 | } | ||
177 | return FALSE; | ||
178 | } | ||
179 | |||
164 | void LLTextBox::setText(const LLStringExplicit& text) | 180 | void LLTextBox::setText(const LLStringExplicit& text) |
165 | { | 181 | { |
166 | mText.assign(text); | 182 | mText.assign(text); |
@@ -334,7 +350,15 @@ void LLTextBox::draw() | |||
334 | 350 | ||
335 | if ( getEnabled() ) | 351 | if ( getEnabled() ) |
336 | { | 352 | { |
337 | drawText( text_x, text_y, mTextColor ); | 353 | if(mHasHover) |
354 | { | ||
355 | drawText( text_x, text_y, mHoverColor ); | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | drawText( text_x, text_y, mTextColor ); | ||
360 | } | ||
361 | |||
338 | } | 362 | } |
339 | else | 363 | else |
340 | { | 364 | { |
@@ -346,6 +370,8 @@ void LLTextBox::draw() | |||
346 | drawDebugRect(); | 370 | drawDebugRect(); |
347 | } | 371 | } |
348 | } | 372 | } |
373 | |||
374 | mHasHover = FALSE; // This is reset every frame. | ||
349 | } | 375 | } |
350 | 376 | ||
351 | void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) | 377 | void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) |
@@ -468,5 +494,20 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f | |||
468 | text_box->setColor(color); | 494 | text_box->setColor(color); |
469 | } | 495 | } |
470 | 496 | ||
497 | if(node->hasAttribute("hover_color")) | ||
498 | { | ||
499 | LLColor4 color; | ||
500 | LLUICtrlFactory::getAttributeColor(node, "hover_color", color); | ||
501 | text_box->setHoverColor(color); | ||
502 | text_box->setHoverActive(true); | ||
503 | } | ||
504 | |||
505 | BOOL hover_active = FALSE; | ||
506 | if(node->getAttributeBOOL("hover", hover_active)) | ||
507 | { | ||
508 | text_box->setHoverActive(hover_active); | ||
509 | } | ||
510 | |||
511 | |||
471 | return text_box; | 512 | return text_box; |
472 | } | 513 | } |