diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-11-07 22:55:27 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-11-07 22:55:27 +0000 |
commit | 050dad0ce35207a4ac1562175e853590ad9b7681 (patch) | |
tree | be5dc291d2313112e5733d8c004edfe67da6fc54 /indra/llui/lltextbox.cpp | |
parent | 6fd04521d720a3a4904069d10e8ed970d870ba7f (diff) |
merge svn+ssh://steve@svn/svn/linden/branches/viewer-cleanup-3 -r 73026:73079
Diffstat (limited to 'indra/llui/lltextbox.cpp')
-rw-r--r-- | indra/llui/lltextbox.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index c0b0788c0b..efd42455e5 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -49,6 +49,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& t mDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), mBackgroundColor( LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ) ), mBorderColor( LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ) ), + mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), + mHoverActive( FALSE ), + mHasHover( FALSE ), mBackgroundVisible( FALSE ), mBorderVisible( FALSE ), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), @@ -74,6 +77,9 @@ LLTextBox::LLTextBox(const LLString& name, const LLString& text, F32 max_width, mDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), mBackgroundColor(LLUI::sColorsGroup->getColor("DefaultBackgroundColor")), mBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")), + mHoverColor( LLUI::sColorsGroup->getColor( "LabelSelectedColor" ) ), + mHoverActive( FALSE ), + mHasHover( FALSE ), mBackgroundVisible(FALSE), mBorderVisible(FALSE), mFontStyle(LLFontGL::DROP_SHADOW_SOFT), @@ -161,6 +167,16 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } +BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) +{ + if(mHoverActive) + { + mHasHover = TRUE; // This should be set every frame during a hover. + return TRUE; + } + return FALSE; +} + void LLTextBox::setText(const LLStringExplicit& text) { mText.assign(text); @@ -334,7 +350,15 @@ void LLTextBox::draw() if ( getEnabled() ) { - drawText( text_x, text_y, mTextColor ); + if(mHasHover) + { + drawText( text_x, text_y, mHoverColor ); + } + else + { + drawText( text_x, text_y, mTextColor ); + } + } else { @@ -346,6 +370,8 @@ void LLTextBox::draw() drawDebugRect(); } } + + mHasHover = FALSE; // This is reset every frame. } void LLTextBox::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -468,5 +494,20 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f text_box->setColor(color); } + if(node->hasAttribute("hover_color")) + { + LLColor4 color; + LLUICtrlFactory::getAttributeColor(node, "hover_color", color); + text_box->setHoverColor(color); + text_box->setHoverActive(true); + } + + BOOL hover_active = FALSE; + if(node->getAttributeBOOL("hover", hover_active)) + { + text_box->setHoverActive(hover_active); + } + + return text_box; } |