summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp3
-rw-r--r--indra/llui/lltextbox.cpp43
-rw-r--r--indra/llui/lltextbox.h11
3 files changed, 51 insertions, 6 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 36ccc32255..26ce473e08 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -368,9 +368,6 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
(*mClickedCallback)( mCallbackUserData );
}
}
-
- mMouseDownTimer.stop();
- mMouseDownTimer.reset();
}
return TRUE;
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;
}
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 7e7018ac52..c7c79464a0 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -66,11 +66,16 @@ public:
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
void setColor( const LLColor4& c ) { mTextColor = c; }
void setDisabledColor( const LLColor4& c) { mDisabledColor = c; }
void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; }
void setBorderColor( const LLColor4& c) { mBorderColor = c; }
+
+ void setHoverColor( const LLColor4& c ) { mHoverColor = c; }
+ void setHoverActive( BOOL active ) { mHoverActive = active; }
+
void setText( const LLStringExplicit& text );
void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0);
// default width means use existing control width
@@ -108,10 +113,12 @@ protected:
const LLFontGL* mFontGL;
LLColor4 mTextColor;
LLColor4 mDisabledColor;
-
LLColor4 mBackgroundColor;
LLColor4 mBorderColor;
-
+ LLColor4 mHoverColor;
+
+ BOOL mHoverActive;
+ BOOL mHasHover;
BOOL mBackgroundVisible;
BOOL mBorderVisible;