]> icculus.org git repositories - divverent/darkplaces.git/blob - uim_dp.h
starting with the api implementation
[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 qboolean UIM_Available(void);
50 qboolean UIM_Direct(void);
51 void UIM_Key(int key, Uchar unicode);
52 void UIM_KeyUp(int key, Uchar unicode);
53 void UIM_KeyDown(int key, Uchar unicode);
54
55 // exiting functions have a qUIM_ prefix
56 typedef void (*qUIM_SetCursor)(int pos);
57
58 void UIM_EnterBuffer(char *buffer, size_t bufsize, int pos, qUIM_SetCursor setcursor_cb);
59 void UIM_CancelBuffer(void);
60
61 // from the original uim.h:
62 enum UKey {
63   UKey_0 = 48,
64   UKey_1 = 49,
65   UKey_2 = 50,
66   UKey_3 = 51,
67   UKey_4 = 52,
68   UKey_5 = 53,
69   UKey_6 = 54,
70   UKey_7 = 55,
71   UKey_8 = 56,
72   UKey_9 = 57,
73   UKey_Yen = 165,
74
75   UKey_Escape = 256,
76   UKey_Tab,
77   UKey_Backspace,
78   UKey_Delete,
79   UKey_Insert,
80   UKey_Return,
81   UKey_Left,
82   UKey_Up ,
83   UKey_Right ,
84   UKey_Down ,
85   UKey_Prior , /* page up */
86   UKey_Next , /* page down */
87   UKey_Home,
88   UKey_End,
89
90   UKey_Multi_key, /* multi-key character compose */
91   UKey_Codeinput,
92   UKey_SingleCandidate,
93   UKey_MultipleCandidate,
94   UKey_PreviousCandidate,
95   UKey_Mode_switch, /* charcter set switch */
96
97   /* Japanese keyboard */
98   UKey_Kanji, /* kanji, kanji convert */
99   UKey_Muhenkan, /* cancel conversion */
100   UKey_Henkan_Mode, /* start/stop conversion */
101   UKey_Henkan = UKey_Henkan_Mode, /* alias for Henkan_Mode */
102   UKey_Romaji,
103   UKey_Hiragana,
104   UKey_Katakana,
105   UKey_Hiragana_Katakana, /* hiragana/katakana toggle */
106   UKey_Zenkaku,
107   UKey_Hankaku,
108   UKey_Zenkaku_Hankaku, /* zenkaku/hankaku toggle */
109   UKey_Touroku,
110   UKey_Massyo,
111   UKey_Kana_Lock,
112   UKey_Kana_Shift,
113   UKey_Eisu_Shift, /* alphanumeric shift */
114   UKey_Eisu_toggle, /* alphanumeric toggle */
115
116   /* Korean keyboard */
117   UKey_Hangul,
118   UKey_Hangul_Start,
119   UKey_Hangul_End,
120   UKey_Hangul_Hanja,
121   UKey_Hangul_Jamo,
122   UKey_Hangul_Romaja,
123   UKey_Hangul_Codeinput,
124   UKey_Hangul_Jeonja,
125   UKey_Hangul_Banja,
126   UKey_Hangul_PreHanja,
127   UKey_Hangul_PostHanja,
128   UKey_Hangul_SingleCandidate,
129   UKey_Hangul_MultipleCandidate,
130   UKey_Hangul_PreviousCandidate,
131   UKey_Hangul_Special,
132
133   /* function keys */
134   UKey_F1,
135   UKey_F2,
136   UKey_F3,
137   UKey_F4,
138   UKey_F5,
139   UKey_F6,
140   UKey_F7,
141   UKey_F8,
142   UKey_F9,
143   UKey_F10,
144   UKey_F11,
145   UKey_F12,
146   UKey_F13,
147   UKey_F14,
148   UKey_F15,
149   UKey_F16,
150   UKey_F17,
151   UKey_F18,
152   UKey_F19,
153   UKey_F20,
154   UKey_F21,
155   UKey_F22,
156   UKey_F23,
157   UKey_F24,
158   UKey_F25,
159   UKey_F26,
160   UKey_F27,
161   UKey_F28,
162   UKey_F29,
163   UKey_F30,
164   UKey_F31,
165   UKey_F32,
166   UKey_F33,
167   UKey_F34,
168   UKey_F35, /* X, Gtk and Qt supports up to F35 */
169
170   /* dead keys */
171   UKey_Dead_Grave,
172   UKey_Dead_Acute,
173   UKey_Dead_Circumflex,
174   UKey_Dead_Tilde,
175   UKey_Dead_Macron,
176   UKey_Dead_Breve,
177   UKey_Dead_Abovedot,
178   UKey_Dead_Diaeresis,
179   UKey_Dead_Abovering,
180   UKey_Dead_Doubleacute,
181   UKey_Dead_Caron,
182   UKey_Dead_Cedilla,
183   UKey_Dead_Ogonek,
184   UKey_Dead_Iota,
185   UKey_Dead_VoicedSound,
186   UKey_Dead_SemivoicedSound,
187   UKey_Dead_Belowdot,
188   UKey_Dead_Hook,
189   UKey_Dead_Horn,
190
191   /* Japanese Kana keys */
192   UKey_Kana_Fullstop,
193   UKey_Kana_OpeningBracket,
194   UKey_Kana_ClosingBracket,
195   UKey_Kana_Comma,
196   UKey_Kana_Conjunctive,
197   UKey_Kana_WO,
198   UKey_Kana_a,
199   UKey_Kana_i,
200   UKey_Kana_u,
201   UKey_Kana_e,
202   UKey_Kana_o,
203   UKey_Kana_ya,
204   UKey_Kana_yu,
205   UKey_Kana_yo,
206   UKey_Kana_tsu,
207   UKey_Kana_ProlongedSound,
208   UKey_Kana_A,
209   UKey_Kana_I,
210   UKey_Kana_U,
211   UKey_Kana_E,
212   UKey_Kana_O,
213   UKey_Kana_KA,
214   UKey_Kana_KI,
215   UKey_Kana_KU,
216   UKey_Kana_KE,
217   UKey_Kana_KO,
218   UKey_Kana_SA,
219   UKey_Kana_SHI,
220   UKey_Kana_SU,
221   UKey_Kana_SE,
222   UKey_Kana_SO,
223   UKey_Kana_TA,
224   UKey_Kana_CHI,
225   UKey_Kana_TSU,
226   UKey_Kana_TE,
227   UKey_Kana_TO,
228   UKey_Kana_NA,
229   UKey_Kana_NI,
230   UKey_Kana_NU,
231   UKey_Kana_NE,
232   UKey_Kana_NO,
233   UKey_Kana_HA,
234   UKey_Kana_HI,
235   UKey_Kana_FU,
236   UKey_Kana_HE,
237   UKey_Kana_HO,
238   UKey_Kana_MA,
239   UKey_Kana_MI,
240   UKey_Kana_MU,
241   UKey_Kana_ME,
242   UKey_Kana_MO,
243   UKey_Kana_YA,
244   UKey_Kana_YU,
245   UKey_Kana_YO,
246   UKey_Kana_RA,
247   UKey_Kana_RI,
248   UKey_Kana_RU,
249   UKey_Kana_RE,
250   UKey_Kana_RO,
251   UKey_Kana_WA,
252   UKey_Kana_N,
253   UKey_Kana_VoicedSound,
254   UKey_Kana_SemivoicedSound,
255
256   /* non-standard platform specific keys (e.g. Zaurus PDA) */
257   UKey_Private1,
258   UKey_Private2,
259   UKey_Private3,
260   UKey_Private4,
261   UKey_Private5,
262   UKey_Private6,
263   UKey_Private7,
264   UKey_Private8,
265   UKey_Private9,
266   UKey_Private10,
267   UKey_Private11,
268   UKey_Private12,
269   UKey_Private13,
270   UKey_Private14,
271   UKey_Private15,
272   UKey_Private16,
273   UKey_Private17,
274   UKey_Private18,
275   UKey_Private19,
276   UKey_Private20,
277   UKey_Private21,
278   UKey_Private22,
279   UKey_Private23,
280   UKey_Private24,
281   UKey_Private25,
282   UKey_Private26,
283   UKey_Private27,
284   UKey_Private28,
285   UKey_Private29,
286   UKey_Private30,
287
288   /* modifier keys */
289   UKey_Shift = 0x8000,
290   UKey_Control,
291   UKey_Alt,
292   UKey_Meta,
293   UKey_Super,
294   UKey_Hyper,
295
296   /* lock modifier keys: unstable */
297   UKey_Caps_Lock = 0x9000,
298   UKey_Num_Lock,
299   UKey_Scroll_Lock,
300
301   UKey_Other = 0x10000
302 };
303
304 enum UKeyModifier {
305   UMod_Shift = 1,
306   UMod_Control = 2,
307   UMod_Alt = 4,
308   UMod_Meta = 8,
309   UMod_Pseudo0 = 16,
310   UMod_Pseudo1 = 32,
311   UMod_Super = 64,
312   UMod_Hyper = 128
313 };
314
315 enum UPreeditAttr {
316   UPreeditAttr_None = 0,
317   UPreeditAttr_UnderLine = 1,
318   UPreeditAttr_Reverse = 2,
319   UPreeditAttr_Cursor = 4,
320   UPreeditAttr_Separator = 8
321 };
322
323 /* Cursor of clipboard text is always positioned at end. */
324 enum UTextArea {
325   UTextArea_Unspecified = 0,
326   UTextArea_Primary     = 1,  /* primary text area which IM commits to */
327   UTextArea_Selection   = 2,  /* user-selected region of primary text area */
328   UTextArea_Clipboard   = 4   /* clipboard text */
329 };
330
331 enum UTextOrigin {
332   UTextOrigin_Unspecified = 0,
333   UTextOrigin_Cursor      = 1,  /* current position of the cursor */
334   UTextOrigin_Beginning   = 2,  /* beginning of the text */
335   UTextOrigin_End         = 3   /* end of the text */
336 };
337
338 enum UTextExtent {
339   UTextExtent_Unspecified = -1,  /* invalid */
340
341   /* logical extents */
342   UTextExtent_Full      = -2,   /* beginning or end of the whole text */
343   UTextExtent_Paragraph = -3,   /* the paragraph which the origin is included */
344   UTextExtent_Sentence  = -5,   /* the sentence which the origin is included */
345   UTextExtent_Word      = -9,   /* the word which the origin is included */
346   UTextExtent_CharFrags = -17,  /* character fragments around the origin */
347
348   /* physical extents */
349   UTextExtent_DispRect  = -33,  /* the text region displayed in the widget */
350   UTextExtent_DispLine  = -65,  /* displayed line (eol: linebreak) */
351   UTextExtent_Line      = -129  /* real line      (eol: newline char) */
352 };
353
354 #endif // UIM_DPH_H__