11 # ifdef EFL_ECORE_IMF_BUILD
13 # define EAPI __declspec(dllexport)
16 # endif /* ! DLL_EXPORT */
18 # define EAPI __declspec(dllimport)
19 # endif /* ! EFL_ECORE_IMF_BUILD */
23 # define EAPI __attribute__ ((visibility("default")))
36 /* Events sent by the Input Method */
37 typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
38 typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
39 typedef struct _Ecore_IMF_Event_Preedit_Changed Ecore_IMF_Event_Preedit_Changed;
40 typedef struct _Ecore_IMF_Event_Commit Ecore_IMF_Event_Commit;
41 typedef struct _Ecore_IMF_Event_Delete_Surrounding Ecore_IMF_Event_Delete_Surrounding;
43 /* Events to filter */
44 typedef struct _Ecore_IMF_Event_Mouse_Down Ecore_IMF_Event_Mouse_Down;
45 typedef struct _Ecore_IMF_Event_Mouse_Up Ecore_IMF_Event_Mouse_Up;
46 typedef struct _Ecore_IMF_Event_Mouse_In Ecore_IMF_Event_Mouse_In;
47 typedef struct _Ecore_IMF_Event_Mouse_Out Ecore_IMF_Event_Mouse_Out;
48 typedef struct _Ecore_IMF_Event_Mouse_Move Ecore_IMF_Event_Mouse_Move;
49 typedef struct _Ecore_IMF_Event_Mouse_Wheel Ecore_IMF_Event_Mouse_Wheel;
50 typedef struct _Ecore_IMF_Event_Key_Down Ecore_IMF_Event_Key_Down;
51 typedef struct _Ecore_IMF_Event_Key_Up Ecore_IMF_Event_Key_Up;
52 typedef union _Ecore_IMF_Event Ecore_IMF_Event;
54 typedef struct _Ecore_IMF_Context Ecore_IMF_Context; /**< An Input Method Context */
55 typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */
56 typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */
58 /* Preedit attribute info */
59 typedef struct _Ecore_IMF_Preedit_Attr Ecore_IMF_Preedit_Attr;
61 EAPI extern int ECORE_IMF_EVENT_PREEDIT_START;
62 EAPI extern int ECORE_IMF_EVENT_PREEDIT_END;
63 EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED;
64 EAPI extern int ECORE_IMF_EVENT_COMMIT;
65 EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING;
67 typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info);
71 ECORE_IMF_CALLBACK_PREEDIT_START,
72 ECORE_IMF_CALLBACK_PREEDIT_END,
73 ECORE_IMF_CALLBACK_PREEDIT_CHANGED,
74 ECORE_IMF_CALLBACK_COMMIT,
75 ECORE_IMF_CALLBACK_DELETE_SURROUNDING
76 } Ecore_IMF_Callback_Type;
80 ECORE_IMF_EVENT_MOUSE_DOWN,
81 ECORE_IMF_EVENT_MOUSE_UP,
82 ECORE_IMF_EVENT_MOUSE_IN,
83 ECORE_IMF_EVENT_MOUSE_OUT,
84 ECORE_IMF_EVENT_MOUSE_MOVE,
85 ECORE_IMF_EVENT_MOUSE_WHEEL,
86 ECORE_IMF_EVENT_KEY_DOWN,
87 ECORE_IMF_EVENT_KEY_UP
88 } Ecore_IMF_Event_Type;
92 ECORE_IMF_KEYBOARD_MODIFIER_NONE = 0, /**< No active modifiers */
93 ECORE_IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */
94 ECORE_IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */
95 ECORE_IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */
96 ECORE_IMF_KEYBOARD_MODIFIER_WIN = 1 << 3 /**< "Win" (between "Ctrl" and "Alt") is pressed */
97 } Ecore_IMF_Keyboard_Modifiers;
101 ECORE_IMF_KEYBOARD_LOCK_NONE = 0, /**< No locks are active */
102 ECORE_IMF_KEYBOARD_LOCK_NUM = 1 << 0, /**< "Num" lock is active */
103 ECORE_IMF_KEYBOARD_LOCK_CAPS = 1 << 1, /**< "Caps" lock is active */
104 ECORE_IMF_KEYBOARD_LOCK_SCROLL = 1 << 2 /**< "Scroll" lock is active */
105 } Ecore_IMF_Keyboard_Locks;
109 ECORE_IMF_MOUSE_NONE = 0, /**< A single click */
110 ECORE_IMF_MOUSE_DOUBLE_CLICK = 1 << 0, /**< A double click */
111 ECORE_IMF_MOUSE_TRIPLE_CLICK = 1 << 1 /**< A triple click */
112 } Ecore_IMF_Mouse_Flags;
116 ECORE_IMF_INPUT_MODE_ALPHA = 1 << 0,
117 ECORE_IMF_INPUT_MODE_NUMERIC = 1 << 1,
118 ECORE_IMF_INPUT_MODE_SPECIAL = 1 << 2,
119 ECORE_IMF_INPUT_MODE_HEXA = 1 << 3,
120 ECORE_IMF_INPUT_MODE_TELE = 1 << 4,
121 ECORE_IMF_INPUT_MODE_FULL = (ECORE_IMF_INPUT_MODE_ALPHA | ECORE_IMF_INPUT_MODE_NUMERIC | ECORE_IMF_INPUT_MODE_SPECIAL),
122 ECORE_IMF_INPUT_MODE_INVISIBLE = 1 << 29,
123 ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30
124 } Ecore_IMF_Input_Mode;
128 ECORE_IMF_PREEDIT_TYPE_NONE,
129 ECORE_IMF_PREEDIT_TYPE_SUB1,
130 ECORE_IMF_PREEDIT_TYPE_SUB2,
131 ECORE_IMF_PREEDIT_TYPE_SUB3
132 } Ecore_IMF_Preedit_Type;
136 ECORE_IMF_AUTOCAPITAL_TYPE_NONE,
137 ECORE_IMF_AUTOCAPITAL_TYPE_WORD,
138 ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE,
139 ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER
140 } Ecore_IMF_Autocapital_Type;
144 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
145 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */
146 ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */
147 ECORE_IMF_INPUT_PANEL_LAYOUT_URL, /**< URL layout */
148 ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */
149 ECORE_IMF_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
150 ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
151 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
152 ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */
153 ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout @since 1.2 */
154 ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout @since 1.2 */
155 ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */
156 } Ecore_IMF_Input_Panel_Layout;
160 ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */
161 ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */
162 } Ecore_IMF_Input_Panel_Lang;
164 struct _Ecore_IMF_Event_Preedit_Start
166 Ecore_IMF_Context *ctx;
169 struct _Ecore_IMF_Event_Preedit_End
171 Ecore_IMF_Context *ctx;
174 struct _Ecore_IMF_Event_Preedit_Changed
176 Ecore_IMF_Context *ctx;
179 struct _Ecore_IMF_Event_Commit
181 Ecore_IMF_Context *ctx;
185 struct _Ecore_IMF_Event_Delete_Surrounding
187 Ecore_IMF_Context *ctx;
192 struct _Ecore_IMF_Event_Mouse_Down
194 int button; /**< The button which has been pressed */
201 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
202 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
203 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
204 unsigned int timestamp; /**< The timestamp when the event occurred */
207 struct _Ecore_IMF_Event_Mouse_Up
209 int button; /**< The button which has been pressed */
216 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
217 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
218 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
219 unsigned int timestamp; /**< The timestamp when the event occurred */
222 struct _Ecore_IMF_Event_Mouse_In
231 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
232 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
233 unsigned int timestamp; /**< The timestamp when the event occurred */
236 struct _Ecore_IMF_Event_Mouse_Out
245 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
246 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
247 unsigned int timestamp; /**< The timestamp when the event occurred */
250 struct _Ecore_IMF_Event_Mouse_Move
261 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
262 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
263 unsigned int timestamp; /**< The timestamp when the event occurred */
266 struct _Ecore_IMF_Event_Mouse_Wheel
268 int direction; /* 0 = default up/down wheel */
269 int z; /* ...,-2,-1 = down, 1,2,... = up */
276 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
277 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
278 unsigned int timestamp; /**< The timestamp when the event occurred */
281 struct _Ecore_IMF_Event_Key_Down
283 const char *keyname; /**< The string name of the key pressed */
284 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
285 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
286 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
287 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
288 const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */
289 unsigned int timestamp; /**< The timestamp when the event occurred */
292 struct _Ecore_IMF_Event_Key_Up
294 const char *keyname; /**< The string name of the key pressed */
295 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
296 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
297 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
298 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
299 const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */
300 unsigned int timestamp; /**< The timestamp when the event occurred */
303 union _Ecore_IMF_Event
305 Ecore_IMF_Event_Mouse_Down mouse_down;
306 Ecore_IMF_Event_Mouse_Up mouse_up;
307 Ecore_IMF_Event_Mouse_In mouse_in;
308 Ecore_IMF_Event_Mouse_Out mouse_out;
309 Ecore_IMF_Event_Mouse_Move mouse_move;
310 Ecore_IMF_Event_Mouse_Wheel mouse_wheel;
311 Ecore_IMF_Event_Key_Down key_down;
312 Ecore_IMF_Event_Key_Up key_up;
315 struct _Ecore_IMF_Preedit_Attr
317 Ecore_IMF_Preedit_Type preedit_type;
318 unsigned int start_index;
319 unsigned int end_index;
322 struct _Ecore_IMF_Context_Class
324 void (*add) (Ecore_IMF_Context *ctx);
325 void (*del) (Ecore_IMF_Context *ctx);
326 void (*client_window_set) (Ecore_IMF_Context *ctx, void *window);
327 void (*client_canvas_set) (Ecore_IMF_Context *ctx, void *canvas);
328 void (*show) (Ecore_IMF_Context *ctx);
329 void (*hide) (Ecore_IMF_Context *ctx);
330 void (*preedit_string_get) (Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
331 void (*focus_in) (Ecore_IMF_Context *ctx);
332 void (*focus_out) (Ecore_IMF_Context *ctx);
333 void (*reset) (Ecore_IMF_Context *ctx);
334 void (*cursor_position_set) (Ecore_IMF_Context *ctx, int cursor_pos);
335 void (*use_preedit_set) (Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
336 void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
337 Eina_Bool (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
338 void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
339 void (*prediction_allow_set)(Ecore_IMF_Context *ctx, Eina_Bool prediction);
340 void (*autocapital_type_set)(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
341 void (*control_panel_show) (Ecore_IMF_Context *ctx);
342 void (*control_panel_hide) (Ecore_IMF_Context *ctx);
343 void (*input_panel_layout_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
344 Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx);
345 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
346 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
347 void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
350 struct _Ecore_IMF_Context_Info
352 const char *id; /* ID */
353 const char *description; /* Human readable description */
354 const char *default_locales; /* Languages for which this context is the default, separated by : */
355 const char *canvas_type; /* The canvas type used by the input method. Eg.: evas */
356 int canvas_required; /* Whether the canvas usage is required for this input method */
359 EAPI int ecore_imf_init(void);
360 EAPI int ecore_imf_shutdown(void);
362 EAPI void ecore_imf_module_register(const Ecore_IMF_Context_Info *info, Ecore_IMF_Context *(*imf_module_create)(void), Ecore_IMF_Context *(*imf_module_exit)(void));
364 EAPI Eina_List *ecore_imf_context_available_ids_get(void);
365 EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
366 EAPI const char *ecore_imf_context_default_id_get(void);
367 EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
368 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
370 EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id);
371 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx);
372 EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx);
373 EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window);
374 EAPI void *ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx);
375 EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas);
376 EAPI void *ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx);
377 EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx);
378 EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx);
379 EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
380 EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos);
381 EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx);
382 EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx);
383 EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx);
384 EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos);
385 EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h);
386 EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit);
387 EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data);
388 EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
389 EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx);
390 EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
392 /* plugin specific functions */
393 EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc);
394 EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data);
395 EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx);
396 EAPI Eina_Bool ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
397 EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx);
398 EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx);
399 EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx);
400 EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str);
401 EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars);
402 EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data);
403 EAPI void *ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func);
404 EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info);
405 EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction);
406 EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx);
407 EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type);
408 EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx);
410 EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx);
411 EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx);
413 EAPI void ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx);
414 EAPI void ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx);
415 EAPI void ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout);
416 EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx);
417 EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
418 EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
419 EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable);
420 EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx);
422 /* The following entry points must be exported by each input method module
426 * int imf_module_init (const Ecore_IMF_Context_Info **info);
427 * void imf_module_exit (void);
428 * Ecore_IMF_Context *imf_module_create (void);