From 8dda0883c1835e0a2bea850bcd9ab2d66d58e665 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 27 Mar 2013 17:28:53 +0900 Subject: [PATCH] edje: Add edje_object_part_text_input_panel_layout_variation_set/get API --- ChangeLog | 1 + NEWS | 1 + src/lib/edje/Edje.h | 36 ++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_entry.c | 34 ++++++++++++++++++++++++++++++++++ src/lib/edje/edje_private.h | 2 ++ src/lib/edje/edje_util.c | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 107 insertions(+) diff --git a/ChangeLog b/ChangeLog index 731b5f9f81..680af607c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2013-03-27 Jihoon Kim * Add ecore_imf_context_input_panel_variation_set/get API. + * Add edje_object_part_text_input_panel_layout_variation_set/get API. 2013-03-25 Cedric Bail diff --git a/NEWS b/NEWS index 84c205f0bd..31f8b5b8b7 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,7 @@ Additions: * Ecore_Con: Add systemd socket activation support (ECORE_CON_SOCKET_ACTIVATE). * Ecore: notify systemd that we are ready as soon as the main loop is running. * ecore_imf: Add ecore_imf_context_input_panel_layout_variation_set/get API + * Add edje_object_part_text_input_panel_layout_variation_set/get API Deprecations: * ecore_x: diff --git a/src/lib/edje/Edje.h b/src/lib/edje/Edje.h index 5ae4711f91..749b1d46b8 100644 --- a/src/lib/edje/Edje.h +++ b/src/lib/edje/Edje.h @@ -5227,6 +5227,14 @@ 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; +enum +{ + EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL, + EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED, + EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_DECIMAL, + EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_SIGNED_AND_DECIMAL +}; + typedef void (*Edje_Text_Filter_Cb) (void *data, Evas_Object *obj, const char *part, Edje_Text_Filter_Type type, char **text); typedef void (*Edje_Markup_Filter_Cb) (void *data, Evas_Object *obj, const char *part, char **text); typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, const char *part, const char *item); @@ -5345,6 +5353,34 @@ EAPI void edje_object_part_text_input_panel_layout_set (Evas_Ob */ EAPI Edje_Input_Panel_Layout edje_object_part_text_input_panel_layout_get (const Evas_Object *obj, const char *part); +/** + * @brief Set the layout variation of the input panel. + * + * The layout variation of the input panel or virtual keyboard can make it easier or + * harder to enter content. This allows you to hint what kind of input you + * are expecting to enter and thus have the input panel automatically + * come up with the right mode. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param variation layout variation type + * @since 1.8 + */ +EAPI void edje_object_part_text_input_panel_layout_variation_set(Evas_Object *obj, const char *part, int variation); + +/** + * @brief Get the layout variation of the input panel. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return Layout variation type of the input panel + * + * @see edje_object_part_text_input_panel_layout_variation_set + * @since 1.8 + */ +EAPI int edje_object_part_text_input_panel_layout_variation_get(const Evas_Object *obj, const char *part); + /** * @brief Set the autocapitalization type on the immodule. * diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index 82f5bb0253..4eaf0a79d9 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -3594,6 +3594,40 @@ _edje_entry_input_panel_layout_get(Edje_Real_Part *rp) #endif } +void +_edje_entry_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation) +{ + 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_panel_layout_variation_set(en->imf_context, variation); +#else + (void) variation; +#endif +} + +int +_edje_entry_input_panel_layout_variation_get(Edje_Real_Part *rp) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return 0; + en = rp->typedata.text->entry_data; + if (!en) return 0; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) + return ecore_imf_context_input_panel_layout_variation_get(en->imf_context); +#endif + + return 0; +} + void _edje_entry_imf_context_reset(Edje_Real_Part *rp) { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index e79fee9e61..452e56dcc4 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2271,6 +2271,8 @@ int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur); void _edje_entry_imf_context_reset(Edje_Real_Part *rp); 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_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation); +int _edje_entry_input_panel_layout_variation_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_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction); diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index a1e9508ff2..83baf0dc94 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -2721,6 +2721,39 @@ _part_text_input_panel_layout_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) } } +EAPI void +edje_object_part_text_input_panel_layout_variation_set(Evas_Object *obj, const char *part, int variation) +{ + 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_layout_variation_set(rp, variation); + } +} + +EAPI int +edje_object_part_text_input_panel_layout_variation_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return 0; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return 0; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + return _edje_entry_input_panel_layout_variation_get(rp); + } + return 0; +} + EAPI void edje_object_part_text_autocapital_type_set(Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type) {