diff options
author | James Cook <james@lindenlab.com> | 2009-11-03 11:23:24 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-03 11:23:24 -0800 |
commit | 3f8c129a1f4caefcc25c895a6612aaaaa0c6aaa3 (patch) | |
tree | c0bf19bda10f11de451a364a05770ffd69c605e0 /indra/llui | |
parent | b368f466248054517813922bb745f1da2a6a8df9 (diff) | |
parent | d220211b4dc7e5d39fc1c5f26b3b2bf528a90910 (diff) |
merge
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lltextbox.cpp | 26 | ||||
-rw-r--r-- | indra/llui/lltextbox.h | 21 |
2 files changed, 34 insertions, 13 deletions
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 20bceb4675..00f1d833a3 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -45,6 +45,9 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p) mClickedCallback(NULL) {} +LLTextBox::~LLTextBox() +{} + BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLTextBase::handleMouseDown(x, y, mask); @@ -97,6 +100,18 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } +BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) +{ + BOOL handled = LLTextBase::handleHover(x, y, mask); + if (!handled && mClickedCallback) + { + // Clickable text boxes change the cursor to a hand + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); + return TRUE; + } + return handled; +} + void LLTextBox::setText(const LLStringExplicit& text) { // does string argument insertion @@ -105,6 +120,11 @@ void LLTextBox::setText(const LLStringExplicit& text) LLTextBase::setText(mText.getString()); } +void LLTextBox::setClickedCallback( boost::function<void (void*)> cb, void* userdata /*= NULL */ ) +{ + mClickedCallback = boost::bind(cb, userdata); +} + S32 LLTextBox::getTextPixelWidth() { return getContentsRect().getWidth(); @@ -115,6 +135,12 @@ S32 LLTextBox::getTextPixelHeight() return getContentsRect().getHeight(); } + +LLSD LLTextBox::getValue() const +{ + return LLSD(getText()); +} + BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index da0bcbe972..73f8a7c299 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -33,8 +33,6 @@ #ifndef LL_LLTEXTBOX_H #define LL_LLTEXTBOX_H -#include "v4color.h" -#include "llstring.h" #include "lluistring.h" #include "lltextbase.h" @@ -54,28 +52,25 @@ protected: friend class LLUICtrlFactory; public: - virtual ~LLTextBox() {} + virtual ~LLTextBox(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + /*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); - /*virtual*/ void setText( const LLStringExplicit& text ); + /*virtual*/ void setText( const LLStringExplicit& text ); void setRightAlign() { mHAlign = LLFontGL::RIGHT; } void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } - void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ){ mClickedCallback = boost::bind(cb, userdata); } // mouse down and up within button - - //const LLFontGL* getFont() const { return mDefaultFont; } - //void setFont(const LLFontGL* font) { mDefaultFont = font; } + void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); void reshapeToFitText(); - //const std::string& getText() const { return mText.getString(); } S32 getTextPixelWidth(); S32 getTextPixelHeight(); - virtual LLSD getValue() const { return LLSD(getText()); } - virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); + /*virtual*/ LLSD getValue() const; + /*virtual*/ BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); protected: void onUrlLabelUpdated(const std::string &url, const std::string &label); |