diff options
author | James Cook <james@lindenlab.com> | 2009-11-02 14:58:24 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-02 14:58:24 -0800 |
commit | 03ff3dc57d4650c5451c2b304a2ee6fbee3ff74e (patch) | |
tree | 929be144b42bf6ba57409706cf1542bbeb83a8a0 | |
parent | 382174ceb3bee86c46afc61d5bc33f79d3ae8246 (diff) |
Added hand-cursor to clickable text boxes, fixed hover_color warnings for login screen.
Reviewed with Richard.
-rw-r--r-- | indra/llui/lltextbox.cpp | 26 | ||||
-rw-r--r-- | indra/llui/lltextbox.h | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_login.xml | 33 |
3 files changed, 34 insertions, 46 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); diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index afe00271f7..317c79e08f 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -23,19 +23,15 @@ border_visible="false" bottom="600" follows="all" - layout="topleft" left="0" name="login_html" right="-1" start_url="" top="1" /> <text - type="string" - length="1" follows="left|bottom" font="SansSerif" height="16" - layout="topleft" left="32" name="first_name_text" top="530" @@ -46,7 +42,6 @@ follows="left|bottom" handle_edit_keys_directly="true" height="20" - layout="topleft" left_delta="0" max_length="31" name="first_name_edit" @@ -55,12 +50,9 @@ top_pad="2" width="120" /> <text - type="string" - length="1" follows="left|bottom" font="SansSerif" height="16" - layout="topleft" left="164" name="last_name_text" top="530" @@ -72,7 +64,6 @@ font="SansSerif" handle_edit_keys_directly="true" height="20" - layout="topleft" left_delta="0" max_length="31" name="last_name_edit" @@ -81,12 +72,9 @@ top_pad="2" width="120" /> <text - type="string" - length="1" follows="left|bottom" font="SansSerif" height="16" - layout="topleft" left="296" name="password_text" top="530" @@ -98,7 +86,6 @@ font="SansSerif" handle_edit_keys_directly="true" height="20" - layout="topleft" left_delta="0" max_length="16" name="password_edit" @@ -124,12 +111,9 @@ name="server_combo" width="100" /> <text - type="string" - length="1" follows="left|bottom" font="SansSerif" height="16" - layout="topleft" left="32" name="start_location_text" top="576" @@ -141,7 +125,6 @@ control_name="LoginLocation" follows="left|bottom" height="23" - layout="topleft" left_pad="0" max_chars="128" name="start_location_combo" @@ -165,20 +148,14 @@ follows="left|bottom" height="16" label="Remember password" - layout="topleft" left_pad="10" name="remember_check" top_delta="3" width="138" /> <text - type="string" - length="1" follows="right|bottom" halign="right" height="16" - hover="true" - hover_color="0.2 0.45 0.72 1" - layout="topleft" left="-210" name="create_new_account_text" top="539" @@ -186,14 +163,9 @@ Create a new account </text> <text - type="string" - length="1" follows="right|bottom" halign="right" height="16" - hover="true" - hover_color="0.2 0.45 0.72 1" - layout="topleft" left_delta="0" name="forgot_password_text" top_pad="4" @@ -201,14 +173,9 @@ Forgot your name or password? </text> <text - type="string" - length="1" follows="right|bottom" halign="right" height="16" - hover="true" - hover_color="0.2 0.45 0.72 1" - layout="topleft" left="-310" name="channel_text" top="579" |