diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h index e7b0451e0e..030615b24f 100644 --- a/legacy/edje/src/lib/Edje.h +++ b/legacy/edje/src/lib/Edje.h @@ -768,6 +768,14 @@ typedef enum _Edje_Text_Filter_Type EDJE_TEXT_FILTER_MARKUP = 2 } Edje_Text_Filter_Type; +typedef enum _Edje_Text_Autocapital_Type +{ + EDJE_TEXT_AUTOCAPITAL_TYPE_NONE, + EDJE_TEXT_AUTOCAPITAL_TYPE_WORD, + EDJE_TEXT_AUTOCAPITAL_TYPE_SENTENCE, + EDJE_TEXT_AUTOCAPITAL_TYPE_ALLCHARACTER +} Edje_Text_Autocapital_Type; + /** * The possible types the parameters of an EXTERNAL part can be. */ @@ -2817,6 +2825,47 @@ EAPI void edje_object_part_text_input_panel_layout_set (const Evas_O */ EAPI Edje_Input_Panel_Layout edje_object_part_text_input_panel_layout_get (const Evas_Object *obj, const char *part); +/** + * @brief Set the autocapitalization type on the immodule. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param autocapital_type The type of autocapitalization + * @since 1.1.0 + */ +EAPI void edje_object_part_text_autocapital_type_set (const Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type); + +/** + * @brief Retrieves the autocapitalization type + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return The autocapitalization type + * @since 1.1.0 + */ +EAPI Edje_Text_Autocapital_Type edje_object_part_text_autocapital_type_get (const Evas_Object *obj, const char *part); + +/** + * @brief Sets the attribute to show the input panel automatically. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param enabled If true, the input panel is appeared when entry is clicked or has a focus + * @since 1.1.0 + */ +EAPI void edje_object_part_text_input_panel_enabled_set (const Evas_Object *obj, const char *part, Eina_Bool enabled); + +/** + * @brief Retrieve the attribute to show the input panel automatically. + * @see edje_object_part_text_input_panel_enabled_set + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return EINA_TRUE if it supports or EINA_FALSE otherwise + * @since 1.1.0 + */ +EAPI Eina_Bool edje_object_part_text_input_panel_enabled_get (const Evas_Object *obj, const char *part); + /** * Add a filter function for newly inserted text. * diff --git a/legacy/edje/src/lib/edje_entry.c b/legacy/edje/src/lib/edje_entry.c index b27bfffa27..c047f7747b 100644 --- a/legacy/edje/src/lib/edje_entry.c +++ b/legacy/edje/src/lib/edje_entry.c @@ -2470,6 +2470,59 @@ _edje_entry_select_abort(Edje_Real_Part *rp) } } +void +_edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type) +{ + Entry *en = rp->entry_data; + if (!en) return; + + if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) + autocapital_type = EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; + +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_autocapital_type_set(en->imf_context, autocapital_type); +#endif +} + +Edje_Text_Autocapital_Type +_edje_entry_autocapital_type_get(Edje_Real_Part *rp) +{ + Entry *en = rp->entry_data; + if (!en) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; + +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + return ecore_imf_context_autocapital_type_get(en->imf_context); +#endif + + return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; +} + +void +_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled) +{ + Entry *en = rp->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled); +#endif +} + +Eina_Bool +_edje_entry_input_panel_enabled_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_enabled_get(en->imf_context); +#endif + + return EINA_FALSE; +} + static Evas_Textblock_Cursor * _cursor_get(Edje_Real_Part *rp, Edje_Cursor cur) { diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 4c383bd416..e044e660a7 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -1847,6 +1847,10 @@ void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos); int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur); void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout); Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp); +void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type); +Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp); +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_external_init(); void _edje_external_shutdown(); diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index e1f2687192..77e7d5aae6 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -1758,6 +1758,72 @@ edje_object_part_text_input_panel_layout_get(const Evas_Object *obj, const char return EDJE_INPUT_PANEL_LAYOUT_INVALID; } +EAPI void +edje_object_part_text_autocapital_type_set(const Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_autocapital_type_set(rp, autocapital_type); + } +} + +EAPI Edje_Text_Autocapital_Type +edje_object_part_text_autocapital_type_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + return _edje_entry_autocapital_type_get(rp); + } + return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE; +} + +EAPI void +edje_object_part_text_input_panel_enabled_set(const Evas_Object *obj, const char *part, Eina_Bool enabled) +{ + 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) + { + return _edje_entry_input_panel_enabled_set(rp, enabled); + } +} + +EAPI Eina_Bool +edje_object_part_text_input_panel_enabled_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_enabled_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) {