diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/lltextbox.h | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/linden/indra/llui/lltextbox.h b/linden/indra/llui/lltextbox.h index c8bdfc5..7bea722 100644 --- a/linden/indra/llui/lltextbox.h +++ b/linden/indra/llui/lltextbox.h | |||
@@ -35,11 +35,8 @@ | |||
35 | #include "lluictrl.h" | 35 | #include "lluictrl.h" |
36 | #include "v4color.h" | 36 | #include "v4color.h" |
37 | #include "llstring.h" | 37 | #include "llstring.h" |
38 | #include "llfontgl.h" | ||
39 | #include "lluistring.h" | 38 | #include "lluistring.h" |
40 | 39 | ||
41 | class LLUICtrlFactory; | ||
42 | |||
43 | 40 | ||
44 | class LLTextBox | 41 | class LLTextBox |
45 | : public LLUICtrl | 42 | : public LLUICtrl |
@@ -48,18 +45,22 @@ public: | |||
48 | // By default, follows top and left and is mouse-opaque. | 45 | // By default, follows top and left and is mouse-opaque. |
49 | // If no text, text = name. | 46 | // If no text, text = name. |
50 | // If no font, uses default system font. | 47 | // If no font, uses default system font. |
51 | LLTextBox(const LLString& name, const LLRect& rect, const LLString& text = LLString::null, | 48 | LLTextBox(const LLString& name, const LLRect& rect, const LLString& text, |
52 | const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); | 49 | const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); |
53 | 50 | ||
54 | // Construct a textbox which handles word wrapping for us. | 51 | // Construct a textbox which handles word wrapping for us. |
55 | LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200, | 52 | LLTextBox(const LLString& name, const LLString& text, F32 max_width = 200, |
56 | const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); | 53 | const LLFontGL* font = NULL, BOOL mouse_opaque = TRUE ); |
57 | 54 | ||
58 | virtual ~LLTextBox(); | 55 | // "Simple" constructors for text boxes that have the same name and label *TO BE DEPRECATED* |
59 | virtual EWidgetType getWidgetType() const; | 56 | LLTextBox(const LLString& name_and_label, const LLRect& rect); |
60 | virtual LLString getWidgetTag() const; | 57 | LLTextBox(const LLString& name_and_label); |
58 | |||
59 | virtual ~LLTextBox() {} | ||
60 | virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_TEXT_BOX; } | ||
61 | virtual LLString getWidgetTag() const { return LL_TEXT_BOX_TAG; } | ||
61 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | 62 | virtual LLXMLNodePtr getXML(bool save_children = true) const; |
62 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | 63 | static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); |
63 | 64 | ||
64 | virtual void draw(); | 65 | virtual void draw(); |
65 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | 66 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); |
@@ -77,8 +78,7 @@ public: | |||
77 | void setHoverActive( BOOL active ) { mHoverActive = active; } | 78 | void setHoverActive( BOOL active ) { mHoverActive = active; } |
78 | 79 | ||
79 | void setText( const LLStringExplicit& text ); | 80 | void setText( const LLStringExplicit& text ); |
80 | void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); | 81 | void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0); // -1 means use existing control width |
81 | // default width means use existing control width | ||
82 | void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } | 82 | void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } |
83 | 83 | ||
84 | void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; } | 84 | void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; } |
@@ -90,7 +90,7 @@ public: | |||
90 | void setRightAlign() { mHAlign = LLFontGL::RIGHT; } | 90 | void setRightAlign() { mHAlign = LLFontGL::RIGHT; } |
91 | void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } | 91 | void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } |
92 | void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button | 92 | void setClickedCallback( void (*cb)(void *data) ){ mClickedCallback = cb; } // mouse down and up within button |
93 | void setCallbackUserData( void* data ) { mCallbackUserData = data; } | 93 | void setCallbackUserData( void* data ) { mCallbackUserData = data; } |
94 | 94 | ||
95 | const LLFontGL* getFont() const { return mFontGL; } | 95 | const LLFontGL* getFont() const { return mFontGL; } |
96 | 96 | ||
@@ -100,16 +100,14 @@ public: | |||
100 | S32 getTextPixelWidth(); | 100 | S32 getTextPixelWidth(); |
101 | S32 getTextPixelHeight(); | 101 | S32 getTextPixelHeight(); |
102 | 102 | ||
103 | 103 | virtual void setValue(const LLSD& value ) { setText(value.asString()); } | |
104 | virtual void setValue(const LLSD& value ); | 104 | virtual LLSD getValue() const { return LLSD(getText()); } |
105 | virtual LLSD getValue() const; | ||
106 | virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); | 105 | virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text ); |
107 | 106 | ||
108 | protected: | 107 | private: |
109 | void setLineLengths(); | 108 | void setLineLengths(); |
110 | void drawText(S32 x, S32 y, const LLColor4& color ); | 109 | void drawText(S32 x, S32 y, const LLColor4& color ); |
111 | 110 | ||
112 | protected: | ||
113 | LLUIString mText; | 111 | LLUIString mText; |
114 | const LLFontGL* mFontGL; | 112 | const LLFontGL* mFontGL; |
115 | LLColor4 mTextColor; | 113 | LLColor4 mTextColor; |