From ae623c8068145f968f09ccf9bbdd90e993ca4283 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 16 Sep 2010 09:38:05 -0700 Subject: 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 --- indra/llui/lllineeditor.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/llui/lllineeditor.h') 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 keystroke_callback_t; + struct MaxLength : public LLInitParam::Choice + { + Alternative bytes, chars; + + MaxLength() : bytes("max_length_bytes", 254), + chars("max_length_chars", 0) + {} + }; + struct Params : public LLInitParam::Block { Optional default_text; - Optional max_length_bytes; - + Optional max_length; Optional keystroke_callback; Optional 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; -- cgit v1.2.3