2
2
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
4
* Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
6
6
* The contents of this file are subject to the terms of either the GNU Lesser
7
7
* General Public License Version 2.1 only ("LGPL") or the Common Development and
8
8
* Distribution License ("CDDL")(collectively, the "License"). You may not use this
9
9
* file except in compliance with the License. You can obtain a copy of the CDDL at
10
10
* http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
11
* http://www.opensource.org/licenses/lgpl-license.php. See the License for the
11
* http://www.opensource.org/licenses/lgpl-license.php. See the License for the
12
12
* specific language governing permissions and limitations under the License. When
13
13
* distributing the software, include this License Header Notice in each file and
14
14
* include the full text of the License in the License file as well as the
15
15
* following notice:
17
17
* NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
19
19
* For Covered Software in this distribution, this License shall be governed by the
21
21
* Any litigation relating to this License shall be subject to the jurisdiction of
22
22
* the Federal Courts of the Northern District of California and the state courts
23
23
* of the State of California, with venue lying in Santa Clara County, California.
27
27
* If you wish your version of this file to be governed by only the CDDL or only
28
28
* the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
29
29
* include this software in this distribution under the [CDDL or LGPL Version 2.1]
32
32
* Version 2.1, or to extend the choice of license to its licensees as provided
33
33
* above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
34
34
* Version 2 license, then the option applies only if the new code is made subject
35
* to such option by the copyright holder.
35
* to such option by the copyright holder.
38
38
#ifndef SUNPINYIN_UI_OBJECTS_H
72
73
typedef std::vector<int> CCharTypeVec;
76
~IPreeditString() = 0;
76
virtual ~IPreeditString() = 0;
79
79
/** Following functions are used for CIMIWinHandler to retrieve Preedit data. */
80
virtual int size() const = 0;
81
virtual const TWCHAR* string() const = 0;
82
virtual int charTypeSize() const = 0;
83
virtual int charTypeAt(int idx) const = 0;
84
virtual int caret() const = 0;
85
virtual int candi_start() const = 0;
80
virtual int size() const = 0;
81
virtual const TWCHAR* string() const = 0;
82
virtual int charTypeSize() const = 0;
83
virtual int charTypeAt(int idx) const = 0;
84
virtual int caret() const = 0;
85
virtual int candi_start() const = 0;
91
* Following functions are used for CIMIView to set Preedit data, should not
92
* be used by CIMIWinHandler.
94
virtual void clear() = 0;
95
virtual wstring& getString() = 0;
96
virtual CCharTypeVec& getCharTypeVec() = 0;
91
* Following functions are used for CIMIView to set Preedit data, should not
92
* be used by CIMIWinHandler.
94
virtual void clear() = 0;
95
virtual wstring& getString() = 0;
96
virtual CCharTypeVec& getCharTypeVec() = 0;
97
97
virtual void setCaret(int caret) = 0;
98
virtual void setCandiStart(int s)= 0;
98
virtual void setCandiStart(int s) = 0;
141
140
USER_SELECTED_WORD,
146
typedef IPreeditString::CCharTypeVec CCharTypeVec;
146
typedef IPreeditString::CCharTypeVec CCharTypeVec;
147
147
typedef std::vector< CCharTypeVec > CCharTypeVecs;
148
148
typedef std::vector< wstring > CCandiStrings;
149
149
typedef std::vector<int> CCandiTypeVec;
153
~ICandidateList() = 0;
152
virtual ~ICandidateList() = 0;
156
155
/** Following functions are used for CIMIWinHandler to retrieve Candidate data. */
157
virtual int size() const = 0;
158
virtual int total() const = 0;
159
virtual int first() const = 0;
161
virtual int candiType(unsigned int item) const = 0;
162
virtual int candiSize(unsigned int item) const = 0;
163
virtual const TWCHAR* candiString(unsigned int item) const = 0;
165
virtual int candiCharTypeSizeAt(unsigned int item) const = 0;
166
virtual int candiCharTypeAt(unsigned int item, unsigned int idx) const = 0;
156
virtual int size() const = 0;
157
virtual int total() const = 0;
158
virtual int first() const = 0;
160
virtual int candiType(unsigned int item) const = 0;
161
virtual int candiSize(unsigned int item) const = 0;
162
virtual const TWCHAR* candiString(unsigned int item) const = 0;
164
virtual int candiCharTypeSizeAt(unsigned int item) const =
166
virtual int candiCharTypeAt(unsigned int item,
167
unsigned int idx) const = 0;
172
* Following functions are used for CIMIView to set Candidate List data, should not
173
* be used by CIMIWinHandler.
175
virtual void clear() = 0;
176
virtual void setTotal(int total) = 0;
177
virtual void setFirst(int first) = 0;
179
virtual void reserve(int count) = 0;
180
virtual CCandiStrings & getCandiStrings() = 0;
181
virtual CCandiTypeVec & getCandiTypeVec() = 0;
182
virtual CCharTypeVecs & getCharTypeVecs() = 0;
173
* Following functions are used for CIMIView to set Candidate List data, should not
174
* be used by CIMIWinHandler.
176
virtual void clear() = 0;
177
virtual void setTotal(int total) = 0;
178
virtual void setFirst(int first) = 0;
179
virtual void setSize(int count) = 0;
181
virtual void shrinkList() = 0;
182
virtual void pushBackCandidate(wstring wstr, int type,
183
int userIdx = -1) = 0;
184
virtual void insertCandidate(wstring wstr, int type, int rank,
185
int userIdx = -1) = 0;
186
virtual void insertCandidateNoDedup(wstring wstr, int type, int rank,
187
int userIdx = -1) = 0;
189
virtual CCandiStrings & getCandiStrings() = 0;
190
virtual CCandiTypeVec & getCandiTypeVec() = 0;
191
virtual CCharTypeVecs & getCharTypeVecs() = 0;
200
208
virtual const TWCHAR* candiString(unsigned int item) const;
202
210
virtual int candiCharTypeSizeAt(unsigned int item) const;
203
virtual int candiCharTypeAt(unsigned int item, unsigned int idx) const;
211
virtual int candiCharTypeAt(unsigned int item,
212
unsigned int idx) const;
207
216
virtual void clear();
208
217
virtual void setTotal(int total);
209
218
virtual void setFirst(int first);
210
virtual void reserve(int count);
219
virtual void setSize(int size);
221
virtual void shrinkList();
222
virtual void pushBackCandidate(wstring wstr, int type, int userIdx = -1);
223
virtual void insertCandidate(wstring wstr, int type, int rank,
225
virtual void insertCandidateNoDedup(wstring wstr, int type, int rank,
211
228
virtual CCandiStrings & getCandiStrings();
212
229
virtual CCandiTypeVec & getCandiTypeVec();
213
230
virtual CCharTypeVecs & getCharTypeVecs();
233
int getUserIndex(int idx) { return m_candiUserIndex[idx]; }
219
CCandiStrings m_candiStrings;
220
CCandiTypeVec m_candiTypes;
221
CCharTypeVecs m_candiCharTypeVecs;
239
CCandiStrings m_candiStrings;
240
CCandiTypeVec m_candiTypes;
241
std::vector<int> m_candiUserIndex;
242
CCharTypeVecs m_candiCharTypeVecs;
244
std::map<wstring, int> m_candiStringsIndex;