From 4b5ed04559aa1a782a96f945b725b452c05e4d60 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 14 Aug 2013 18:17:06 +0900 Subject: [PATCH] Edje: add edje_object_part_text_input_panel_show_on_demand_set/get() --- ChangeLog | 6 +++++- NEWS | 1 + src/lib/edje/Edje_Eo.h | 28 ++++++++++++++++++++++++++ src/lib/edje/Edje_Legacy.h | 21 +++++++++++++++++++ src/lib/edje/edje_entry.c | 38 +++++++++++++++++++++++++++++++++++ src/lib/edje/edje_private.h | 4 ++++ src/lib/edje/edje_smart.c | 4 ++++ src/lib/edje/edje_util.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 150 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8d50d51..803be7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2013-08-14 Jihoon Kim + + * Edje: add edje_object_part_text_input_panel_show_on_demand_set/get(). + 2013-08-13 Jihoon Kim - * Ecore_IMF: add ecore_imf_context_input_panel_on_demand_set/get() + * Ecore_IMF: add ecore_imf_context_input_panel_on_demand_set/get(). 2013-08-09 Cedric Bail diff --git a/NEWS b/NEWS index 6da6d0e..afbf966 100644 --- a/NEWS +++ b/NEWS @@ -129,6 +129,7 @@ Additions: - Add threshold support to Edje draggable part. - Reduce load time of Edje_Object using Evas_Object_Textblock and many styles. - Add edje_object_mmap_set. + - Add edje_object_part_text_input_panel_show_on_demand_set/get(). * Eeze: - Add a dummy libmount replacement for when libmount is not there. * Ecore_Con: diff --git a/src/lib/edje/Edje_Eo.h b/src/lib/edje/Edje_Eo.h index 6678a96..410709a 100644 --- a/src/lib/edje/Edje_Eo.h +++ b/src/lib/edje/Edje_Eo.h @@ -79,6 +79,8 @@ enum EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_TYPE_GET, EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_SET, EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_GET, + EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_SET, + EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_GET, EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_ADD, EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL, EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL_FULL, @@ -491,6 +493,32 @@ enum #define edje_obj_part_text_input_panel_return_key_disabled_get(part, ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_GET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(Eina_Bool *, ret) /** + * @def edje_obj_part_text_input_panel_show_on_demand_set + * @since 1.8 + * + * @brief Set the attribute to show the input panel in case of only an user's explicit Mouse Up event. + * + * @param[in] part + * @param[in] ondemand + * + * @see edje_object_part_text_input_panel_show_on_demand_set + */ +#define edje_obj_part_text_input_panel_show_on_demand_set(part, ondemand) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_SET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(Eina_Bool, ondemand) + +/** + * @def edje_obj_part_text_input_panel_show_on_demand_get + * @since 1.8 + * + * @brief Get the attribute to show the input panel in case of only an user's explicit Mouse Up event. + * + * @param[in] part + * @param[out] ret + * + * @see edje_object_part_text_input_panel_show_on_demand_get + */ +#define edje_obj_part_text_input_panel_show_on_demand_get(part, ret) EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_GET), EO_TYPECHECK(const char *, part), EO_TYPECHECK(Eina_Bool *, ret) + +/** * @def edje_obj_text_insert_filter_callback_add * @since 1.8 * diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index 196e498..64e4f88 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -1241,6 +1241,27 @@ EAPI void edje_object_part_text_input_panel_return_key_disabled_set( EAPI Eina_Bool edje_object_part_text_input_panel_return_key_disabled_get(const Evas_Object *obj, const char *part); /** + * Set the attribute to show the input panel in case of only an user's explicit Mouse Up event. + * It doesn't request to show the input panel even though it has focus. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param ondemand If true, the input panel will be shown in case of only Mouse up event. (Focus event will be ignored.) + * @since 1.8.0 + */ +EAPI void edje_object_part_text_input_panel_show_on_demand_set(Evas_Object *obj, const char *part, Eina_Bool ondemand); + +/** + * Get the attribute to show the input panel in case of only an user's explicit Mouse Up event. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @return @c EINA_TRUE if the input panel will be shown in case of only Mouse up event. + * @since 1.8.0 + */ +EAPI Eina_Bool edje_object_part_text_input_panel_show_on_demand_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/edje_entry.c b/src/lib/edje/edje_entry.c index 159a2b4..d7490f9 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -3541,6 +3541,44 @@ _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp) #endif } +#ifdef HAVE_ECORE_IMF +void +_edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand) +#else +void +_edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand __UNUSED__) +#endif +{ + 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_show_on_demand_set(en->imf_context, ondemand); +#endif +} + +Eina_Bool +_edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp) +{ + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return EINA_FALSE; + en = rp->typedata.text->entry_data; + if (!en) return EINA_FALSE; +#ifdef HAVE_ECORE_IMF + if (en->imf_context) { + Eina_Bool ret = ecore_imf_context_input_panel_show_on_demand_get(en->imf_context); + return ret; + } +#endif + return EINA_FALSE; +} + static Evas_Textblock_Cursor * _cursor_get(Edje_Real_Part *rp, Edje_Cursor cur) { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 608aa01..456a690 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2326,6 +2326,8 @@ void _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_ 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_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand); +Eina_Bool _edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp); void _edje_external_init(void); void _edje_external_shutdown(void); @@ -2487,6 +2489,8 @@ void _part_text_input_panel_return_key_type_set(Eo *obj, void *_pd, va_list *lis void _part_text_input_panel_return_key_type_get(Eo *obj, void *_pd, va_list *list); void _part_text_input_panel_return_key_disabled_set(Eo *obj, void *_pd, va_list *list); void _part_text_input_panel_return_key_disabled_get(Eo *obj, void *_pd, va_list *list); +void _part_text_input_panel_show_on_demand_set(Eo *obj, void *_pd, va_list *list); +void _part_text_input_panel_show_on_demand_get(Eo *obj, void *_pd, va_list *list); void _text_insert_filter_callback_add(Eo *obj, void *_pd, va_list *list); void _text_insert_filter_callback_del(Eo *obj, void *_pd, va_list *list); void _text_insert_filter_callback_del_full(Eo *obj, void *_pd, va_list *list); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index de3ee80..2a75e43 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -466,6 +466,8 @@ _edje_smart_class_constructor(Eo_Class *klass) EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_TYPE_GET), _part_text_input_panel_return_key_type_get), EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_SET), _part_text_input_panel_return_key_disabled_set), EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_GET), _part_text_input_panel_return_key_disabled_get), + EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_SET), _part_text_input_panel_show_on_demand_set), + EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_GET), _part_text_input_panel_show_on_demand_get), EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_ADD), _text_insert_filter_callback_add), EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL), _text_insert_filter_callback_del), EO_OP_FUNC(EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL_FULL), _text_insert_filter_callback_del_full), @@ -612,6 +614,8 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_TYPE_GET, "Get the return key type."), EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_SET, "Set the return key on the input panel to be disabled."), EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_RETURN_KEY_DISABLED_GET, "Get whether the return key on the input panel should be disabled or not."), + EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_SET, "Set the attribute to show the input panel in case of only an user's explicit Mouse Up event."), + EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_PART_TEXT_INPUT_PANEL_SHOW_ON_DEMAND_GET, "Get the attribute to show the input panel in case of only an user's explicit Mouse Up event."), EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_ADD, "Add a filter function for newly inserted text."), EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL, "Delete a function from the filter list."), EO_OP_DESCRIPTION(EDJE_OBJ_SUB_ID_TEXT_INSERT_FILTER_CALLBACK_DEL_FULL, "Delete a function and matching user data from the filter list."), diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 41550d0..2bfbf9d 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -3135,6 +3135,55 @@ _part_text_input_panel_return_key_disabled_get(Eo *obj EINA_UNUSED, void *_pd, v } EAPI void +edje_object_part_text_input_panel_show_on_demand_set(Evas_Object *obj, const char *part, Eina_Bool ondemand) +{ + if (!obj) return; + eo_do(obj, edje_obj_part_text_input_panel_show_on_demand_set(part, ondemand)); +} + +void _part_text_input_panel_show_on_demand_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + const char *part = va_arg(*list, const char *); + Eina_Bool ondemand = va_arg(*list, int); + Edje *ed = _pd; + 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_panel_show_on_demand_set(rp, ondemand); + } +} + +EAPI Eina_Bool +edje_object_part_text_input_panel_show_on_demand_get(const Evas_Object *obj, const char *part) +{ + if (!obj) return EINA_FALSE; + Eina_Bool ret = EINA_FALSE; + eo_do((Eo *)obj, edje_obj_part_text_input_panel_show_on_demand_get(part, &ret)); + return ret; +} + +void _part_text_input_panel_show_on_demand_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) +{ + const char *part = va_arg(*list, const char *); + Eina_Bool *ret = va_arg(*list, Eina_Bool *); + Edje *ed = _pd; + Edje_Real_Part *rp; + *ret = EINA_FALSE; + + 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) + { + *ret = _edje_entry_input_panel_show_on_demand_get(rp); + } +} + +EAPI void edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data) { if (!obj) return; -- 2.7.4