aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llwindow/llpreeditor.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llwindow/llpreeditor.h')
-rw-r--r--linden/indra/llwindow/llpreeditor.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/linden/indra/llwindow/llpreeditor.h b/linden/indra/llwindow/llpreeditor.h
new file mode 100644
index 0000000..f66a390
--- /dev/null
+++ b/linden/indra/llwindow/llpreeditor.h
@@ -0,0 +1,106 @@
1/**
2 * @file llpreeditor.h
3 * @brief I believe this is used for languages like Japanese that require
4 * an "input method editor" to type Kanji.
5 * @author Open source patch, incorporated by Dave Simmons
6 *
7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 *
9 * Copyright (c) 2007-2008, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#ifndef LL_PREEDITOR
35#define LL_PREEDITOR
36
37class LLPreeditor
38{
39public:
40
41 typedef std::vector<S32> segment_lengths_t;
42 typedef std::vector<BOOL> standouts_t;
43
44 // We don't delete against LLPreeditor, but compilers complain without this...
45
46 virtual ~LLPreeditor() {};
47
48 // Discard any preedit info. on this preeditor.
49
50 virtual void resetPreedit() = 0;
51
52 // Update the preedit feedback using specified details.
53 // Existing preedit is discarded and replaced with the new one. (I.e., updatePreedit is not cumulative.)
54 // All arguments are IN.
55 // preedit_count is the number of elements in arrays preedit_list and preedit_standouts.
56 // preedit list is an array of preedit texts (clauses.)
57 // preedit_standouts indicates whether each preedit text should be shown as standout clause.
58 // caret_position is the preedit-local position of text editing caret, in # of llwchar.
59
60 virtual void updatePreedit(const LLWString &preedit_string,
61 const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) = 0;
62
63 // Turn the specified sub-contents into an active preedit.
64 // Both position and length are IN and count with UTF-32 (llwchar) characters.
65 // This method primarily facilitates reconversion.
66
67 virtual void markAsPreedit(S32 position, S32 length) = 0;
68
69 // Get the position and the length of the active preedit in the contents.
70 // Both position and length are OUT and count with UTF-32 (llwchar) characters.
71 // When this preeditor has no active preedit, position receives
72 // the caret position, and length receives 0.
73
74 virtual void getPreeditRange(S32 *position, S32 *length) const = 0;
75
76 // Get the position and the length of the current selection in the contents.
77 // Both position and length are OUT and count with UTF-32 (llwchar) characters.
78 // When this preeditor has no selection, position receives
79 // the caret position, and length receives 0.
80
81 virtual void getSelectionRange(S32 *position, S32 *length) const = 0;
82
83 // Get the locations where the preedit and related UI elements are displayed.
84 // Locations are relative to the app window and measured in GL coordinate space (before scaling.)
85 // query_position is IN argument, and other three are OUT.
86
87 virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0;
88
89 // Get the size (height) of the current font used in this preeditor.
90
91 virtual S32 getPreeditFontSize() const = 0;
92
93 // Get the contents of this preeditor as a LLWString. If there is an active preedit,
94 // the returned LLWString contains it.
95
96 virtual const LLWString & getWText() const = 0;
97
98 // Handle a UTF-32 char on this preeditor, i.e., add the character
99 // to the contents.
100 // This is a back door of the method of same name of LLWindowCallback.
101 // called_from_parent should be set to FALSE if calling through LLPreeditor.
102
103 virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) = 0;
104};
105
106#endif