diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-09-16 09:38:05 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-09-16 09:38:05 -0700 |
commit | ae623c8068145f968f09ccf9bbdd90e993ca4283 (patch) | |
tree | 29cffd02ee00b447c07e4cd40a2e0fa9b8cc30a3 /indra/llui/lllineeditor.h | |
parent | e27ac0abf7bef6e61c2d81911cc0c693206ee401 (diff) |
Set display name field now clamps to 31 unicode characters
Added ability to set max length in line editors by characters in addition to bytes
left other widgets (comboboxes/spinners) using the bytes, but it can easily be changed over
reviewed by Richard
Diffstat (limited to 'indra/llui/lllineeditor.h')
-rw-r--r-- | indra/llui/lllineeditor.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 76d0187712..b988bc412e 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -59,11 +59,19 @@ public: typedef boost::function<void (LLLineEditor* caller)> keystroke_callback_t; + struct MaxLength : public LLInitParam::Choice<MaxLength>
+ {
+ Alternative<S32> bytes, chars;
+
+ MaxLength() : bytes("max_length_bytes", 254),
+ chars("max_length_chars", 0)
+ {}
+ }; + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { Optional<std::string> default_text; - Optional<S32> max_length_bytes; - + Optional<MaxLength> max_length; Optional<keystroke_callback_t> keystroke_callback; Optional<LLTextValidate::validate_func_t, LLTextValidate::ValidateTextNamedFuncs> prevalidate_callback; @@ -214,6 +222,7 @@ public: void setKeystrokeCallback(callback_t callback, void* user_data); void setMaxTextLength(S32 max_text_length); + void setMaxTextChars(S32 max_text_chars); // Manipulate left and right padding for text void getTextPadding(S32 *left, S32 *right); void setTextPadding(S32 left, S32 right); @@ -277,6 +286,7 @@ protected: LLViewBorder* mBorder; const LLFontGL* mGLFont; S32 mMaxLengthBytes; // Max length of the UTF8 string in bytes + S32 mMaxLengthChars; // Maximum number of characters in the string S32 mCursorPos; // I-beam is just after the mCursorPos-th character. S32 mScrollHPos; // Horizontal offset from the start of mText. Used for scrolling. LLFrameTimer mScrollTimer; |