diff options
Diffstat (limited to 'linden/indra/llui/lllineeditor.h')
-rw-r--r-- | linden/indra/llui/lllineeditor.h | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index d4ebe3c..6d328e5 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -53,6 +53,8 @@ | |||
53 | #include "lluistring.h" | 53 | #include "lluistring.h" |
54 | #include "llviewborder.h" | 54 | #include "llviewborder.h" |
55 | 55 | ||
56 | #include "llpreeditor.h" | ||
57 | |||
56 | class LLFontGL; | 58 | class LLFontGL; |
57 | class LLLineEditorRollback; | 59 | class LLLineEditorRollback; |
58 | class LLButton; | 60 | class LLButton; |
@@ -63,7 +65,7 @@ typedef BOOL (*LLLinePrevalidateFunc)(const LLWString &wstr); | |||
63 | // Classes | 65 | // Classes |
64 | // | 66 | // |
65 | class LLLineEditor | 67 | class LLLineEditor |
66 | : public LLUICtrl, public LLEditMenuHandler | 68 | : public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor |
67 | { | 69 | { |
68 | friend class LLLineEditorRollback; | 70 | friend class LLLineEditorRollback; |
69 | 71 | ||
@@ -75,7 +77,7 @@ public: | |||
75 | S32 max_length_bytes = 254, | 77 | S32 max_length_bytes = 254, |
76 | void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, | 78 | void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL, |
77 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, | 79 | void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL, |
78 | void (*focus_lost_callback)(LLUICtrl* caller, void* user_data) = NULL, | 80 | void (*focus_lost_callback)(LLFocusableElement* caller, void* user_data) = NULL, |
79 | void* userdata = NULL, | 81 | void* userdata = NULL, |
80 | LLLinePrevalidateFunc prevalidate_func = NULL, | 82 | LLLinePrevalidateFunc prevalidate_func = NULL, |
81 | LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, | 83 | LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN, |
@@ -120,6 +122,7 @@ public: | |||
120 | // view overrides | 122 | // view overrides |
121 | virtual void draw(); | 123 | virtual void draw(); |
122 | virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE); | 124 | virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE); |
125 | virtual void onFocusReceived(); | ||
123 | virtual void onFocusLost(); | 126 | virtual void onFocusLost(); |
124 | virtual void setEnabled(BOOL enabled); | 127 | virtual void setEnabled(BOOL enabled); |
125 | 128 | ||
@@ -146,7 +149,7 @@ public: | |||
146 | const LLWString& getWText() const { return mText.getWString(); } | 149 | const LLWString& getWText() const { return mText.getWString(); } |
147 | S32 getLength() const { return mText.length(); } | 150 | S32 getLength() const { return mText.length(); } |
148 | 151 | ||
149 | S32 getCursor() { return mCursorPos; } | 152 | S32 getCursor() const { return mCursorPos; } |
150 | void setCursor( S32 pos ); | 153 | void setCursor( S32 pos ); |
151 | void setCursorToEnd(); | 154 | void setCursorToEnd(); |
152 | 155 | ||
@@ -177,13 +180,13 @@ public: | |||
177 | void setIgnoreTab(BOOL b) { mIgnoreTab = b; } | 180 | void setIgnoreTab(BOOL b) { mIgnoreTab = b; } |
178 | void setPassDelete(BOOL b) { mPassDelete = b; } | 181 | void setPassDelete(BOOL b) { mPassDelete = b; } |
179 | 182 | ||
180 | void setDrawAsterixes(BOOL b) { mDrawAsterixes = b; } | 183 | void setDrawAsterixes(BOOL b); |
181 | 184 | ||
182 | // get the cursor position of the beginning/end of the prev/next word in the text | 185 | // get the cursor position of the beginning/end of the prev/next word in the text |
183 | S32 prevWordPos(S32 cursorPos) const; | 186 | S32 prevWordPos(S32 cursorPos) const; |
184 | S32 nextWordPos(S32 cursorPos) const; | 187 | S32 nextWordPos(S32 cursorPos) const; |
185 | 188 | ||
186 | BOOL hasSelection() { return (mSelectionStart != mSelectionEnd); } | 189 | BOOL hasSelection() const { return (mSelectionStart != mSelectionEnd); } |
187 | void startSelection(); | 190 | void startSelection(); |
188 | void endSelection(); | 191 | void endSelection(); |
189 | void extendSelection(S32 new_cursor_pos); | 192 | void extendSelection(S32 new_cursor_pos); |
@@ -199,7 +202,7 @@ public: | |||
199 | 202 | ||
200 | static BOOL isPartOfWord(llwchar c); | 203 | static BOOL isPartOfWord(llwchar c); |
201 | // Prevalidation controls which keystrokes can affect the editor | 204 | // Prevalidation controls which keystrokes can affect the editor |
202 | void setPrevalidate( BOOL (*func)(const LLWString &) ) { mPrevalidateFunc = func; } | 205 | void setPrevalidate( BOOL (*func)(const LLWString &) ); |
203 | static BOOL prevalidateFloat(const LLWString &str ); | 206 | static BOOL prevalidateFloat(const LLWString &str ); |
204 | static BOOL prevalidateInt(const LLWString &str ); | 207 | static BOOL prevalidateInt(const LLWString &str ); |
205 | static BOOL prevalidatePositiveS32(const LLWString &str); | 208 | static BOOL prevalidatePositiveS32(const LLWString &str); |
@@ -221,7 +224,7 @@ protected: | |||
221 | void addChar(const llwchar c); | 224 | void addChar(const llwchar c); |
222 | void setCursorAtLocalPos(S32 local_mouse_x); | 225 | void setCursorAtLocalPos(S32 local_mouse_x); |
223 | 226 | ||
224 | S32 findPixelNearestPos(S32 cursor_offset = 0); | 227 | S32 findPixelNearestPos(S32 cursor_offset = 0) const; |
225 | void reportBadKeystroke(); | 228 | void reportBadKeystroke(); |
226 | 229 | ||
227 | BOOL handleSpecialKey(KEY key, MASK mask); | 230 | BOOL handleSpecialKey(KEY key, MASK mask); |
@@ -230,6 +233,19 @@ protected: | |||
230 | S32 handleCommitKey(KEY key, MASK mask); | 233 | S32 handleCommitKey(KEY key, MASK mask); |
231 | 234 | ||
232 | protected: | 235 | protected: |
236 | void updateAllowingLanguageInput(); | ||
237 | BOOL hasPreeditString() const; | ||
238 | // Implementation (overrides) of LLPreeditor | ||
239 | virtual void resetPreedit(); | ||
240 | virtual void updatePreedit(const LLWString &preedit_string, | ||
241 | const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position); | ||
242 | virtual void markAsPreedit(S32 position, S32 length); | ||
243 | virtual void getPreeditRange(S32 *position, S32 *length) const; | ||
244 | virtual void getSelectionRange(S32 *position, S32 *length) const; | ||
245 | virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; | ||
246 | virtual S32 getPreeditFontSize() const; | ||
247 | |||
248 | protected: | ||
233 | LLUIString mText; // The string being edited. | 249 | LLUIString mText; // The string being edited. |
234 | LLString mPrevText; // Saved string for 'ESC' revert | 250 | LLString mPrevText; // Saved string for 'ESC' revert |
235 | LLUIString mLabel; // text label that is visible when no user text provided | 251 | LLUIString mLabel; // text label that is visible when no user text provided |
@@ -241,8 +257,7 @@ protected: | |||
241 | 257 | ||
242 | LLViewBorder* mBorder; | 258 | LLViewBorder* mBorder; |
243 | const LLFontGL* mGLFont; | 259 | const LLFontGL* mGLFont; |
244 | S32 mMaxLengthChars; // Max number of characters | 260 | S32 mMaxLengthBytes; // Max length of the UTF8 string in bytes |
245 | S32 mMaxLengthBytes; // Max length of the UTF8 string. | ||
246 | S32 mCursorPos; // I-beam is just after the mCursorPos-th character. | 261 | S32 mCursorPos; // I-beam is just after the mCursorPos-th character. |
247 | S32 mScrollHPos; // Horizontal offset from the start of mText. Used for scrolling. | 262 | S32 mScrollHPos; // Horizontal offset from the start of mText. Used for scrolling. |
248 | LLFrameTimer mScrollTimer; | 263 | LLFrameTimer mScrollTimer; |
@@ -288,6 +303,11 @@ protected: | |||
288 | BOOL mPassDelete; | 303 | BOOL mPassDelete; |
289 | 304 | ||
290 | BOOL mReadOnly; | 305 | BOOL mReadOnly; |
306 | |||
307 | LLWString mPreeditWString; | ||
308 | LLWString mPreeditOverwrittenWString; | ||
309 | std::vector<S32> mPreeditPositions; | ||
310 | LLPreeditor::standouts_t mPreeditStandouts; | ||
291 | }; | 311 | }; |
292 | 312 | ||
293 | 313 | ||