From 8de04395021509ba8835db2e946fb0975611b872 Mon Sep 17 00:00:00 2001 From: jihoon Date: Wed, 15 Feb 2012 08:21:11 +0000 Subject: [PATCH] edje/edje_entry: add edje_object_part_text_input_panel_language_set/get edje_object_part_text_input_panel_imdata_set/get edje_object_part_text_input_panel_return_key_type_set/get edje_object_part_text_input_panel_return_key_disabled_set/get git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@67966 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 7 +++ src/lib/Edje.h | 112 ++++++++++++++++++++++++++++++++++++++++++ src/lib/edje_entry.c | 91 ++++++++++++++++++++++++++++++++++ src/lib/edje_private.h | 8 +++ src/lib/edje_util.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 349 insertions(+) diff --git a/ChangeLog b/ChangeLog index 00d9c78..24dc6ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -348,3 +348,10 @@ 2012-02-14 Cedric Bail * add a way to disable signal broadcasting introduced in edje 1.1. + +2012-02-15 Jihoon Kim + + * add edje_object_part_text_input_panel_language_set/get + edje_object_part_text_input_panel_imdata_set/get + edje_object_part_text_input_panel_return_key_type_set/get + edje_object_part_text_input_panel_return_key_disabled_set/get diff --git a/src/lib/Edje.h b/src/lib/Edje.h index cfa6108..9b52a77 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -817,6 +817,24 @@ typedef enum _Edje_Input_Panel_Layout EDJE_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */ } Edje_Input_Panel_Layout; +typedef enum _Edje_Input_Panel_Lang +{ + EDJE_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ + EDJE_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ +} Edje_Input_Panel_Lang; + +typedef enum _Edje_Input_Panel_Return_Key_Type +{ + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DONE, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_GO, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, + EDJE_INPUT_PANEL_RETURN_KEY_TYPE_SEND +} Edje_Input_Panel_Return_Key_Type; + /** * @brief Converts type identifier to string nicer representation. * @@ -2966,6 +2984,100 @@ EAPI void edje_object_part_text_input_panel_show(const Evas_Object * EAPI void edje_object_part_text_input_panel_hide(const Evas_Object *obj, const char *part); /** + * Set the language mode of the input panel. + * + * This API can be used if you want to show the Alphabet keyboard. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param lang the language to be set to the input panel. + * @since 1.2.0 + */ +EAPI void edje_object_part_text_input_panel_language_set(Evas_Object *obj, const char *part, Edje_Input_Panel_Lang lang); + +/** + * Get the language mode of the input panel. + * + * See @ref edje_object_part_text_input_panel_language_set for more details. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return input panel language type + * @since 1.2.0 + */ +EAPI Edje_Input_Panel_Lang edje_object_part_text_input_panel_language_get(const Evas_Object *obj, const char *part); + +/** + * Set the input panel-specific data to deliver to the input panel. + * + * This API is used by applications to deliver specific data to the input panel. + * The data format MUST be negotiated by both application and the input panel. + * The size and format of data are defined by the input panel. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param data The specific data to be set to the input panel. + * @param len the length of data, in bytes, to send to the input panel + * @since 1.2.0 + */ +EAPI void edje_object_part_text_input_panel_imdata_set(Evas_Object *obj, const char *part, const void *data, int len); + +/** + * Get the specific data of the current active input panel. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param data The specific data to be got from the input panel + * @param len The length of data + * @since 1.2.0 + */ +EAPI void edje_object_part_text_input_panel_imdata_get(const Evas_Object *obj, const char *part, void *data, int *len); + +/** + * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. + * + * An input panel displays the string or icon associated with this type + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param return_key_type The type of "return" key on the input panel + * @since 1.2.0 + */ +EAPI void edje_object_part_text_input_panel_return_key_type_set(Evas_Object *obj, const char *part, Edje_Input_Panel_Return_Key_Type return_key_type); + +/** + * Get the "return" key type. + * + * @see edje_object_part_text_input_panel_return_key_type_set() for more details + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The type of "return" key on the input panel + * @since 1.2.0 + */ +EAPI Edje_Input_Panel_Return_Key_Type edje_object_part_text_input_panel_return_key_type_get(const Evas_Object *obj, const char *part); + +/** + * Set the return key on the input panel to be disabled. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param disabled The state + * @since 1.2.0 + */ +EAPI void edje_object_part_text_input_panel_return_key_disabled_set(Evas_Object *obj, const char *part, Eina_Bool disabled); + +/** + * Get whether the return key on the input panel should be disabled or not. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return EINA_TRUE if it should be disabled + * @since 1.2.0 + */ +EAPI Eina_Bool edje_object_part_text_input_panel_return_key_disabled_get(const Evas_Object *obj, const char *part); + +/** * Add a filter function for newly inserted text. * * Whenever text is inserted (not the same as set) into the given @p part, diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index f336792..0ec33a1 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -28,6 +28,7 @@ struct _Entry Eina_List *anchorlist; Eina_List *itemlist; char *selection; + Edje_Input_Panel_Lang input_panel_lang; Eina_Bool selecting : 1; Eina_Bool have_selection : 1; Eina_Bool select_allow : 1; @@ -2649,6 +2650,96 @@ _edje_entry_input_panel_hide(Edje_Real_Part *rp) #endif } +void +_edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang) +{ + Entry *en = rp->entry_data; + + if (!en) return; + en->input_panel_lang = lang; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_language_set(en->imf_context, lang); +#endif +} + +Edje_Input_Panel_Lang +_edje_entry_input_panel_language_get(Edje_Real_Part *rp) +{ + Entry *en = rp->entry_data; + if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC; + + return en->input_panel_lang; +} + +void +_edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len) +{ + Entry *en = rp->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len); +#endif +} + +void +_edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len) +{ + Entry *en = rp->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len); +#endif +} + +void +_edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type) +{ + Entry *en = rp->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_return_key_type_set(en->imf_context, return_key_type); +#endif +} + +Edje_Input_Panel_Return_Key_Type +_edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp) +{ + Entry *en = rp->entry_data; + if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + return ecore_imf_context_input_panel_return_key_type_get(en->imf_context); +#endif + return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; +} + +void +_edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled) +{ + Entry *en = rp->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled); +#endif +} + +Eina_Bool +_edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp) +{ + Entry *en = rp->entry_data; + if (!en) return EINA_FALSE; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + return ecore_imf_context_input_panel_return_key_disabled_get(en->imf_context); +#endif + return EINA_FALSE; +} + static Evas_Textblock_Cursor * _cursor_get(Edje_Real_Part *rp, Edje_Cursor cur) { diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index d5926e3..ecb8234 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -1952,6 +1952,14 @@ void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled); Eina_Bool _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp); void _edje_entry_input_panel_show(Edje_Real_Part *rp); void _edje_entry_input_panel_hide(Edje_Real_Part *rp); +void _edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang); +Edje_Input_Panel_Lang _edje_entry_input_panel_language_get(Edje_Real_Part *rp); +void _edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len); +void _edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len); +void _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type); +Edje_Input_Panel_Return_Key_Type _edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp); +void _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled); +Eina_Bool _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp); void _edje_external_init(); void _edje_external_shutdown(); diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index 2ef1125..edca372 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -1954,6 +1954,137 @@ edje_object_part_text_input_panel_hide(const Evas_Object *obj, const char *part) } EAPI void +edje_object_part_text_input_panel_language_set(Evas_Object *obj, const char *part, Edje_Input_Panel_Lang lang) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_input_panel_language_set(rp, lang); + } +} + +EAPI Edje_Input_Panel_Lang +edje_object_part_text_input_panel_language_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EDJE_INPUT_PANEL_LANG_AUTOMATIC; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return EDJE_INPUT_PANEL_LANG_AUTOMATIC; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + return _edje_entry_input_panel_language_get(rp); + } + return EDJE_INPUT_PANEL_LANG_AUTOMATIC; +} + +EAPI void +edje_object_part_text_input_panel_imdata_set(Evas_Object *obj, const char *part, const void *data, int len) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_input_panel_imdata_set(rp, data, len); + } +} + +EAPI void +edje_object_part_text_input_panel_imdata_get(const Evas_Object *obj, const char *part, void *data, int *len) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_input_panel_imdata_get(rp, data, len); + } +} + +EAPI void +edje_object_part_text_input_panel_return_key_type_set(Evas_Object *obj, const char *part, Edje_Input_Panel_Return_Key_Type return_key_type) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_input_panel_return_key_type_set(rp, return_key_type); + } +} + +EAPI Edje_Input_Panel_Return_Key_Type +edje_object_part_text_input_panel_return_key_type_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + return _edje_entry_input_panel_return_key_type_get(rp); + } + return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; +} + +EAPI void +edje_object_part_text_input_panel_return_key_disabled_set(Evas_Object *obj, const char *part, Eina_Bool disabled) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_input_panel_return_key_disabled_set(rp, disabled); + } +} + +EAPI Eina_Bool +edje_object_part_text_input_panel_return_key_disabled_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EINA_FALSE; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return EINA_FALSE; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + return _edje_entry_input_panel_return_key_disabled_get(rp); + } + return EINA_FALSE; +} + +EAPI void edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data) { Edje *ed; -- 2.7.4