2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
15 # ifdef EFL_ECORE_IMF_BUILD
17 # define EAPI __declspec(dllexport)
20 # endif /* ! DLL_EXPORT */
22 # define EAPI __declspec(dllimport)
23 # endif /* ! EFL_ECORE_IMF_BUILD */
27 # define EAPI __attribute__ ((visibility("default")))
40 /* Events sent by the Input Method */
41 typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
42 typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
43 typedef struct _Ecore_IMF_Event_Preedit_Changed Ecore_IMF_Event_Preedit_Changed;
44 typedef struct _Ecore_IMF_Event_Commit Ecore_IMF_Event_Commit;
45 typedef struct _Ecore_IMF_Event_Delete_Surrounding Ecore_IMF_Event_Delete_Surrounding;
47 /* Events to filter */
48 typedef struct _Ecore_IMF_Event_Mouse_Down Ecore_IMF_Event_Mouse_Down;
49 typedef struct _Ecore_IMF_Event_Mouse_Up Ecore_IMF_Event_Mouse_Up;
50 typedef struct _Ecore_IMF_Event_Mouse_In Ecore_IMF_Event_Mouse_In;
51 typedef struct _Ecore_IMF_Event_Mouse_Out Ecore_IMF_Event_Mouse_Out;
52 typedef struct _Ecore_IMF_Event_Mouse_Move Ecore_IMF_Event_Mouse_Move;
53 typedef struct _Ecore_IMF_Event_Mouse_Wheel Ecore_IMF_Event_Mouse_Wheel;
54 typedef struct _Ecore_IMF_Event_Key_Down Ecore_IMF_Event_Key_Down;
55 typedef struct _Ecore_IMF_Event_Key_Up Ecore_IMF_Event_Key_Up;
56 typedef union _Ecore_IMF_Event Ecore_IMF_Event;
58 typedef struct _Ecore_IMF_Context Ecore_IMF_Context; /**< An Input Method Context */
59 typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */
60 typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */
62 EAPI extern int ECORE_IMF_EVENT_PREEDIT_START;
63 EAPI extern int ECORE_IMF_EVENT_PREEDIT_END;
64 EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED;
65 EAPI extern int ECORE_IMF_EVENT_COMMIT;
66 EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING;
70 ECORE_IMF_EVENT_MOUSE_DOWN,
71 ECORE_IMF_EVENT_MOUSE_UP,
72 ECORE_IMF_EVENT_MOUSE_IN,
73 ECORE_IMF_EVENT_MOUSE_OUT,
74 ECORE_IMF_EVENT_MOUSE_MOVE,
75 ECORE_IMF_EVENT_MOUSE_WHEEL,
76 ECORE_IMF_EVENT_KEY_DOWN,
77 ECORE_IMF_EVENT_KEY_UP
78 } Ecore_IMF_Event_Type;
82 ECORE_IMF_KEYBOARD_MODIFIER_NONE = 0, /**< No active modifiers */
83 ECORE_IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */
84 ECORE_IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */
85 ECORE_IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */
86 ECORE_IMF_KEYBOARD_MODIFIER_WIN = 1 << 3 /**< "Win" (between "Ctrl" and "Alt") is pressed */
87 } Ecore_IMF_Keyboard_Modifiers;
91 ECORE_IMF_KEYBOARD_LOCK_NONE = 0, /**< No locks are active */
92 ECORE_IMF_KEYBOARD_LOCK_NUM = 1 << 0, /**< "Num" lock is active */
93 ECORE_IMF_KEYBOARD_LOCK_CAPS = 1 << 1, /**< "Caps" lock is active */
94 ECORE_IMF_KEYBOARD_LOCK_SCROLL = 1 << 2 /**< "Scroll" lock is active */
95 } Ecore_IMF_Keyboard_Locks;
99 ECORE_IMF_MOUSE_NONE = 0, /**< A single click */
100 ECORE_IMF_MOUSE_DOUBLE_CLICK = 1 << 0, /**< A double click */
101 ECORE_IMF_MOUSE_TRIPLE_CLICK = 1 << 1 /**< A triple click */
102 } Ecore_IMF_Mouse_Flags;
106 ECORE_IMF_INPUT_MODE_ALPHA = 1 << 0,
107 ECORE_IMF_INPUT_MODE_NUMERIC = 1 << 1,
108 ECORE_IMF_INPUT_MODE_SPECIAL = 1 << 2,
109 ECORE_IMF_INPUT_MODE_HEXA = 1 << 3,
110 ECORE_IMF_INPUT_MODE_TELE = 1 << 4,
111 ECORE_IMF_INPUT_MODE_FULL = (ECORE_IMF_INPUT_MODE_ALPHA | ECORE_IMF_INPUT_MODE_NUMERIC | ECORE_IMF_INPUT_MODE_SPECIAL),
112 ECORE_IMF_INPUT_MODE_INVISIBLE = 1 << 29,
113 ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30
114 } Ecore_IMF_Input_Mode;
116 struct _Ecore_IMF_Event_Preedit_Start
118 Ecore_IMF_Context *ctx;
121 struct _Ecore_IMF_Event_Preedit_End
123 Ecore_IMF_Context *ctx;
126 struct _Ecore_IMF_Event_Preedit_Changed
128 Ecore_IMF_Context *ctx;
131 struct _Ecore_IMF_Event_Commit
133 Ecore_IMF_Context *ctx;
137 struct _Ecore_IMF_Event_Delete_Surrounding
139 Ecore_IMF_Context *ctx;
144 struct _Ecore_IMF_Event_Mouse_Down
146 int button; /**< The button which has been pressed */
153 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
154 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
155 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
156 unsigned int timestamp; /**< The timestamp when the event occured */
159 struct _Ecore_IMF_Event_Mouse_Up
161 int button; /**< The button which has been pressed */
168 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
169 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
170 Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */
171 unsigned int timestamp; /**< The timestamp when the event occured */
174 struct _Ecore_IMF_Event_Mouse_In
183 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
184 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
185 unsigned int timestamp; /**< The timestamp when the event occured */
188 struct _Ecore_IMF_Event_Mouse_Out
197 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
198 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
199 unsigned int timestamp; /**< The timestamp when the event occured */
202 struct _Ecore_IMF_Event_Mouse_Move
213 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
214 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
215 unsigned int timestamp; /**< The timestamp when the event occured */
218 struct _Ecore_IMF_Event_Mouse_Wheel
220 int direction; /* 0 = default up/down wheel */
221 int z; /* ...,-2,-1 = down, 1,2,... = up */
228 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
229 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
230 unsigned int timestamp; /**< The timestamp when the event occured */
233 struct _Ecore_IMF_Event_Key_Down
235 const char *keyname; /**< The string name of the key pressed */
236 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
237 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
238 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
239 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
240 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 */
241 unsigned int timestamp; /**< The timestamp when the event occured */
244 struct _Ecore_IMF_Event_Key_Up
246 const char *keyname; /**< The string name of the key pressed */
247 Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */
248 Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */
249 const char *key; /**< The logical key : (eg shift+1 == exclamation) */
250 const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
251 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 */
252 unsigned int timestamp; /**< The timestamp when the event occured */
255 union _Ecore_IMF_Event
257 Ecore_IMF_Event_Mouse_Down mouse_down;
258 Ecore_IMF_Event_Mouse_Up mouse_up;
259 Ecore_IMF_Event_Mouse_In mouse_in;
260 Ecore_IMF_Event_Mouse_Out mouse_out;
261 Ecore_IMF_Event_Mouse_Move mouse_move;
262 Ecore_IMF_Event_Mouse_Wheel mouse_wheel;
263 Ecore_IMF_Event_Key_Down key_down;
264 Ecore_IMF_Event_Key_Up key_up;
267 struct _Ecore_IMF_Context_Class
269 void (*add) (Ecore_IMF_Context *ctx);
270 void (*del) (Ecore_IMF_Context *ctx);
271 void (*client_window_set) (Ecore_IMF_Context *ctx, void *window);
272 void (*client_canvas_set) (Ecore_IMF_Context *ctx, void *canvas);
273 void (*show) (Ecore_IMF_Context *ctx);
274 void (*hide) (Ecore_IMF_Context *ctx);
275 void (*preedit_string_get) (Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
276 void (*focus_in) (Ecore_IMF_Context *ctx);
277 void (*focus_out) (Ecore_IMF_Context *ctx);
278 void (*reset) (Ecore_IMF_Context *ctx);
279 void (*cursor_position_set) (Ecore_IMF_Context *ctx, int cursor_pos);
280 void (*use_preedit_set) (Ecore_IMF_Context *ctx, int use_preedit);
281 void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
282 int (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
285 struct _Ecore_IMF_Context_Info
287 const char *id; /* ID */
288 const char *description; /* Human readable description */
289 const char *default_locales; /* Languages for which this context is the default, separated by : */
290 const char *canvas_type; /* The canvas type used by the input method. Eg.: evas */
291 int canvas_required; /* Whether the canvas usage is required for this input method */
294 EAPI int ecore_imf_init(void);
295 EAPI int ecore_imf_shutdown(void);
297 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));
299 EAPI Eina_List *ecore_imf_context_available_ids_get(void);
300 EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type);
301 EAPI const char *ecore_imf_context_default_id_get(void);
302 EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type);
303 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id);
305 EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id);
306 EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx);
307 EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx);
308 EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window);
309 EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas);
310 EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx);
311 EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx);
312 EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos);
313 EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx);
314 EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx);
315 EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx);
316 EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos);
317 EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, int use_preedit);
318 EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, int (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data);
319 EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
320 EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx);
321 EAPI int ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
323 /* plugin specific functions */
324 EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc);
325 EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data);
326 EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx);
327 EAPI int ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
328 EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx);
329 EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx);
330 EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx);
331 EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str);
332 EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars);
334 /* The following entry points must be exported by each input method module
338 * int imf_module_init (const Ecore_IMF_Context_Info **info);
339 * void imf_module_exit (void);
340 * Ecore_IMF_Context *imf_module_create (void);