aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c')
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c402
1 files changed, 373 insertions, 29 deletions
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
index b65ee26..423c461 100644
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
+++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
@@ -143,6 +143,32 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
143 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; 143 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id;
144 * on failure it returns NULL. 144 * on failure it returns NULL.
145 * @ingroup Ecore_IMF_Context_Group 145 * @ingroup Ecore_IMF_Context_Group
146 *
147 * Example
148 * @code
149 *
150 * const char *ctx_id;
151 * const Ecore_IMF_Context_Info *ctx_info;
152 * Ecore_IMF_Context *imf_context;
153 * ctx_id = ecore_imf_context_default_id_get();
154 * if (ctx_id)
155 * {
156 * ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
157 * if (!ctx_info->canvas_type ||
158 * strcmp(ctx_info->canvas_type, "evas") == 0)
159 * {
160 * imf_context = ecore_imf_context_add(ctx_id);
161 * }
162 * else
163 * {
164 * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
165 * if (ctx_id)
166 * {
167 * imf_context = ecore_imf_context_add(ctx_id);
168 * }
169 * }
170 * }
171 * @endcode
146 */ 172 */
147EAPI const Ecore_IMF_Context_Info * 173EAPI const Ecore_IMF_Context_Info *
148ecore_imf_context_info_by_id_get(const char *id) 174ecore_imf_context_info_by_id_get(const char *id)
@@ -188,6 +214,10 @@ ecore_imf_context_add(const char *id)
188 * set on the immodule */ 214 * set on the immodule */
189 ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE); 215 ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE);
190 216
217 /* default input panel layout type is NORMAL type, so let's make sure it's
218 * set on the immodule */
219 ecore_imf_context_input_panel_layout_set(ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
220
191 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's 221 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
192 * set on the immodule */ 222 * set on the immodule */
193 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); 223 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
@@ -403,7 +433,7 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
403} 433}
404 434
405/** 435/**
406 * Retrieve the current preedit string, atrributes and 436 * Retrieve the current preedit string, attributes and
407 * cursor position for the Input Method Context. 437 * cursor position for the Input Method Context.
408 * 438 *
409 * @param ctx An #Ecore_IMF_Context. 439 * @param ctx An #Ecore_IMF_Context.
@@ -413,6 +443,49 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
413 * @param cursor_pos Location to store position of cursor (in characters) 443 * @param cursor_pos Location to store position of cursor (in characters)
414 * within the preedit string. 444 * within the preedit string.
415 * @ingroup Ecore_IMF_Context_Group 445 * @ingroup Ecore_IMF_Context_Group
446 *
447 * Example
448 * @code
449 * char *preedit_string;
450 * int cursor_pos;
451 * Eina_List *attrs = NULL, *l = NULL;
452 * Ecore_IMF_Preedit_Attr *attr;
453 *
454 * ecore_imf_context_preedit_string_with_attributes_get(imf_context,
455 * &preedit_string,
456 * &attrs, &cursor_pos);
457 * if (!preedit_string) return;
458 *
459 * if (strlen(preedit_string) > 0)
460 * {
461 * if (attrs)
462 * {
463 * EINA_LIST_FOREACH(attrs, l, attr)
464 * {
465 * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1)
466 * {
467 * // Something to do
468 * }
469 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2)
470 * {
471 * // Something to do
472 * }
473 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3)
474 * {
475 * // Something to do
476 * }
477 * }
478 * }
479 * }
480 *
481 * // delete attribute list
482 * if (attrs)
483 * {
484 * EINA_LIST_FREE(attrs, attr) free(attr);
485 * }
486 *
487 * free(preedit_string);
488 * @endcode
416 * @since 1.1.0 489 * @since 1.1.0
417 */ 490 */
418EAPI void 491EAPI void
@@ -440,6 +513,18 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha
440 * 513 *
441 * @param ctx An #Ecore_IMF_Context. 514 * @param ctx An #Ecore_IMF_Context.
442 * @ingroup Ecore_IMF_Context_Group 515 * @ingroup Ecore_IMF_Context_Group
516 *
517 * Example
518 * @code
519 * static void
520 * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source)
521 * {
522 * ecore_imf_context_reset(imf_context);
523 * ecore_imf_context_focus_in(imf_context);
524 * }
525 *
526 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, ed);
527 * @endcode
443 */ 528 */
444EAPI void 529EAPI void
445ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) 530ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
@@ -459,6 +544,18 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
459 * 544 *
460 * @param ctx An #Ecore_IMF_Context. 545 * @param ctx An #Ecore_IMF_Context.
461 * @ingroup Ecore_IMF_Context_Group 546 * @ingroup Ecore_IMF_Context_Group
547 *
548 * Example
549 * @code
550 * static void
551 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
552 * {
553 * ecore_imf_context_reset(imf_context);
554 * ecore_imf_context_focus_out(imf_context);
555 * }
556 *
557 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
558 * @endcode
462 */ 559 */
463EAPI void 560EAPI void
464ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) 561ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
@@ -479,6 +576,18 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
479 * 576 *
480 * @param ctx An #Ecore_IMF_Context. 577 * @param ctx An #Ecore_IMF_Context.
481 * @ingroup Ecore_IMF_Context_Group 578 * @ingroup Ecore_IMF_Context_Group
579 *
580 * Example
581 * @code
582 * static void
583 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
584 * {
585 * ecore_imf_context_reset(imf_context);
586 * ecore_imf_context_focus_out(imf_context);
587 * }
588 *
589 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
590 * @endcode
482 */ 591 */
483EAPI void 592EAPI void
484ecore_imf_context_reset(Ecore_IMF_Context *ctx) 593ecore_imf_context_reset(Ecore_IMF_Context *ctx)
@@ -515,10 +624,12 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
515/** 624/**
516 * Notify the Input Method Context that a change in the cursor 625 * Notify the Input Method Context that a change in the cursor
517 * location has been made. The location is relative to the canvas. 626 * location has been made. The location is relative to the canvas.
627 * The cursor location can be used to determine the position of
628 * candidate word window in the immodule.
518 * 629 *
519 * @param ctx An #Ecore_IMF_Context. 630 * @param ctx An #Ecore_IMF_Context.
520 * @param x cursor x position. 631 * @param x cursor x position.
521 * @param x cursor y position. 632 * @param y cursor y position.
522 * @param w cursor width. 633 * @param w cursor width.
523 * @param h cursor height. 634 * @param h cursor height.
524 * @ingroup Ecore_IMF_Context_Group 635 * @ingroup Ecore_IMF_Context_Group
@@ -605,7 +716,7 @@ ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx)
605} 716}
606 717
607/** 718/**
608 * Set the autocapitalization type on the immodule. 719 * Set the autocapitalization type on the immodule.
609 * 720 *
610 * @param ctx An #Ecore_IMF_Context. 721 * @param ctx An #Ecore_IMF_Context.
611 * @param autocapital_type the autocapitalization type. 722 * @param autocapital_type the autocapitalization type.
@@ -732,6 +843,28 @@ ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
732 * @param event The event itself. 843 * @param event The event itself.
733 * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE. 844 * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE.
734 * @ingroup Ecore_IMF_Context_Group 845 * @ingroup Ecore_IMF_Context_Group
846 *
847 * Example
848 * @code
849 * static void
850 * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
851 * {
852 * Evas_Event_Key_Down *ev = event_info;
853 * if (!ev->keyname) return;
854 *
855 * if (imf_context)
856 * {
857 * Ecore_IMF_Event_Key_Down ecore_ev;
858 * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
859 * if (ecore_imf_context_filter_event(imf_context,
860 * ECORE_IMF_EVENT_KEY_DOWN,
861 * (Ecore_IMF_Event *)&ecore_ev))
862 * return;
863 * }
864 * }
865 *
866 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
867 * @endcode
735 */ 868 */
736EAPI Eina_Bool 869EAPI Eina_Bool
737ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) 870ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
@@ -839,7 +972,7 @@ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
839 * If the function returns EINA_TRUE, then you must free 972 * If the function returns EINA_TRUE, then you must free
840 * the result stored in this location with free(). 973 * the result stored in this location with free().
841 * @param cursor_pos Location to store the position in characters of 974 * @param cursor_pos Location to store the position in characters of
842 * the insertion cursor within @text. 975 * the insertion cursor within @p text.
843 * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE. 976 * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE.
844 * @ingroup Ecore_IMF_Context_Module_Group 977 * @ingroup Ecore_IMF_Context_Module_Group
845 */ 978 */
@@ -877,6 +1010,8 @@ _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event)
877 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. 1010 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
878 * 1011 *
879 * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. 1012 * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts.
1013 * It's asynchronous method to put event to the event queue.
1014 * ecore_imf_context_event_callback_call() can be used as synchronous method.
880 * 1015 *
881 * @param ctx An #Ecore_IMF_Context. 1016 * @param ctx An #Ecore_IMF_Context.
882 * @ingroup Ecore_IMF_Context_Module_Group 1017 * @ingroup Ecore_IMF_Context_Module_Group
@@ -903,6 +1038,8 @@ ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
903 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. 1038 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
904 * 1039 *
905 * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. 1040 * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled.
1041 * It's asynchronous method to put event to the event queue.
1042 * ecore_imf_context_event_callback_call() can be used as synchronous method.
906 * 1043 *
907 * @param ctx An #Ecore_IMF_Context. 1044 * @param ctx An #Ecore_IMF_Context.
908 * @ingroup Ecore_IMF_Context_Module_Group 1045 * @ingroup Ecore_IMF_Context_Module_Group
@@ -928,6 +1065,9 @@ ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
928/** 1065/**
929 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. 1066 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
930 * 1067 *
1068 * It's asynchronous method to put event to the event queue.
1069 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1070 *
931 * @param ctx An #Ecore_IMF_Context. 1071 * @param ctx An #Ecore_IMF_Context.
932 * @ingroup Ecore_IMF_Context_Module_Group 1072 * @ingroup Ecore_IMF_Context_Module_Group
933 */ 1073 */
@@ -962,6 +1102,9 @@ _ecore_imf_event_free_commit(void *data __UNUSED__, void *event)
962/** 1102/**
963 * Adds ECORE_IMF_EVENT_COMMIT to the event queue. 1103 * Adds ECORE_IMF_EVENT_COMMIT to the event queue.
964 * 1104 *
1105 * It's asynchronous method to put event to the event queue.
1106 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1107 *
965 * @param ctx An #Ecore_IMF_Context. 1108 * @param ctx An #Ecore_IMF_Context.
966 * @param str The committed string. 1109 * @param str The committed string.
967 * @ingroup Ecore_IMF_Context_Module_Group 1110 * @ingroup Ecore_IMF_Context_Module_Group
@@ -999,6 +1142,9 @@ _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event)
999 * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. 1142 * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
1000 * Note that offset and n_chars are in characters not in bytes. 1143 * Note that offset and n_chars are in characters not in bytes.
1001 * 1144 *
1145 * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue.
1146 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1147 *
1002 * @param ctx An #Ecore_IMF_Context. 1148 * @param ctx An #Ecore_IMF_Context.
1003 * @param offset The start offset of surrounding to be deleted. 1149 * @param offset The start offset of surrounding to be deleted.
1004 * @param n_chars The number of characters to be deleted. 1150 * @param n_chars The number of characters to be deleted.
@@ -1041,8 +1187,20 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse
1041 * @param func The (callback) function to be called when the event is 1187 * @param func The (callback) function to be called when the event is
1042 * triggered 1188 * triggered
1043 * @param data The data pointer to be passed to @p func 1189 * @param data The data pointer to be passed to @p func
1044 * @ingroup Ecore_IMF_Context_Module_Group 1190 * @ingroup Ecore_IMF_Context_Group
1045 * @since 1.2.0 1191 * @since 1.2.0
1192 *
1193 * Example
1194 * @code
1195 * static void
1196 * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
1197 * {
1198 * char *commit_str = event_info;
1199 * // something to do
1200 * }
1201 *
1202 * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data);
1203 * @endcode
1046 */ 1204 */
1047EAPI void 1205EAPI void
1048ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data) 1206ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
@@ -1079,10 +1237,10 @@ ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1079 * @see ecore_imf_context_event_callback_add() for more details 1237 * @see ecore_imf_context_event_callback_add() for more details
1080 * 1238 *
1081 * @param ctx Ecore_IMF_Context to remove a callback from. 1239 * @param ctx Ecore_IMF_Context to remove a callback from.
1082 * @param type The type of event that was trigerring the callback 1240 * @param type The type of event that was triggering the callback
1083 * @param func The (callback) function that was to be called when the event was triggered 1241 * @param func The (callback) function that was to be called when the event was triggered
1084 * @return the data pointer 1242 * @return the data pointer
1085 * @ingroup Ecore_IMF_Context_Module_Group 1243 * @ingroup Ecore_IMF_Context_Group
1086 * @since 1.2.0 1244 * @since 1.2.0
1087 */ 1245 */
1088EAPI void * 1246EAPI void *
@@ -1096,7 +1254,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1096 { 1254 {
1097 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, 1255 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1098 "ecore_imf_context_event_callback_del"); 1256 "ecore_imf_context_event_callback_del");
1099 return; 1257 return NULL;
1100 } 1258 }
1101 1259
1102 if (!func) return NULL; 1260 if (!func) return NULL;
@@ -1106,7 +1264,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1106 { 1264 {
1107 if ((fn) && (fn->func == func) && (fn->type == type)) 1265 if ((fn) && (fn->func == func) && (fn->type == type))
1108 { 1266 {
1109 void *tmp = fn->data; 1267 void *tmp = (void *)fn->data;
1110 free(fn); 1268 free(fn);
1111 ctx->callbacks = eina_list_remove_list(ctx->callbacks, l); 1269 ctx->callbacks = eina_list_remove_list(ctx->callbacks, l);
1112 return tmp; 1270 return tmp;
@@ -1156,11 +1314,11 @@ ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback
1156 * Ask the Input Method Context to show the control panel of using Input Method. 1314 * Ask the Input Method Context to show the control panel of using Input Method.
1157 * 1315 *
1158 * @param ctx An #Ecore_IMF_Context. 1316 * @param ctx An #Ecore_IMF_Context.
1159 * @ingroup Ecore_IMF_Context_IMControl_Group 1317 * @ingroup Ecore_IMF_Context_Group
1160 * @since 1.1.0 1318 * @since 1.1.0
1161 */ 1319 */
1162EAPI void 1320EAPI void
1163ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) 1321ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
1164{ 1322{
1165 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1323 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1166 { 1324 {
@@ -1176,11 +1334,11 @@ ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx)
1176 * Ask the Input Method Context to hide the control panel of using Input Method. 1334 * Ask the Input Method Context to hide the control panel of using Input Method.
1177 * 1335 *
1178 * @param ctx An #Ecore_IMF_Context. 1336 * @param ctx An #Ecore_IMF_Context.
1179 * @ingroup Ecore_IMF_Context_IMControl_Group 1337 * @ingroup Ecore_IMF_Context_Group
1180 * @since 1.1.0 1338 * @since 1.1.0
1181 */ 1339 */
1182EAPI void 1340EAPI void
1183ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) 1341ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
1184{ 1342{
1185 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1343 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1186 { 1344 {
@@ -1196,7 +1354,7 @@ ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx)
1196 * Ask the Input Method Context to show the input panel (virtual keyboard). 1354 * Ask the Input Method Context to show the input panel (virtual keyboard).
1197 * 1355 *
1198 * @param ctx An #Ecore_IMF_Context. 1356 * @param ctx An #Ecore_IMF_Context.
1199 * @ingroup Ecore_IMF_Context_IMControl_Group 1357 * @ingroup Ecore_IMF_Context_Group
1200 * @since 1.1.0 1358 * @since 1.1.0
1201 */ 1359 */
1202EAPI void 1360EAPI void
@@ -1216,7 +1374,7 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
1216 * Ask the Input Method Context to hide the input panel. 1374 * Ask the Input Method Context to hide the input panel.
1217 * 1375 *
1218 * @param ctx An #Ecore_IMF_Context. 1376 * @param ctx An #Ecore_IMF_Context.
1219 * @ingroup Ecore_IMF_Context_IMControl_Group 1377 * @ingroup Ecore_IMF_Context_Group
1220 * @since 1.1.0 1378 * @since 1.1.0
1221 */ 1379 */
1222EAPI void 1380EAPI void
@@ -1236,12 +1394,12 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
1236 * Set the layout of the input panel. 1394 * Set the layout of the input panel.
1237 * 1395 *
1238 * @param ctx An #Ecore_IMF_Context. 1396 * @param ctx An #Ecore_IMF_Context.
1239 * @param layout see #ECORE_IMF_INPUT_PANEL_LAYOUT 1397 * @param layout see #Ecore_IMF_Input_Panel_Layout
1240 * @ingroup Ecore_IMF_Context_IMControl_Group 1398 * @ingroup Ecore_IMF_Context_Group
1241 * @since 1.1.0 1399 * @since 1.1.0
1242 */ 1400 */
1243EAPI void 1401EAPI void
1244ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) 1402ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
1245{ 1403{
1246 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1404 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1247 { 1405 {
@@ -1261,11 +1419,11 @@ ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Inpu
1261 * 1419 *
1262 * @param ctx An #Ecore_IMF_Context. 1420 * @param ctx An #Ecore_IMF_Context.
1263 * @return layout see #Ecore_IMF_Input_Panel_Layout 1421 * @return layout see #Ecore_IMF_Input_Panel_Layout
1264 * @ingroup Ecore_IMF_Context_IMControl_Group 1422 * @ingroup Ecore_IMF_Context_Group
1265 * @since 1.1.0 1423 * @since 1.1.0
1266 */ 1424 */
1267EAPI Ecore_IMF_Input_Panel_Layout 1425EAPI Ecore_IMF_Input_Panel_Layout
1268ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) 1426ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
1269{ 1427{
1270 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1428 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1271 { 1429 {
@@ -1275,9 +1433,7 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx)
1275 } 1433 }
1276 1434
1277 if (ctx->klass->input_panel_layout_get) 1435 if (ctx->klass->input_panel_layout_get)
1278 { 1436 return ctx->input_panel_layout;
1279 return ctx->input_panel_layout;
1280 }
1281 else 1437 else
1282 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; 1438 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
1283} 1439}
@@ -1288,11 +1444,11 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx)
1288 * 1444 *
1289 * @param ctx An #Ecore_IMF_Context. 1445 * @param ctx An #Ecore_IMF_Context.
1290 * @param lang the language to be set to the input panel. 1446 * @param lang the language to be set to the input panel.
1291 * @ingroup Ecore_IMF_Context_IMControl_Group 1447 * @ingroup Ecore_IMF_Context_Group
1292 * @since 1.1.0 1448 * @since 1.1.0
1293 */ 1449 */
1294EAPI void 1450EAPI void
1295ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) 1451ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
1296{ 1452{
1297 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1453 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1298 { 1454 {
@@ -1312,11 +1468,11 @@ ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_In
1312 * 1468 *
1313 * @param ctx An #Ecore_IMF_Context. 1469 * @param ctx An #Ecore_IMF_Context.
1314 * @return Ecore_IMF_Input_Panel_Lang 1470 * @return Ecore_IMF_Input_Panel_Lang
1315 * @ingroup Ecore_IMF_Context_IMControl_Group 1471 * @ingroup Ecore_IMF_Context_Group
1316 * @since 1.1.0 1472 * @since 1.1.0
1317 */ 1473 */
1318EAPI Ecore_IMF_Input_Panel_Lang 1474EAPI Ecore_IMF_Input_Panel_Lang
1319ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) 1475ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx)
1320{ 1476{
1321 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1477 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1322 { 1478 {
@@ -1338,7 +1494,7 @@ ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx)
1338 * @since 1.1.0 1494 * @since 1.1.0
1339 */ 1495 */
1340EAPI void 1496EAPI void
1341ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, 1497ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx,
1342 Eina_Bool enabled) 1498 Eina_Bool enabled)
1343{ 1499{
1344 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1500 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
@@ -1360,7 +1516,7 @@ ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx,
1360 * @since 1.1.0 1516 * @since 1.1.0
1361 */ 1517 */
1362EAPI Eina_Bool 1518EAPI Eina_Bool
1363ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) 1519ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx)
1364{ 1520{
1365 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1521 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1366 { 1522 {
@@ -1372,3 +1528,191 @@ ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx)
1372 return ctx->input_panel_enabled; 1528 return ctx->input_panel_enabled;
1373} 1529}
1374 1530
1531/**
1532 * Set the input panel-specific data to deliver to the input panel.
1533 * This API is used by applications to deliver specific data to the input panel.
1534 * The data format MUST be negotiated by both application and the input panel.
1535 * The size and format of data are defined by the input panel.
1536 *
1537 * @param ctx An #Ecore_IMF_Context.
1538 * @param data The specific data to be set to the input panel.
1539 * @param len the length of data, in bytes, to send to the input panel
1540 * @ingroup Ecore_IMF_Context_Group
1541 * @since 1.2.0
1542 */
1543EAPI void
1544ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
1545{
1546 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1547 {
1548 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1549 "ecore_imf_context_input_panel_imdata_set");
1550 return;
1551 }
1552
1553 if (!data) return;
1554
1555 if (ctx->klass->input_panel_imdata_set)
1556 ctx->klass->input_panel_imdata_set(ctx, data, len);
1557}
1558
1559/**
1560 * Get the specific data of the current active input panel.
1561 *
1562 * @param ctx An #Ecore_IMF_Context.
1563 * @param data The specific data to be got from the input panel
1564 * @param len The length of data
1565 * @ingroup Ecore_IMF_Context_Group
1566 * @since 1.2.0
1567 */
1568EAPI void
1569ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
1570{
1571 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1572 {
1573 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1574 "ecore_imf_context_input_panel_imdata_get");
1575 return;
1576 }
1577
1578 if (!data) return;
1579
1580 if (ctx->klass->input_panel_imdata_get)
1581 ctx->klass->input_panel_imdata_get(ctx, data, len);
1582}
1583
1584/**
1585 * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel.
1586 *
1587 * An input panel displays the string or icon associated with this type
1588 *
1589 * @param ctx An #Ecore_IMF_Context.
1590 * @param return_key_type The type of "return" key on the input panel
1591 * @ingroup Ecore_IMF_Context_Group
1592 * @since 1.2.0
1593 */
1594EAPI void
1595ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type)
1596{
1597 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1598 {
1599 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1600 "ecore_imf_context_input_panel_return_key_type_set");
1601 return;
1602 }
1603
1604 ctx->input_panel_return_key_type = return_key_type;
1605 if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
1606}
1607
1608/**
1609 * Get the "return" key type.
1610 *
1611 * @see ecore_imf_context_input_panel_return_key_type_set() for more details
1612 *
1613 * @param ctx An #Ecore_IMF_Context.
1614 * @return The type of "return" key on the input panel
1615 * @ingroup Ecore_IMF_Context_Group
1616 * @since 1.2.0
1617 */
1618EAPI Ecore_IMF_Input_Panel_Return_Key_Type
1619ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx)
1620{
1621 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1622 {
1623 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1624 "ecore_imf_context_input_panel_return_key_type_get");
1625 return EINA_FALSE;
1626 }
1627
1628 return ctx->input_panel_return_key_type;
1629}
1630
1631/**
1632 * Set the return key on the input panel to be disabled.
1633 *
1634 * @param ctx An #Ecore_IMF_Context.
1635 * @param disabled The state
1636 * @ingroup Ecore_IMF_Context_Group
1637 * @since 1.2.0
1638 */
1639EAPI void
1640ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled)
1641{
1642 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1643 {
1644 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1645 "ecore_imf_context_input_panel_return_key_disabled_set");
1646 return;
1647 }
1648
1649 ctx->input_panel_return_key_disabled = disabled;
1650 if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
1651}
1652
1653/**
1654 * Get whether the return key on the input panel should be disabled or not.
1655 *
1656 * @param ctx An #Ecore_IMF_Context.
1657 * @return EINA_TRUE if it should be disabled
1658 * @ingroup Ecore_IMF_Context_Group
1659 * @since 1.2.0
1660 */
1661EAPI Eina_Bool
1662ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx)
1663{
1664 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1665 {
1666 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1667 "ecore_imf_context_input_panel_return_key_disabled_get");
1668 return EINA_FALSE;
1669 }
1670
1671 return ctx->input_panel_return_key_disabled;
1672}
1673
1674/**
1675 * Set the caps lock mode on the input panel.
1676 *
1677 * @param ctx An #Ecore_IMF_Context.
1678 * @param mode Turn on caps lock on the input panel if EINA_TRUE
1679 * @ingroup Ecore_IMF_Context_Group
1680 * @since 1.2.0
1681 */
1682EAPI void
1683ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode)
1684{
1685 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1686 {
1687 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1688 "ecore_imf_context_input_panel_caps_lock_mode_set");
1689 return;
1690 }
1691
1692 if (ctx->klass->input_panel_caps_lock_mode_set)
1693 ctx->klass->input_panel_caps_lock_mode_set(ctx, mode);
1694
1695 ctx->input_panel_caps_lock_mode = mode;
1696}
1697
1698/**
1699 * Get the caps lock mode on the input panel.
1700 *
1701 * @param ctx An #Ecore_IMF_Context.
1702 * @return EINA_TRUE if the caps lock is turned on.
1703 * @ingroup Ecore_IMF_Context_Group
1704 * @since 1.2.0
1705 */
1706EAPI Eina_Bool
1707ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx)
1708{
1709 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1710 {
1711 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1712 "ecore_imf_context_input_panel_caps_lock_mode_get");
1713 return EINA_FALSE;
1714 }
1715
1716 return ctx->input_panel_caps_lock_mode;
1717}
1718