diff --git a/legacy/ecore/AUTHORS b/legacy/ecore/AUTHORS index cef69529a9..c8f7095f45 100644 --- a/legacy/ecore/AUTHORS +++ b/legacy/ecore/AUTHORS @@ -37,3 +37,4 @@ Mike Blumenkrantz Leif Middelschulte Mike McCormack Sangho Park +Jihoon Kim diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index b84e7098a3..bf0d3439fb 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -68,3 +68,7 @@ * Ecore_File: fix compilation when ecore_con and curl are not available + +2011-02-27 Jihoon Kim + + * Add ecore_imf_context_preedit_string_with_attributes_get API. diff --git a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h index e67e5af589..e015bdefde 100644 --- a/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h +++ b/legacy/ecore/src/lib/ecore_imf/Ecore_IMF.h @@ -55,6 +55,9 @@ typedef struct _Ecore_IMF_Context Ecore_IMF_Context; typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */ typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */ +/* Preedit attribute info */ +typedef struct _Ecore_IMF_Preedit_Attr Ecore_IMF_Preedit_Attr; + EAPI extern int ECORE_IMF_EVENT_PREEDIT_START; EAPI extern int ECORE_IMF_EVENT_PREEDIT_END; EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED; @@ -109,6 +112,14 @@ typedef enum ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30 } Ecore_IMF_Input_Mode; +typedef enum +{ + ECORE_IMF_PREEDIT_TYPE_NONE, + ECORE_IMF_PREEDIT_TYPE_SUB1, + ECORE_IMF_PREEDIT_TYPE_SUB2, + ECORE_IMF_PREEDIT_TYPE_SUB3 +} Ecore_IMF_Preedit_Type; + struct _Ecore_IMF_Event_Preedit_Start { Ecore_IMF_Context *ctx; @@ -260,6 +271,13 @@ union _Ecore_IMF_Event Ecore_IMF_Event_Key_Up key_up; }; +struct _Ecore_IMF_Preedit_Attr +{ + Ecore_IMF_Preedit_Type preedit_type; + unsigned int start_index; + unsigned int end_index; +}; + struct _Ecore_IMF_Context_Class { void (*add) (Ecore_IMF_Context *ctx); @@ -276,6 +294,7 @@ struct _Ecore_IMF_Context_Class void (*use_preedit_set) (Ecore_IMF_Context *ctx, Eina_Bool use_preedit); void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); Eina_Bool (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event); + void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); }; struct _Ecore_IMF_Context_Info @@ -308,6 +327,7 @@ EAPI void *ecore_imf_context_client_canvas_get(Ecore_IMF EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos); +EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx); diff --git a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c index 45590ad34a..d99136af4c 100644 --- a/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c +++ b/legacy/ecore/src/lib/ecore_imf/ecore_imf_context.c @@ -380,6 +380,38 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu } } +/** + * Retrieve the current preedit string, atrributes and + * cursor position for the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param str Location to store the retrieved string. The + * string retrieved must be freed with free(). + * @param attrs an Eina_List of attributes + * @param cursor_pos Location to store position of cursor (in characters) + * within the preedit string. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_string_with_attributes_get"); + return; + } + if (ctx->klass->preedit_string_with_attributes_get) + ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos); + else + { + if (str) *str = strdup(""); + if (attrs) *attrs = NULL; + if (cursor_pos) *cursor_pos = 0; + } +} + /** * Notify the Input Method Context that the widget to which its * correspond has gained focus.