From 8c4d8fb831c78fbff702b47d1d5f65fe170b1011 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 18 May 2010 20:21:06 +0900 Subject: [PATCH] [ecore_imf] merged --- src/lib/ecore_imf/Ecore_IMF.h | 1041 ++++++++++++++++++++++++++++++++- src/lib/ecore_imf/Makefile.am | 3 +- src/lib/ecore_imf/ecore_imf_context.c | 520 +++++++++++++++- src/lib/ecore_imf/keydefs.h | 150 +++++ 4 files changed, 1711 insertions(+), 3 deletions(-) create mode 100755 src/lib/ecore_imf/keydefs.h diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index d75a521..9c70a6c 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -5,7 +5,8 @@ #ifndef _ECORE_IMF_H #define _ECORE_IMF_H -#include +#include +#include #ifdef EAPI # undef EAPI @@ -33,10 +34,127 @@ # endif #endif /* ! _WIN32 */ +/* Faked 'bool'. */ +#ifndef __cplusplus +#ifndef bool +#define bool int +#define FALSE 0 +#define TRUE 1 +#endif +#endif + +/** + * @file Ecore_IMF.h + * @brief The file that provides the ISF IMCONTROL Structures and APIs + * @version 1.0 + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + #ifdef __cplusplus extern "C" { #endif + typedef struct + { + int x; /**< x-coordinate of ISE window from left edge of screen*/ + int y; /**< y-coordinate of ISE window from top edge of screen*/ + int width; /**< width of ISE window from x- coordinate*/ + int height; /**< height of ISE window from y- coordinate*/ + } ISE_RECT; + + /* ecore_imf_context_ise_state_add_listener() flag */ + typedef enum + { + ISE_STATE_EVENT, /**< ISE STATE Event */ + ISE_MODE_EVENT, /**< ISE MODE Event */ + ISE_LANGUAGE_EVENT, /**< ISE LANGUAGE Event */ + ISE_SHIFT_MODE_EVENT, /**< ISE SHIFT MODE */ + ISE_PREEDIT_MODE_EVENT, /**< ISE PREEDIT MODE */ + ISE_COMPLETION_MODE_EVENT, /**< ISE COMPLETION MODE */ + ISE_CUSTOM_INPUT_MODE_EVENT, /**< ISE CUSTOM INPUT MODE */ + + ISE_PRIVATE_CONTEXT_01, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_02, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_03, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_04, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_05, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_06, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_07, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_08, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_09, /**< ISE PRIVATE CONTEXT */ + ISE_PRIVATE_CONTEXT_10, /**< ISE PRIVATE CONTEXT */ + ISE_EVENT_INVALID + } ISE_EVENT; + + typedef enum + { + ISE_STATE_SHOW, /**< Show ISE */ + ISE_STATE_SHOW_ALWAYS, /**< Show ISE always*/ + ISE_STATE_HIDE, /**< Hide ISE */ + ISE_STATE_INVALID + } ISE_STATE; + + typedef enum + { + ISE_MODE_NATIVE, /**< Follow current locale mode */ + ISE_MODE_ENGLISH, /**< English mode*/ + ISE_MODE_NUMBER, /**< Number mode*/ + ISE_MODE_INVALID + } ISE_MODE; + + typedef enum + { + ISE_LAYOUT_NORMAL, /**< default 4x4 layout */ + ISE_LAYOUT_NUMBER, /**< number layout*/ + ISE_LAYOUT_EMAIL, /**< Email layout*/ + ISE_LAYOUT_URL, /**< URL layout*/ + ISE_LAYOUT_PHONENUMBER, /**< Phone Number layout*/ + ISE_LAYOUT_CUSTOM_1 = 10, /* Reserved for future use */ + ISE_LAYOUT_CUSTOM_2, + ISE_LAYOUT_CUSTOM_3, + ISE_LAYOUT_CUSTOM_4, + ISE_LAYOUT_CUSTOM_5, + ISE_LAYOUT_CUSTOM_6, + ISE_LAYOUT_CUSTOM_7, + ISE_LAYOUT_CUSTOM_8, + ISE_LAYOUT_CUSTOM_9, + ISE_LAYOUT_CUSTOM_10, + ISE_LAYOUT_INVALID + } ISE_LAYOUT; + + typedef enum + { + ISE_LANG_ENGLISH, /**< English */ + ISE_LANG_FRENCH, /**< French */ + ISE_LANG_SPANISH, /**< Spanish */ + ISE_LANG_DUTCH, /**< Dutch */ + ISE_LANG_GERMAN, /**< German */ + ISE_LANG_ITALIAN, /**< Italian */ + ISE_LANG_PORTUGUESE,/**< Portuguese */ + ISE_LANG_TURKISH, /**< Turkish */ + ISE_LANG_KOREAN, /**< Korean */ + ISE_LANG_CHINESE, /**< Chinese */ + ISE_LANG_JAPANESE, /**< Japanese */ + ISE_LANG_HINDI, /**< Hindi */ + ISE_LANG_THAI, /**< Thai */ + ISE_LANG_GREEK, /**< Greek */ + ISE_LANG_INVALID + } ISE_LANG; + + typedef enum + { + ISE_AUTOCORRECTION_DEFAULT, + ISE_AUTOCORRECTION_NO, + ISE_AUTOCORRECTION_YES, + ISE_AUTOCORRECTION_INVALID + } ISE_AUTOCORRECTION; + + /* As of now this ISE_STYLE is not decided -- Not supported for now --*/ + typedef struct + { + bool fUseImEffect; /**< whether use Im effect or not */ + } ISE_STYLE; + /* Events sent by the Input Method */ typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start; typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End; @@ -280,6 +398,47 @@ extern "C" { void (*use_preedit_set) (Ecore_IMF_Context *ctx, int use_preedit); void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); int (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event); + + /* IM Control APIs */ + int (*ise_show) (Ecore_IMF_Context *ctx, Evas_Object *obj, ISE_STATE state); + int (*ise_hide) (Ecore_IMF_Context *ctx); + int (*ise_control_panel_show) (Ecore_IMF_Context *ctx); + int (*ise_control_panel_hide) (Ecore_IMF_Context *ctx); + + int (*ise_set_mode) (Ecore_IMF_Context *ctx, ISE_MODE mode); + int (*ise_get_mode) (Ecore_IMF_Context *ctx, ISE_MODE *mode); + int (*ise_set_language) (Ecore_IMF_Context *ctx, ISE_LANG lang); + int (*ise_get_language) (Ecore_IMF_Context *ctx, ISE_LANG *lang); + int (*ise_get_ise_language) (Ecore_IMF_Context *ctx, const char* ise_name, char*** langlist); + int (*ise_set_isf_language) (Ecore_IMF_Context *ctx, const char* lang); + + int (*ise_set_imdata) (Ecore_IMF_Context *ctx, const char* data,int len); + int (*ise_get_imdata) (Ecore_IMF_Context *ctx, char* data,int *len); + int (*ise_set_style) (Ecore_IMF_Context *ctx, ISE_STYLE style); + int (*ise_get_style) (Ecore_IMF_Context *ctx, ISE_STYLE *style); + int (*ise_get_window_rect) (Ecore_IMF_Context *ctx, ISE_RECT *rect); + int (*ise_set_private_key) (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char* label, const char* value); + int (*ise_set_private_key_by_image) (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char *img_path, const char* value); + int (*ise_set_layout) (Ecore_IMF_Context *ctx, ISE_LAYOUT layout); + int (*ise_get_layout) (Ecore_IMF_Context *ctx, ISE_LAYOUT *layout); + int (*ise_reset) (Ecore_IMF_Context *ctx); /* Same as reset to default property*/ + + int (*ise_set_screen_orientation) (Ecore_IMF_Context *ctx, int orientation); + int (*ise_get_active_isename) (Ecore_IMF_Context *ctx, char* name); + int (*ise_set_active_ise_by_name) (Ecore_IMF_Context *ctx, const char* name); + int (*ise_set_active_ise_by_uuid) (Ecore_IMF_Context *ctx, const char* uuid); + int (*ise_get_iselist) (Ecore_IMF_Context *ctx, char*** iselist); + int (*ise_get_ise_state) (Ecore_IMF_Context *ctx, ISE_STATE *state); + + /* CallBack APIs */ + int (*ise_state_add_listener) (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT,int), void *data); /**< This API will be depricated */ + int (*ise_state_remove_listener)(Ecore_IMF_Context *ctx, int listener_id); /**< This API will be depricated */ + int (*ise_state_change_listener)(Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT,int)); /**< This API will be depricated */ + void (*ise_event_callback_set) (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (void *,ISE_EVENT,int), void *data); + int (*ise_initialize)(Ecore_IMF_Context *ctx, Evas_Object * mainwindow); + const char * (*get_focused_preedit_string)(Ecore_IMF_Context *ctx); + + int (*ise_set_disable_key) (Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled); }; struct _Ecore_IMF_Context_Info @@ -331,6 +490,886 @@ extern "C" { EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str); EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars); + /** + * @defgroup Ecore_IMF_Context_IMControl_Group Ecore Input Method Context IMControl Functions + * + * Functions that should be used by EFL applications to operate ISF and ISE. + */ + + /** + * Get imf_context to map to real loaded context APIs, e.g. APIs provided by isf context or other context. + * In this case, the return context is used as the 1st input paramete of all IMControl APIs. + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EAPI Ecore_IMF_Context* ecore_get_imf_context(); + + /** + * Show the current active ISE with given state. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param obj evas object to be operated when ISE shows + * @param state see ISE_STATE + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * Evas_Object *en = obj; + * ISE_STATE state = ISE_STATE_SHOW; + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * if(imf_context) + * { + * //Note: this API MUST be called before calling ecore_imf_context_ise_set_** APIs and ecore_imf_context_ise_show. + * ecore_imf_context_ise_reset (imf_context); + * //show ise window + * ecore_imf_context_ise_show (imf_context, en, state); + * } + * ecore_imf_shutdown(); + * } + * + * static void entry_application(appdata * ad) + * { + * Evas_Object *en; + * en = elm_entry_add(ad->win_main); + * evas_object_smart_callback_add(en, "clicked", entry_clicked_cb, ad); + * } + * + * @endcode + */ + EAPI void ecore_imf_context_ise_show(Ecore_IMF_Context *ctx,Evas_Object *obj, ISE_STATE state); + + /** + * Hide the current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * static void entry_application(appdata * ad) + * { + * Evas_Object *en; + * en = elm_entry_add(ad->win_main); + * evas_object_smart_callback_add(en, "clicked", button_clicked_cb,en); + * } + * static void button_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * Evas_Object *en = data; + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * if(imf_context) + * { + * ecore_imf_context_ise_hide (imf_context, en, state); + * } + * ecore_imf_shutdown(); + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_hide(Ecore_IMF_Context *ctx); + + /** + * Show ISE control panel. + * @param ctx context used to map real loaded APIs + * @ingroup Ecore_IMF_Context_IMControl_Group + * + * ISE control panel shows ISE list and provides setup of each ISE + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_control_panel_show (Ecore_IMF_Context *ctx); + + /** + * Hide ISE control panel. + * @param ctx context used to map real loaded APIs + * @ingroup Ecore_IMF_Context_IMControl_Group + * + * ISE control panel shows ISE list and provides setup of each ISE + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_control_panel_hide (Ecore_IMF_Context *ctx); + + /** + * Set ISE Mode before show ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * @param ctx context used to map real loaded APIs + * @param mode see ISE_MODE + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_MODE mode = ISE_MODE_NUMBER; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_mode (imf_context, mode); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_mode (Ecore_IMF_Context *ctx, ISE_MODE mode); + + /** + * Get ISE Mode of current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param mode see ISE_MODE + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_MODE mode; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_get_mode (imf_context, &mode); + * //here u can see what the current mode is. + * ecore_imf_context_ise_reset (imf_context); + * mode = ISE_MODE_NUMBER; + * ecore_imf_context_ise_set_mode (imf_context, mode); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_mode (Ecore_IMF_Context *ctx, ISE_MODE *mode); + + /** + * Set ISE Language before show ISE. + * @param ctx context used to map real loaded APIs + * @param lang see ISE_LANG + * @ingroup Ecore_IMF_Context_IMControl_Group + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_set_language (Ecore_IMF_Context *ctx, ISE_LANG lang); + + /** + * Get ISE Language of current active ISE. + * @param ctx context used to map real loaded APIs + * @param lang see ISE_LANG + * @ingroup Ecore_IMF_Context_IMControl_Group + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_get_language (Ecore_IMF_Context *ctx, ISE_LANG *lang); + + /** + * Get ISE Language of given ISE. -- Not supported for now -- + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EAPI int ecore_imf_context_ise_get_ise_language (Ecore_IMF_Context *ctx, const char* ise_name, char ***langlist); + + /** + * Set ISF Language. -- Not supported for now -- + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EAPI void ecore_imf_context_ise_set_isf_language (Ecore_IMF_Context *ctx, const char* lang); + + /** + * Set ISE Specific data before show ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * @param ctx context used to map real loaded APIs + * @param data data pointer + * @param len data length + * @ingroup Ecore_IMF_Context_IMControl_Group + * + * this API is used by applications to deliver specific data to ISE. + * the data format MUST be negotiated by both application and ISE negotiate. + * + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * char *im_data="application sample imdata"; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_imdata (imf_context, im_data, strlen(im_data)+1); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_imdata (Ecore_IMF_Context *ctx, const char * data, int len); + + /** + * Get ISE Specific data of current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param data data pointer + * @param len data length + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * int len = 256; + * char *im_data = (char*) malloc (len); + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_get_imdata (imf_context, im_data, &len); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_imdata (Ecore_IMF_Context *ctx, char * data,int *len); + + /** + * Set ISE Style before show ISE. -- Not supported for now -- + * @param ctx context used to map real loaded APIs + * @param style see ISE_STYLE + * @ingroup Ecore_IMF_Context_IMControl_Group + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_set_style (Ecore_IMF_Context *ctx, ISE_STYLE style); + + /** + * Get ISE Style of current active ISE. -- Not supported for now -- + * @param ctx context used to map real loaded APIs + * @param style see ISE_STYLE + * @ingroup Ecore_IMF_Context_IMControl_Group + * THIS API IS NOT SUPPORTED NOW + */ + EAPI void ecore_imf_context_ise_get_style (Ecore_IMF_Context *ctx, ISE_STYLE *style); + + /** + * Get ISE position of current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param rect + * int rect.x, top-left x co-ordinate of rectangle; + * int rect.y, top-left y co-ordinate of rectangle; + * int rect.width, width of rectangle ; + * int rect.height, height of rectangle; + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * Ecore_IMF_Context *imf_context = NULL; + * ISE_RECT rect; + * imf_context = ecore_get_imf_context(); + * if (imf_context) + * { + * ecore_imf_context_ise_get_window_rect (imf_context, &rect); + * //here application can get window size rect + * printf ("rect.x=%d \n", rect.x); + * printf ("rect.y=%d \n", rect.y); + * printf ("rect.width=%d \n", rect.width); + * printf ("rect.height=%d \n", rect.height); + * } + * //do imf related things + * ecore_imf_shutdown(); + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_window_rect (Ecore_IMF_Context *ctx, ISE_RECT *rect); + + /** + * Set ISE private key before show ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * Since the second parameter of this API requires a layout index, so before using this API application has to set a specific layout and that layout index + * should be passed in the 2nd argument of this API(see sample code). + * @param ctx context used to map real loaded APIs + * @param layout_index index of layout page to be set + * @param key_index index of key to be set + * @param label text label to be appeared on private key + * @param value value of key, If NULL it will use original value of key + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_URL; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_layout (imf_context, layout); + * ecore_imf_context_ise_set_private_key (imf_context, layout, 0, "www", "www"); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_private_key (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char* label, const char* value); + + /** + * Set ISE private key by image before show ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * Since the second parameter of this API requires a layout index, so before using this API application has to set a specific layout and that layout index + * should be passed in the 2nd argument of this API(see sample code). + * @param ctx context used to map real loaded APIs + * @param layout_index index of layout page to be set + * @param key_index index of key to be set + * @param label image file path to be appeared on private key + * @param value value of key, If NULL it will use original value of key + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_URL; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_layout (imf_context, layout); + * ecore_imf_context_ise_set_private_key_by_image (imf_context, 1, 0, "/usr/share/themes/pixmap/IME/ime_3X4_www.ifg", "www"); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_private_key_by_image (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char* img_path, const char* value); + + /** + * Set ISE Layout before show ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * @param ctx context used to map real loaded APIs + * @param layout see ISE_LAYOUT + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_EMAIL; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_layout (imf_context, layout); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_layout (Ecore_IMF_Context *ctx, ISE_LAYOUT layout); + + /** + * Get ISE Layout of current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param layout see ISE_LAYOUT + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_EMAIL; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_get_layout (imf_context, &layout); + * //here u can see what the current layout is + * ecore_imf_context_ise_reset (imf_context); + * layout = ISE_LAYOUT_EMAIL; + * ecore_imf_context_ise_set_layout (imf_context, layout); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_layout (Ecore_IMF_Context *ctx, ISE_LAYOUT *layout); + + /** + * Reset ISE Context including its Style. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * This is special function that should be called before calling any ecore_imf_context_set*** APIs to restore all default properties of ISE. + * @ingroup Ecore_IMF_Context_IMControl_Group + * + * NOTE: This API MUST be called before calling ecore_imf_context_ise_show(). + */ + EAPI void ecore_imf_context_ise_reset (Ecore_IMF_Context *ctx); /* Same as reset to default property*/ + + /** + * Set ISE screen orientation. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * To show the keypad in landscape mode applicaiton should first call this API with 2nd parameter as 90 or 270. + * After then only application should call ecore_imf_context_ise_show() function. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * int degree = 90; // the degree value can be either 90/270 for landscape mode and normal portrait mode 0/360. + * if (imf_context) + * { + * ecore_imf_context_ise_reset(imf_context); + * ecore_imf_context_ise_set_screen_orientation(imf_context, degree); + * ecore_imf_context_ise_show(imf_context, obj, ISE_STATE_SHOW); + * } + * //do imf related things + * ecore_imf_shutdown(); + * } + */ + EAPI void ecore_imf_context_ise_set_screen_orientation (Ecore_IMF_Context *ctx, int orientation); + + /** + * Get name of current active ISE. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param name ISE name to be got + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * int len = 256; + * char *isename = (char*) malloc (len); + * memset(isename, '\0', sizeof(isename)); + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_get_active_isename (imf_context, isename); + * printf("get isename=[%s]\n", isename); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_active_isename (Ecore_IMF_Context *ctx, char* name); + + /** + * Set ISE by its name. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * @param ctx context used to map real loaded APIs + * @param name ISE name to be set + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_active_ise_by_name (imf_context, "Input Pad"); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_active_ise_by_name (Ecore_IMF_Context *ctx, const char* name); + + /** + * Set ISE by its uuid. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * @param ctx context used to map real loaded APIs + * @param uuid ISE uuid to be set + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_active_ise_by_uuid (imf_context, "ff110940-b8f0-4062-9ff6-a84f4f3575c0"); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_active_ise_by_uuid (Ecore_IMF_Context *ctx, const char* uuid); + + /** + * Get list of ISEs. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs + * @param iselist pointer to the list to be got. + * @return int ise counter of iselist + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_EMAIL, + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * char** iselist; + * int count,i; + * count = ecore_imf_context_ise_get_iselist(imf_context, &iselist); + * printf("get_iselist : count[%d] ", count); + * for (i=0;i + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_get_ise_state (imf_context, &state); + * //here u can see what the current state is + * ecore_imf_context_ise_reset (imf_context); + * state = ISE_STATE_SHOW; + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_get_ise_state (Ecore_IMF_Context *ctx, ISE_STATE *state); + + /** + * This API is depricated. + * Application can register a callback function which will be called if there is change in ise state,language,mode etc. + * @param ctx context used to map real loaded APIs. + * @param pListenerCallback the callback function to be called + * @param data application-ISE specific data. + * @return an integer unique to callabck registered. + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EINA_DEPRECATED EAPI int ecore_imf_context_ise_state_add_listener (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT,int), void *data); + + /** + * This API is depricated. + * To deregister(remove) the callback initially registered by application. + * param listener_id the unique number returned while registering the concerned callback. + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EINA_DEPRECATED EAPI void ecore_imf_context_ise_state_remove_listener (Ecore_IMF_Context *ctx, int listener_id); + + /** + * same as ecore_imf_context_ise_state_add_listener() wihout any application-ISE specific data. -- Not supported for now -- + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EINA_DEPRECATED EAPI int ecore_imf_context_ise_state_change_listener (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT, int)); + + /** + * Application can register a callback function which will be called if there is change in ise state,language,mode etc. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * @param ctx context used to map real loaded APIs. + * @param pEventCallback the callback function to be called + * @param data application-ISE specific data. + * @return an integer unique to callabck registered. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * void _ise_event_callback(void *data, ISE_EVENT type, int value) + * { + * Ecore_IMF_Context *ic = (Ecore_IMF_Context *)data; + * + * switch(type){ + * case ISE_STATE_EVENT: + * if(value == ISE_STATE_SHOW) { + * // ISE state has changed to ISE_STATE_SHOW status + * }else if(value == ISE_STATE_HIDE) { + * // ISE state has changed to ISE_STATE_HIDE status + * } + * break; + * } + * printf("type: %d, value: %d\n", type, value); + * } + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * //just one listener callback can be added for now + * ecore_imf_context_ise_event_callback_set (imf_context, _ise_event_callback, imf_context); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + * In order to deregister the callback function registered application should follow the below step. + * ecore_imf_context_ise_event_callback_set (imf_context, NULL, NULL); + */ + EAPI void ecore_imf_context_ise_event_callback_set (Ecore_IMF_Context *ctx, void (*pEventCallBackFunc) (void *,ISE_EVENT,int), void *data); + + /** + * cowork with Mainwindow of elementary. -- Not supported for now -- + * @ingroup Ecore_IMF_Context_IMControl_Group + */ + EAPI void ecore_imf_context_ise_initialize (Ecore_IMF_Context *ctx, Evas_Object * mainwindow); + + /** + * Get the preedit string of the focused context. + * @param ctx context used to map real loaded APIs + * @return const char * the preedit string of the focused context + **/ + EAPI const char * ecore_imf_context_get_focused_preedit_string (Ecore_IMF_Context *ctx); + + /** + * Set the key to be disabled. + * To use this API applicaiton should include Ecore_IMF.h header file. + * Before calling this API, every application should call ecore_imf_init() to initialize the ecore_imf shared library. + * The first parameter i.e Ecore_IMF_Context *ctx is used to map the ecore_imf API into real implemented API which is inside ISF. + * Before using any ecore_imf_context_set*** APIs the applciation must call ecore_imf_context_ise_reset() function. + * Since the second parameter of this API requires a layout index, so before using this API application has to set a specific layout and that layout index + * should be passed in the 2nd argument of this API(see sample code). + * @param ctx context used to map real loaded APIs + * @param layout_index index of layout page to be set + * @param key_index index of key to be set + * @param disabled The state + * @ingroup Ecore_IMF_Context_IMControl_Group + * @code + * #include + * + * static void entry_clicked_cb(void *data, Evas_Object *obj, void *event_info) + * { + * ecore_imf_init(); + * ISE_STATE state = ISE_STATE_SHOW; + * ISE_LAYOUT layout = ISE_LAYOUT_NUMBER; + * + * Ecore_IMF_Context *imf_context = NULL; + * imf_context = ecore_get_imf_context(); + * + * if (imf_context) + * { + * ecore_imf_context_ise_reset (imf_context); + * ecore_imf_context_ise_set_layout (imf_context, layout); + * ecore_imf_context_ise_set_disable_key (imf_context, layout, ISE_KEY_SPACE, EINA_TRUE); + * ecore_imf_context_ise_show (imf_context, obj, state); + * } + * + * //do imf related things + * + * ecore_imf_shutdown(); + * + * //do imf irrelated things + * } + * @endcode + */ + EAPI void ecore_imf_context_ise_set_disable_key (Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled); + /* The following entry points must be exported by each input method module */ diff --git a/src/lib/ecore_imf/Makefile.am b/src/lib/ecore_imf/Makefile.am index 385ae8c..5dfc900 100644 --- a/src/lib/ecore_imf/Makefile.am +++ b/src/lib/ecore_imf/Makefile.am @@ -12,7 +12,8 @@ AM_CFLAGS = @WIN32_CFLAGS@ lib_LTLIBRARIES = libecore_imf.la include_HEADERS = \ -Ecore_IMF.h +Ecore_IMF.h \ +keydefs.h libecore_imf_la_SOURCES = \ ecore_imf.c \ diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 1214be0..cb342dc 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -6,6 +6,7 @@ # include #endif +#include #include #include #include @@ -93,6 +94,7 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) int best_goodness = 0; id = getenv("ECORE_IMF_MODULE"); + //printf ("id is %s \n", id); if (id) { if (strcmp(id, "none") == 0) return NULL; @@ -267,7 +269,7 @@ ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, - "ecore_imf_context_client_window_set"); + "ecore_imf_context_client_canvas_set"); return; } if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas); @@ -805,3 +807,519 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING, ev, _ecore_imf_event_free_delete_surrounding, NULL); } + + + +/*** ImControl Related APIs */ + +EAPI Ecore_IMF_Context* ecore_get_imf_context() +{ + const char *ctx_id = NULL; + Ecore_IMF_Context *imf_context = NULL; + + ctx_id = ecore_imf_context_default_id_get(); + //printf ("ctx_id = %s\n", ctx_id); + if (ctx_id) + imf_context = ecore_imf_context_add(ctx_id); + //printf ("imf_context = %d\n", imf_context); + + return imf_context; +} + +EAPI void +ecore_imf_context_ise_show(Ecore_IMF_Context *ctx, Evas_Object *obj, ISE_STATE state) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_show"); + return; + } + + if (ctx->klass->ise_show) ctx->klass->ise_show(ctx, obj, state); +} + +#if 0 +EAPI void +ecore_imf_context_ise_show_with_style(Ecore_IMF_Context * ctx, Evas_Object * obj, int state, ISE_STYLE style) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_show_with_style"); + return; + } + if (ctx->klass->ise_show_with_style) ctx->klass->ise_show_with_style(ctx,obj,state,style); +} +#endif + +EAPI void +ecore_imf_context_ise_hide(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_hide"); + return; + } + if (ctx->klass->ise_hide) ctx->klass->ise_hide(ctx); +} + +EAPI void +ecore_imf_context_ise_control_panel_show (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_control_panel_show"); + return; + } + if (ctx->klass->ise_control_panel_show) ctx->klass->ise_control_panel_show(ctx); +} + +EAPI void +ecore_imf_context_ise_control_panel_hide (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_control_panel_hide"); + return; + } + if (ctx->klass->ise_control_panel_hide) ctx->klass->ise_control_panel_hide(ctx); +} + +EAPI void +ecore_imf_context_ise_set_mode (Ecore_IMF_Context *ctx, ISE_MODE mode) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_mode"); + return; + } + if (ctx->klass->ise_set_mode) ctx->klass->ise_set_mode(ctx, mode); +} + +EAPI void +ecore_imf_context_ise_get_mode (Ecore_IMF_Context *ctx, ISE_MODE *mode) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_mode"); + return; + } + if (ctx->klass->ise_get_mode) ctx->klass->ise_get_mode(ctx, mode); +} + +EAPI void +ecore_imf_context_ise_set_language (Ecore_IMF_Context *ctx, ISE_LANG lang) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_language"); + return; + } + if (ctx->klass->ise_set_language) ctx->klass->ise_set_language(ctx, lang); +} + +EAPI void +ecore_imf_context_ise_get_language (Ecore_IMF_Context *ctx, ISE_LANG *lang) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_language"); + return; + } + if (ctx->klass->ise_get_language) ctx->klass->ise_get_language(ctx, lang); +} + +EAPI int +ecore_imf_context_ise_get_ise_language (Ecore_IMF_Context *ctx, const char* ise_name, char ***langlist) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_ise_language"); + return -1; + } + + if (!ise_name) + { + printf ("input parameters error!!! \n"); + return -1; + } + + if (ctx->klass->ise_get_ise_language) { + return ctx->klass->ise_get_ise_language(ctx, ise_name, langlist); + } + else + return -1; +} + +EAPI void +ecore_imf_context_ise_set_isf_language (Ecore_IMF_Context *ctx, const char* lang) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_isf_language"); + return; + } + + if (!lang) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_isf_language) ctx->klass->ise_set_isf_language(ctx, lang); +} + +EAPI void +ecore_imf_context_ise_set_imdata (Ecore_IMF_Context *ctx, const char * data, int len) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_imdata"); + return; + } + + if (!data || len <=0) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_imdata) ctx->klass->ise_set_imdata(ctx, data, len); +} + +EAPI void +ecore_imf_context_ise_get_imdata (Ecore_IMF_Context *ctx, char * data,int *len) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_imdata"); + return; + } + if (!data) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_get_imdata) ctx->klass->ise_get_imdata(ctx, data, len); +} + +EAPI void +ecore_imf_context_ise_set_style (Ecore_IMF_Context *ctx, ISE_STYLE style) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_style"); + return; + } + if (ctx->klass->ise_set_style) ctx->klass->ise_set_style(ctx, style); +} + +EAPI void +ecore_imf_context_ise_get_style (Ecore_IMF_Context *ctx, ISE_STYLE *style) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_style"); + return; + } + if (ctx->klass->ise_get_style) ctx->klass->ise_get_style(ctx, style); +} + +EAPI void +ecore_imf_context_ise_get_window_rect (Ecore_IMF_Context *ctx, ISE_RECT *rect) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_window_rect"); + return; + } + if (ctx->klass->ise_get_window_rect) ctx->klass->ise_get_window_rect(ctx, rect); +} + +EAPI void +ecore_imf_context_ise_set_private_key (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char* label, const char* value) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_private_key"); + return; + } + if (!label || !value) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_private_key) ctx->klass->ise_set_private_key(ctx, layout_index, key_index, label, value); +} + +EAPI void +ecore_imf_context_ise_set_private_key_by_image (Ecore_IMF_Context *ctx, int layout_index, int key_index, const char* img_path, const char* value) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_private_key_by_image"); + return; + } + + if (!img_path || !value) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_private_key_by_image) ctx->klass->ise_set_private_key_by_image(ctx, layout_index, key_index, img_path, value); +} + +EAPI void +ecore_imf_context_ise_set_disable_key (Ecore_IMF_Context *ctx, int layout_index, int key_index, Eina_Bool disabled) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_disable_key"); + return; + } + + if (ctx->klass->ise_set_disable_key) ctx->klass->ise_set_disable_key(ctx, layout_index, key_index, disabled); +} + +EAPI void +ecore_imf_context_ise_set_layout (Ecore_IMF_Context *ctx, ISE_LAYOUT layout) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_layout"); + return; + } + + if (ctx->klass->ise_set_layout) ctx->klass->ise_set_layout(ctx, layout); +} + +EAPI void +ecore_imf_context_ise_get_layout (Ecore_IMF_Context *ctx, ISE_LAYOUT *layout) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_layout"); + return; + } + if (ctx->klass->ise_get_layout ) ctx->klass->ise_get_layout (ctx, layout); +} + +EAPI void +ecore_imf_context_ise_reset (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_reset"); + return; + } + + if (ctx->klass->ise_reset) ctx->klass->ise_reset(ctx); +} + +EAPI void +ecore_imf_context_ise_set_screen_orientation (Ecore_IMF_Context *ctx, int orientation) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_screen_orientation"); + return; + } + + if (ctx->klass->ise_set_screen_orientation) ctx->klass->ise_set_screen_orientation(ctx, orientation); +} + +EAPI void +ecore_imf_context_ise_get_active_isename (Ecore_IMF_Context *ctx, char* name) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_active_isename"); + return; + } + + if (!name) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_get_active_isename) ctx->klass->ise_get_active_isename(ctx, name); +} + +EAPI void +ecore_imf_context_ise_set_active_ise_by_name (Ecore_IMF_Context *ctx, const char* name) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_active_ise_by_name"); + return; + } + if (!name) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_active_ise_by_name) ctx->klass->ise_set_active_ise_by_name(ctx, name); +} + +EAPI void +ecore_imf_context_ise_set_active_ise_by_uuid (Ecore_IMF_Context *ctx, const char* uuid) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_active_ise_by_uuid"); + return; + } + if (!uuid) + { + printf ("input parameters error!!! \n"); + return; + } + + if (ctx->klass->ise_set_active_ise_by_uuid) ctx->klass->ise_set_active_ise_by_uuid(ctx, uuid); +} + +EAPI int +ecore_imf_context_ise_get_iselist (Ecore_IMF_Context *ctx, char*** iselist) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_iselist"); + return -1; + } + + if (ctx->klass->ise_get_iselist) { + return ctx->klass->ise_get_iselist(ctx,iselist); + } + else + return -1; +} + + +EAPI void +ecore_imf_context_ise_get_ise_state (Ecore_IMF_Context *ctx, ISE_STATE *state) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_get_ise_state"); + return; + } + if (ctx->klass->ise_get_ise_state) ctx->klass->ise_get_ise_state(ctx, state); +} +#if 0 +EAPI void +ecore_imf_context_ise_set_cursor_location (Ecore_IMF_Context *ctx, Ecore_X_Rectangle *area) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_cursor_location"); + return; + } + if (ctx->klass->ise_set_cursor_location) ctx->klass->ise_set_cursor_location(ctx, area); +} + +EAPI void +ecore_imf_context_ise_set_ime_window_rectangle (Ecore_IMF_Context *ctx, Ecore_X_Rectangle *rect) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_set_ime_window_rectangle"); + return; + } + if (ctx->klass->ise_set_ime_window_rectangle) ctx->klass->ise_set_ime_window_rectangle(ctx, rect); +} +#endif + +EAPI int +ecore_imf_context_ise_state_add_listener (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT,int), void *data) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_state_add_listener"); + return -1; + } + + printf("[Warning] This API will be deprecated. Use ecore_imf_context_ise_event_callback_set instead.\n"); + + if (ctx->klass->ise_state_add_listener) { + return ctx->klass->ise_state_add_listener(ctx, plistenerCallBackFunc, data); + } + else + return -1; +} + +EAPI void +ecore_imf_context_ise_state_remove_listener (Ecore_IMF_Context *ctx, int listener_id) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_state_remove_listener"); + return; + } + + printf("[Warning] This API will be deprecated. Use ecore_imf_context_ise_event_callback_set instead.\n"); + + if (ctx->klass->ise_state_remove_listener) ctx->klass->ise_state_remove_listener(ctx, listener_id); +} + +EAPI int +ecore_imf_context_ise_state_change_listener (Ecore_IMF_Context *ctx, void (*plistenerCallBackFunc) (ISE_EVENT, int)) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_state_change_listener"); + return -1; + } + + printf("[Warning] This API will be deprecated. Use ecore_imf_context_ise_event_callback_set instead.\n"); + + if (ctx->klass->ise_state_change_listener) { + return ctx->klass->ise_state_change_listener(ctx, plistenerCallBackFunc); + } + else + return -1; +} + +EAPI void +ecore_imf_context_ise_event_callback_set (Ecore_IMF_Context *ctx, void (*pEventCallBackFunc) (void *,ISE_EVENT,int), void *data) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_event_callback_set"); + return; + } + + if (ctx->klass->ise_event_callback_set) { + ctx->klass->ise_event_callback_set(ctx, pEventCallBackFunc, data); + } +} + +EAPI void +ecore_imf_context_ise_initialize (Ecore_IMF_Context *ctx, Evas_Object * mainwindow) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_ise_initialize"); + return; + } + + if (ctx->klass->ise_initialize) ctx->klass->ise_initialize(ctx, mainwindow); +} + +EAPI const char* +ecore_imf_context_get_focused_preedit_string (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,"ecore_imf_context_get_focused_preedit_string"); + return NULL; + } + + if (ctx->klass->get_focused_preedit_string) + return ctx->klass->get_focused_preedit_string(ctx); + + return NULL; +} diff --git a/src/lib/ecore_imf/keydefs.h b/src/lib/ecore_imf/keydefs.h new file mode 100755 index 0000000..a8144ce --- /dev/null +++ b/src/lib/ecore_imf/keydefs.h @@ -0,0 +1,150 @@ +#ifndef _KEYDEFS_H_ +#define _KETDEFS_H_ + +#define ISE_KEY_RESERVED 0 +#define ISE_KEY_ESC 1 +#define ISE_KEY_1 2 +#define ISE_KEY_2 3 +#define ISE_KEY_3 4 +#define ISE_KEY_4 5 +#define ISE_KEY_5 6 +#define ISE_KEY_6 7 +#define ISE_KEY_7 8 +#define ISE_KEY_8 9 +#define ISE_KEY_9 10 +#define ISE_KEY_0 11 +#define ISE_KEY_MINUS 12 +#define ISE_KEY_EQUAL 13 +#define ISE_KEY_BACKSPACE 14 +#define ISE_KEY_TAB 15 +#define ISE_KEY_Q 16 +#define ISE_KEY_W 17 +#define ISE_KEY_E 18 +#define ISE_KEY_R 19 +#define ISE_KEY_T 20 +#define ISE_KEY_Y 21 +#define ISE_KEY_U 22 +#define ISE_KEY_I 23 +#define ISE_KEY_O 24 +#define ISE_KEY_P 25 +#define ISE_KEY_LEFTBRACE 26 +#define ISE_KEY_RIGHTBRACE 27 +#define ISE_KEY_ENTER 28 +#define ISE_KEY_LEFTCTRL 29 +#define ISE_KEY_A 30 +#define ISE_KEY_S 31 +#define ISE_KEY_D 32 +#define ISE_KEY_F 33 +#define ISE_KEY_G 34 +#define ISE_KEY_H 35 +#define ISE_KEY_J 36 +#define ISE_KEY_K 37 +#define ISE_KEY_L 38 +#define ISE_KEY_SEMICOLON 39 +#define ISE_KEY_APOSTROPHE 40 +#define ISE_KEY_GRAVE 41 +#define ISE_KEY_LEFTSHIFT 42 +#define ISE_KEY_BACKSLASH 43 +#define ISE_KEY_Z 44 +#define ISE_KEY_X 45 +#define ISE_KEY_C 46 +#define ISE_KEY_V 47 +#define ISE_KEY_B 48 +#define ISE_KEY_N 49 +#define ISE_KEY_M 50 +#define ISE_KEY_COMMA 51 +#define ISE_KEY_DOT 52 +#define ISE_KEY_SLASH 53 +#define ISE_KEY_RIGHTSHIFT 54 +#define ISE_KEY_KPASTERISK 55 +#define ISE_KEY_LEFTALT 56 +#define ISE_KEY_SPACE 57 +#define ISE_KEY_CAPSLOCK 58 +#define ISE_KEY_F1 59 +#define ISE_KEY_F2 60 +#define ISE_KEY_F3 61 +#define ISE_KEY_F4 62 +#define ISE_KEY_F5 63 +#define ISE_KEY_F6 64 +#define ISE_KEY_F7 65 +#define ISE_KEY_F8 66 +#define ISE_KEY_F9 67 +#define ISE_KEY_F10 68 +#define ISE_KEY_NUMLOCK 69 +#define ISE_KEY_SCROLLLOCK 70 +#define ISE_KEY_KP7 71 +#define ISE_KEY_KP8 72 +#define ISE_KEY_KP9 73 +#define ISE_KEY_KPMINUS 74 +#define ISE_KEY_KP4 75 +#define ISE_KEY_KP5 76 +#define ISE_KEY_KP6 77 +#define ISE_KEY_KPPLUS 78 +#define ISE_KEY_KP1 79 +#define ISE_KEY_KP2 80 +#define ISE_KEY_KP3 81 +#define ISE_KEY_KP0 82 +#define ISE_KEY_KPDOT 83 + +#define ISE_KEY_ZENKAKUHANKAKU 85 +#define ISE_KEY_102ND 86 +#define ISE_KEY_F11 87 +#define ISE_KEY_F12 88 +#define ISE_KEY_RO 89 +#define ISE_KEY_KATAKANA 90 +#define ISE_KEY_HIRAGANA 91 +#define ISE_KEY_HENKAN 92 +#define ISE_KEY_KATAKANAHIRAGANA 93 +#define ISE_KEY_MUHENKAN 94 +#define ISE_KEY_KPJPCOMMA 95 +#define ISE_KEY_KPENTER 96 +#define ISE_KEY_RIGHTCTRL 97 +#define ISE_KEY_KPSLASH 98 +#define ISE_KEY_SYSRQ 99 +#define ISE_KEY_RIGHTALT 100 +#define ISE_KEY_LINEFEED 101 +#define ISE_KEY_HOME 102 +#define ISE_KEY_UP 103 +#define ISE_KEY_PAGEUP 104 +#define ISE_KEY_LEFT 105 +#define ISE_KEY_RIGHT 106 +#define ISE_KEY_END 107 +#define ISE_KEY_DOWN 108 +#define ISE_KEY_PAGEDOWN 109 +#define ISE_KEY_INSERT 110 +#define ISE_KEY_DELETE 111 +#define ISE_KEY_MACRO 112 +#define ISE_KEY_MUTE 113 +#define ISE_KEY_VOLUMEDOWN 114 +#define ISE_KEY_VOLUMEUP 115 +#define ISE_KEY_POWER 116 /* SC System Power Down */ +#define ISE_KEY_KPEQUAL 117 +#define ISE_KEY_KPPLUSMINUS 118 +#define ISE_KEY_PAUSE 119 + +#define ISE_KEY_KPCOMMA 121 +#define ISE_KEY_HANGEUL 122 +#define ISE_KEY_HANGUEL KEY_HANGEUL +#define ISE_KEY_HANJA 123 +#define ISE_KEY_YEN 124 +#define ISE_KEY_LEFTMETA 125 +#define ISE_KEY_RIGHTMETA 126 +#define ISE_KEY_COMPOSE 127 + +#define ISE_KEY_EXCLAM 129 +#define ISE_KEY_AT 130 +#define ISE_KEY_SHARP 131 +#define ISE_KEY_DOLLAR 132 +#define ISE_KEY_PERCENT 133 +#define ISE_KEY_CARET 134 +#define ISE_KEY_AMPERSAND 135 +#define ISE_KEY_ASTERISK 136 +#define ISE_KEY_LPAREN 137 +#define ISE_KEY_RPAREN 138 + +#define ISE_KEY_MODECHANGE 247 +#define ISE_KEY_SETTING 248 + +#define ISE_KEY_MAX 255 + +#endif -- 2.7.4