jihoon pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=715da43d3ae2691199eaaae6bd3d7883081a342c
commit 715da43d3ae2691199eaaae6bd3d7883081a342c Author: Jihoon Kim <jihoon48....@samsung.com> Date: Mon Sep 1 19:01:54 2014 +0900 Add edje_object_part_text_input_hint_set/get API Sets or get the input hint which allows input methods to fine-tune their behavior. --- src/lib/edje/Edje_Common.h | 7 +++++++ src/lib/edje/edje_entry.c | 34 ++++++++++++++++++++++++++++++++++ src/lib/edje/edje_object.eo | 22 ++++++++++++++++++++++ src/lib/edje/edje_private.h | 2 ++ src/lib/edje/edje_util.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+) diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h index 13269b0..53e0130 100644 --- a/src/lib/edje/Edje_Common.h +++ b/src/lib/edje/Edje_Common.h @@ -1007,6 +1007,13 @@ typedef enum _Edje_Input_Panel_Layout EDJE_INPUT_PANEL_LAYOUT_EMOTICON /**< Emoticon layout @since 1.10 */ } Edje_Input_Panel_Layout; +typedef enum +{ + EDJE_INPUT_HINT_NONE = 0, /**< No active hints @since 1.12 */ + EDJE_INPUT_HINT_AUTO_COMPLETE = 1 << 0, /**< Suggest word auto completion @since 1.12 */ + EDJE_INPUT_HINT_SENSITIVE_DATA = 1 << 1, /**< Typed text should not be stored. @since 1.12 */ +} Edje_Input_Hints; + enum { EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL, diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index da7ae5c..438e6d5 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -3192,6 +3192,40 @@ _edje_entry_prediction_allow_get(Edje_Real_Part *rp) } void +_edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + if (!en) return; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + ecore_imf_context_input_hint_set(en->imf_context, input_hints); +#else + (void) input_hints; +#endif +} + +Edje_Input_Hints +_edje_entry_input_hint_get(const Edje_Real_Part *rp) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return EDJE_INPUT_HINT_NONE; + en = rp->typedata.text->entry_data; + if (!en) return EDJE_INPUT_HINT_NONE; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + return ecore_imf_context_input_hint_get(en->imf_context); +#endif + + return EDJE_INPUT_HINT_NONE; +} + +void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled) { Entry *en; diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index cdb7ba8..8d2fa3d 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -2013,6 +2013,28 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) @in const(char)* part; /*@ The part name */ } } + part_text_input_hint_set { + /*@ + Sets the input hint which allows input methods to fine-tune their behavior. + + @since 1.12.0 */ + + params { + @in const(char)* part; /*@ The part name */ + @in Edje_Input_Hints input_hints; /*@ input hints */ + } + } + part_text_input_hint_get @const { + /*@ + Gets the value of input hint + + @return The value of input hint + @since 1.12.0 */ + return: Edje_Input_Hints; + params { + @in const(char)* part; /*@ The part name */ + } + } part_text_selection_get @const { /*@ @brief Return the selection text of the object part. diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 3cf3beb..4148abf 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2358,6 +2358,8 @@ void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_ Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp); void _edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction); Eina_Bool _edje_entry_prediction_allow_get(Edje_Real_Part *rp); +void _edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints); +Edje_Input_Hints _edje_entry_input_hint_get(const 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_entry_input_panel_show(Edje_Real_Part *rp); diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 72e0bec..829890f 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -2131,6 +2131,35 @@ _edje_object_part_text_prediction_allow_get(Eo *obj EINA_UNUSED, Edje *ed, const } EOLIAN void +_edje_object_part_text_input_hint_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Input_Hints input_hints) +{ + Edje_Real_Part *rp; + + 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_hint_set(rp, input_hints); + } +} + +EOLIAN Edje_Input_Hints +_edje_object_part_text_input_hint_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part) +{ + Edje_Real_Part *rp; + + 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_hint_get(rp); + } + return EINA_FALSE; +} + +EOLIAN void _edje_object_part_text_input_panel_enabled_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool enabled) { Edje_Real_Part *rp; --