Skip to content
Snippets Groups Projects
Commit 03ff3dc5 authored by James Cook's avatar James Cook
Browse files

Added hand-cursor to clickable text boxes, fixed hover_color warnings for login screen.

Reviewed with Richard.
parent 382174ce
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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 @@ class LLTextBox :
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);
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment