]> icculus.org git repositories - divverent/darkplaces.git/blob - uim_dp.h
Merge branch 'master' into ft2uim
[divverent/darkplaces.git] / uim_dp.h
1 /*
2   This contains parts of the original header and thus contains its copyright notice:
3
4   Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
5
6   All rights reserved.
7
8   Redistribution and use in source and binary forms, with or without
9   modification, are permitted provided that the following conditions
10   are met:
11
12   1. Redistributions of source code must retain the above copyright
13      notice, this list of conditions and the following disclaimer.
14   2. Redistributions in binary form must reproduce the above copyright
15      notice, this list of conditions and the following disclaimer in the
16      documentation and/or other materials provided with the distribution.
17   3. Neither the name of authors nor the names of its contributors
18      may be used to endorse or promote products derived from this software
19      without specific prior written permission.
20
21   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
22   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24   ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
25   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31   SUCH DAMAGE.
32
33 */
34 #ifndef UIM_DP__H__
35 #define UIM_DP_H__
36
37 #include "utf8lib.h"
38
39 typedef enum
40 {
41         uim_false = 0,
42         uim_true = 1
43 } uim_bool;
44
45 typedef struct uim_context_   *uim_context;
46 typedef struct uim_candidate_ *uim_candidate;
47
48 void     UIM_Init(void);
49 void     UIM_Shutdown(void);
50 qboolean UIM_Available(void);
51 qboolean UIM_Direct(void);
52 void     UIM_SetCursor(int pos);
53 qboolean UIM_Key(int key, Uchar unicode);
54 qboolean UIM_KeyUp(int key, Uchar unicode);
55 qboolean UIM_KeyDown(int key, Uchar unicode);
56
57 // exiting functions have a qUIM_ prefix
58 typedef void (*qUIM_SetCursor)(size_t pos);
59
60 qboolean UIM_EnterBuffer(char *buffer, size_t bufsize, size_t pos, qUIM_SetCursor setcursor_cb);
61 void UIM_CancelBuffer(void);
62
63 // from the original uim.h:
64 enum UKey {
65   UKey_0 = 48,
66   UKey_1 = 49,
67   UKey_2 = 50,
68   UKey_3 = 51,
69   UKey_4 = 52,
70   UKey_5 = 53,
71   UKey_6 = 54,
72   UKey_7 = 55,
73   UKey_8 = 56,
74   UKey_9 = 57,
75   UKey_Yen = 165,
76
77   UKey_Escape = 256,
78   UKey_Tab,
79   UKey_Backspace,
80   UKey_Delete,
81   UKey_Insert,
82   UKey_Return,
83   UKey_Left,
84   UKey_Up ,
85   UKey_Right ,
86   UKey_Down ,
87   UKey_Prior , /* page up */
88   UKey_Next , /* page down */
89   UKey_Home,
90   UKey_End,
91
92   UKey_Multi_key, /* multi-key character compose */
93   UKey_Codeinput,
94   UKey_SingleCandidate,
95   UKey_MultipleCandidate,
96   UKey_PreviousCandidate,
97   UKey_Mode_switch, /* charcter set switch */
98
99   /* Japanese keyboard */
100   UKey_Kanji, /* kanji, kanji convert */
101   UKey_Muhenkan, /* cancel conversion */
102   UKey_Henkan_Mode, /* start/stop conversion */
103   UKey_Henkan = UKey_Henkan_Mode, /* alias for Henkan_Mode */
104   UKey_Romaji,
105   UKey_Hiragana,
106   UKey_Katakana,
107   UKey_Hiragana_Katakana, /* hiragana/katakana toggle */
108   UKey_Zenkaku,
109   UKey_Hankaku,
110   UKey_Zenkaku_Hankaku, /* zenkaku/hankaku toggle */
111   UKey_Touroku,
112   UKey_Massyo,
113   UKey_Kana_Lock,
114   UKey_Kana_Shift,
115   UKey_Eisu_Shift, /* alphanumeric shift */
116   UKey_Eisu_toggle, /* alphanumeric toggle */
117
118   /* Korean keyboard */
119   UKey_Hangul,
120   UKey_Hangul_Start,
121   UKey_Hangul_End,
122   UKey_Hangul_Hanja,
123   UKey_Hangul_Jamo,
124   UKey_Hangul_Romaja,
125   UKey_Hangul_Codeinput,
126   UKey_Hangul_Jeonja,
127   UKey_Hangul_Banja,
128   UKey_Hangul_PreHanja,
129   UKey_Hangul_PostHanja,
130   UKey_Hangul_SingleCandidate,
131   UKey_Hangul_MultipleCandidate,
132   UKey_Hangul_PreviousCandidate,
133   UKey_Hangul_Special,
134
135   /* function keys */
136   UKey_F1,
137   UKey_F2,
138   UKey_F3,
139   UKey_F4,
140   UKey_F5,
141   UKey_F6,
142   UKey_F7,
143   UKey_F8,
144   UKey_F9,
145   UKey_F10,
146   UKey_F11,
147   UKey_F12,
148   UKey_F13,
149   UKey_F14,
150   UKey_F15,
151   UKey_F16,
152   UKey_F17,
153   UKey_F18,
154   UKey_F19,
155   UKey_F20,
156   UKey_F21,
157   UKey_F22,
158   UKey_F23,
159   UKey_F24,
160   UKey_F25,
161   UKey_F26,
162   UKey_F27,
163   UKey_F28,
164   UKey_F29,
165   UKey_F30,
166   UKey_F31,
167   UKey_F32,
168   UKey_F33,
169   UKey_F34,
170   UKey_F35, /* X, Gtk and Qt supports up to F35 */
171
172   /* dead keys */
173   UKey_Dead_Grave,
174   UKey_Dead_Acute,
175   UKey_Dead_Circumflex,
176   UKey_Dead_Tilde,
177   UKey_Dead_Macron,
178   UKey_Dead_Breve,
179   UKey_Dead_Abovedot,
180   UKey_Dead_Diaeresis,
181   UKey_Dead_Abovering,
182   UKey_Dead_Doubleacute,
183   UKey_Dead_Caron,
184   UKey_Dead_Cedilla,
185   UKey_Dead_Ogonek,
186   UKey_Dead_Iota,
187   UKey_Dead_VoicedSound,
188   UKey_Dead_SemivoicedSound,
189   UKey_Dead_Belowdot,
190   UKey_Dead_Hook,
191   UKey_Dead_Horn,
192
193   /* Japanese Kana keys */
194   UKey_Kana_Fullstop,
195   UKey_Kana_OpeningBracket,
196   UKey_Kana_ClosingBracket,
197   UKey_Kana_Comma,
198   UKey_Kana_Conjunctive,
199   UKey_Kana_WO,
200   UKey_Kana_a,
201   UKey_Kana_i,
202   UKey_Kana_u,
203   UKey_Kana_e,
204   UKey_Kana_o,
205   UKey_Kana_ya,
206   UKey_Kana_yu,
207   UKey_Kana_yo,
208   UKey_Kana_tsu,
209   UKey_Kana_ProlongedSound,
210   UKey_Kana_A,
211   UKey_Kana_I,
212   UKey_Kana_U,
213   UKey_Kana_E,
214   UKey_Kana_O,
215   UKey_Kana_KA,
216   UKey_Kana_KI,
217   UKey_Kana_KU,
218   UKey_Kana_KE,
219   UKey_Kana_KO,
220   UKey_Kana_SA,
221   UKey_Kana_SHI,
222   UKey_Kana_SU,
223   UKey_Kana_SE,
224   UKey_Kana_SO,
225   UKey_Kana_TA,
226   UKey_Kana_CHI,
227   UKey_Kana_TSU,
228   UKey_Kana_TE,
229   UKey_Kana_TO,
230   UKey_Kana_NA,
231   UKey_Kana_NI,
232   UKey_Kana_NU,
233   UKey_Kana_NE,
234   UKey_Kana_NO,
235   UKey_Kana_HA,
236   UKey_Kana_HI,
237   UKey_Kana_FU,
238   UKey_Kana_HE,
239   UKey_Kana_HO,
240   UKey_Kana_MA,
241   UKey_Kana_MI,
242   UKey_Kana_MU,
243   UKey_Kana_ME,
244   UKey_Kana_MO,
245   UKey_Kana_YA,
246   UKey_Kana_YU,
247   UKey_Kana_YO,
248   UKey_Kana_RA,
249   UKey_Kana_RI,
250   UKey_Kana_RU,
251   UKey_Kana_RE,
252   UKey_Kana_RO,
253   UKey_Kana_WA,
254   UKey_Kana_N,
255   UKey_Kana_VoicedSound,
256   UKey_Kana_SemivoicedSound,
257
258   /* non-standard platform specific keys (e.g. Zaurus PDA) */
259   UKey_Private1,
260   UKey_Private2,
261   UKey_Private3,
262   UKey_Private4,
263   UKey_Private5,
264   UKey_Private6,
265   UKey_Private7,
266   UKey_Private8,
267   UKey_Private9,
268   UKey_Private10,
269   UKey_Private11,
270   UKey_Private12,
271   UKey_Private13,
272   UKey_Private14,
273   UKey_Private15,
274   UKey_Private16,
275   UKey_Private17,
276   UKey_Private18,
277   UKey_Private19,
278   UKey_Private20,
279   UKey_Private21,
280   UKey_Private22,
281   UKey_Private23,
282   UKey_Private24,
283   UKey_Private25,
284   UKey_Private26,
285   UKey_Private27,
286   UKey_Private28,
287   UKey_Private29,
288   UKey_Private30,
289
290   /* modifier keys */
291   UKey_Shift = 0x8000,
292   UKey_Control,
293   UKey_Alt,
294   UKey_Meta,
295   UKey_Super,
296   UKey_Hyper,
297
298   /* lock modifier keys: unstable */
299   UKey_Caps_Lock = 0x9000,
300   UKey_Num_Lock,
301   UKey_Scroll_Lock,
302
303   UKey_Other = 0x10000
304 };
305
306 enum UKeyModifier {
307   UMod_Shift = 1,
308   UMod_Control = 2,
309   UMod_Alt = 4,
310   UMod_Meta = 8,
311   UMod_Pseudo0 = 16,
312   UMod_Pseudo1 = 32,
313   UMod_Super = 64,
314   UMod_Hyper = 128
315 };
316
317 enum UPreeditAttr {
318   UPreeditAttr_None = 0,
319   UPreeditAttr_UnderLine = 1,
320   UPreeditAttr_Reverse = 2,
321   UPreeditAttr_Cursor = 4,
322   UPreeditAttr_Separator = 8
323 };
324
325 /* Cursor of clipboard text is always positioned at end. */
326 enum UTextArea {
327   UTextArea_Unspecified = 0,
328   UTextArea_Primary     = 1,  /* primary text area which IM commits to */
329   UTextArea_Selection   = 2,  /* user-selected region of primary text area */
330   UTextArea_Clipboard   = 4   /* clipboard text */
331 };
332
333 enum UTextOrigin {
334   UTextOrigin_Unspecified = 0,
335   UTextOrigin_Cursor      = 1,  /* current position of the cursor */
336   UTextOrigin_Beginning   = 2,  /* beginning of the text */
337   UTextOrigin_End         = 3   /* end of the text */
338 };
339
340 enum UTextExtent {
341   UTextExtent_Unspecified = -1,  /* invalid */
342
343   /* logical extents */
344   UTextExtent_Full      = -2,   /* beginning or end of the whole text */
345   UTextExtent_Paragraph = -3,   /* the paragraph which the origin is included */
346   UTextExtent_Sentence  = -5,   /* the sentence which the origin is included */
347   UTextExtent_Word      = -9,   /* the word which the origin is included */
348   UTextExtent_CharFrags = -17,  /* character fragments around the origin */
349
350   /* physical extents */
351   UTextExtent_DispRect  = -33,  /* the text region displayed in the widget */
352   UTextExtent_DispLine  = -65,  /* displayed line (eol: linebreak) */
353   UTextExtent_Line      = -129  /* real line      (eol: newline char) */
354 };
355
356 #endif // UIM_DPH_H__