From d07c842099c57a8bf145114a939876b559b041d3 Mon Sep 17 00:00:00 2001 From: hermet Date: Mon, 9 Jan 2012 10:33:59 +0000 Subject: [PATCH] elementary/entry - more deprecated APIs elm_entry_icon_set/get/unset elm_entry_end_set/get/unset git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66991 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_entry.c | 4 +-- src/edje_externals/elm_entry.c | 4 +-- src/examples/web_example.c | 4 +-- src/lib/elc_scrolled_entry.c | 12 +++---- src/lib/elm_deprecated.h | 81 ++++++++++++++++++++++++++++++++++++++++++ src/lib/elm_entry.c | 56 +++++++++++++++++++---------- src/lib/elm_entry.h | 81 ++---------------------------------------- 7 files changed, 133 insertions(+), 109 deletions(-) diff --git a/src/bin/test_entry.c b/src/bin/test_entry.c index 03070ab..e612ebd 100644 --- a/src/bin/test_entry.c +++ b/src/bin/test_entry.c @@ -437,13 +437,13 @@ test_entry_scrolled(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *ev evas_object_size_hint_min_set(bt, 48, 48); evas_object_color_set(bt, 255, 0, 0, 128); evas_object_show(bt); - elm_entry_icon_set(en, bt); + elm_object_part_content_set(en, "icon", bt); bt = elm_icon_add(win); elm_icon_standard_set(bt, "delete"); evas_object_color_set(bt, 255, 0, 0, 128); evas_object_size_hint_min_set(bt, 48, 48); evas_object_show(bt); - elm_entry_end_set(en, bt); + elm_object_part_content_set(en, "end", bt); elm_object_text_set(en, "scrolled entry with icon and end objects"); evas_object_show(en); elm_box_pack_end(bx, en); diff --git a/src/edje_externals/elm_entry.c b/src/edje_externals/elm_entry.c index 4605696..6ab4936 100644 --- a/src/edje_externals/elm_entry.c +++ b/src/edje_externals/elm_entry.c @@ -56,7 +56,7 @@ external_entry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *fr if (p->label) elm_object_text_set(obj, p->label); if (p->icon) - elm_entry_icon_set(obj, p->icon); + elm_object_part_content_set(obj, "icon", p->icon); if (p->entry) elm_object_text_set(obj, p->entry); if (p->scrollable_exists) @@ -100,7 +100,7 @@ external_entry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ext if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING) { Evas_Object *icon = external_common_param_icon_get(obj, param); - elm_entry_icon_set(obj, icon); + elm_object_part_content_set(obj, "icon", icon); return EINA_TRUE; } } diff --git a/src/examples/web_example.c b/src/examples/web_example.c index 4b561e6..bc7059d 100644 --- a/src/examples/web_example.c +++ b/src/examples/web_example.c @@ -397,7 +397,7 @@ _win_search_trigger_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED box2 = elm_box_add(ad->win); elm_box_horizontal_set(box2, EINA_TRUE); - elm_entry_end_set(entry, box2); + elm_object_part_content_set(entry, "end", box2); btn = elm_button_add(ad->win); elm_box_pack_end(box2, btn); @@ -512,7 +512,7 @@ elm_main(int argc __UNUSED__, char *argv[] __UNUSED__) box2 = elm_box_add(win); elm_box_horizontal_set(box2, EINA_TRUE); - elm_entry_icon_set(url, box2); + elm_object_part_content_set(url, "icon", box2); elm_entry_icon_visible_set(url, EINA_FALSE); btn = elm_button_add(win); diff --git a/src/lib/elc_scrolled_entry.c b/src/lib/elc_scrolled_entry.c index f47e0aa..b6cdd5a 100644 --- a/src/lib/elc_scrolled_entry.c +++ b/src/lib/elc_scrolled_entry.c @@ -10,25 +10,25 @@ elm_scrolled_entry_add(Evas_Object *parent) } EINA_DEPRECATED EAPI void elm_scrolled_entry_icon_set(Evas_Object *obj, Evas_Object *icon) -{elm_entry_icon_set(obj, icon);} +{elm_object_part_content_set(obj, "icon", icon);} EINA_DEPRECATED EAPI Evas_Object * elm_scrolled_entry_icon_get(const Evas_Object *obj) -{return elm_entry_icon_get(obj);} +{return elm_object_part_content_get(obj, "icon");} EINA_DEPRECATED EAPI Evas_Object * elm_scrolled_entry_icon_unset(Evas_Object *obj) -{return elm_entry_icon_unset(obj);} +{return elm_object_part_content_unset(obj, "icon");} EINA_DEPRECATED EAPI void elm_scrolled_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting) {elm_entry_icon_visible_set(obj, setting);} EINA_DEPRECATED EAPI void elm_scrolled_entry_end_set(Evas_Object *obj, Evas_Object *end) -{elm_entry_end_set(obj, end);} +{elm_object_part_content_set(obj, "end", end);} EINA_DEPRECATED EAPI Evas_Object * elm_scrolled_entry_end_get(const Evas_Object *obj) -{return elm_entry_end_get(obj);} +{return elm_object_part_content_get(obj, "end");} EINA_DEPRECATED EAPI Evas_Object * elm_scrolled_entry_end_unset(Evas_Object *obj) -{return elm_entry_end_unset(obj);} +{return elm_object_part_content_unset(obj, "end");} EINA_DEPRECATED EAPI void elm_scrolled_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting) {elm_entry_end_visible_set(obj, setting);} diff --git a/src/lib/elm_deprecated.h b/src/lib/elm_deprecated.h index f4b4e43..84fec50 100644 --- a/src/lib/elm_deprecated.h +++ b/src/lib/elm_deprecated.h @@ -3026,3 +3026,84 @@ EINA_DEPRECATED EAPI void elm_toolbar_mode_shrink_set(Ev * @ingroup Toolbar */ EINA_DEPRECATED EAPI Elm_Toolbar_Shrink_Mode elm_toolbar_mode_shrink_get(const Evas_Object *obj); + +/** + * This sets a widget to be displayed to the left of a scrolled entry. + * + * @param obj The scrolled entry object + * @param icon The widget to display on the left side of the scrolled + * entry. + * + * @note A previously set widget will be destroyed. + * @note If the object being set does not have minimum size hints set, + * it won't get properly displayed. + * + * @deprecated Use elm_object_part_content_set() instead + * @see elm_entry_end_set() + */ +EINA_DEPRECATED EAPI void elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon); + +/** + * Gets the leftmost widget of the scrolled entry. This object is + * owned by the scrolled entry and should not be modified. + * + * @param obj The scrolled entry object + * @return the left widget inside the scroller + * + * @deprecated Use elm_object_part_content_get() instead + */ +EINA_DEPRECATED EAPI Evas_Object *elm_entry_icon_get(const Evas_Object *obj); + +/** + * Unset the leftmost widget of the scrolled entry, unparenting and + * returning it. + * + * @param obj The scrolled entry object + * @return the previously set icon sub-object of this entry, on + * success. + * + * @deprecated Use elm_object_part_content_unset() instead + * @see elm_entry_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_entry_icon_unset(Evas_Object *obj); + +/** + * This sets a widget to be displayed to the end of a scrolled entry. + * + * @param obj The scrolled entry object + * @param end The widget to display on the right side of the scrolled + * entry. + * + * @note A previously set widget will be destroyed. + * @note If the object being set does not have minimum size hints set, + * it won't get properly displayed. + * + * @deprecated Use elm_object_part_content_set() instead + * @see elm_entry_icon_set + */ +EINA_DEPRECATED EAPI void elm_entry_end_set(Evas_Object *obj, Evas_Object *end); + +/** + * Gets the endmost widget of the scrolled entry. This object is owned + * by the scrolled entry and should not be modified. + * + * @param obj The scrolled entry object + * @return the right widget inside the scroller + * + * @deprecated Use elm_object_part_content_get() instead + */ +EAPI Evas_Object *elm_entry_end_get(const Evas_Object *obj); + +/** + * Unset the endmost widget of the scrolled entry, unparenting and + * returning it. + * + * @param obj The scrolled entry object + * @return the previously set icon sub-object of this entry, on + * success. + * + * @deprecated Use elm_object_part_content_unset() instead + * @see elm_entry_icon_set() + */ +EINA_DEPRECATED EAPI Evas_Object *elm_entry_end_unset(Evas_Object *obj); + diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 25a511d..810ea76 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -810,23 +810,33 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) edje = wd->ent; /* Delete the currently swallowed object */ - { - Evas_Object *cswallow = edje_object_part_swallow_get(edje, part); - if (cswallow) - evas_object_del(cswallow); - } + Evas_Object *cswallow; - if (!strcmp(part, "elm.swallow.icon")) + if (!part || !strcmp(part, "icon")) { + cswallow = edje_object_part_swallow_get(edje, "elm.swallow.icon"); edje_object_signal_emit(edje, "elm,action,show,icon", "elm"); } - else if (!strcmp(part, "elm.swallow.end")) + else if (!strcmp(part, "end")) { + cswallow = edje_object_part_swallow_get(edje, "elm.swallow.end"); edje_object_signal_emit(edje, "elm,action,show,end", "elm"); } + else + cswallow = edje_object_part_swallow_get(edje, part); + + if (cswallow) evas_object_del(cswallow); + evas_event_freeze(evas_object_evas_get(obj)); elm_widget_sub_object_add(obj, content); - edje_object_part_swallow(edje, part, content); + + if (!part || !strcmp(part, "icon")) + edje_object_part_swallow(edje, "elm.swallow.icon", content); + else if (!strcmp(part, "end")) + edje_object_part_swallow(edje, "elm.swallow.end", content); + else + edje_object_part_swallow(edje, part, content); + _sizing_eval(obj); evas_event_thaw(evas_object_evas_get(obj)); evas_event_thaw_eval(evas_object_evas_get(obj)); @@ -844,16 +854,19 @@ _content_unset_hook(Evas_Object *obj, const char *part) else edje = wd->ent; - if (!strcmp(part, "elm.swallow.icon")) + if (!part || !strcmp(part, "icon")) { edje_object_signal_emit(edje, "elm,action,hide,icon", "elm"); + content = edje_object_part_swallow_get(edje, "elm.swallow.icon"); } - else if (!strcmp(part, "elm.swallow.end")) + else if (!strcmp(part, "end")) { edje_object_signal_emit(edje, "elm,action,hide,end", "elm"); + content = edje_object_part_swallow_get(edje, "elm.swallow.end"); } + else + content = edje_object_part_swallow_get(edje, part); - content = edje_object_part_swallow_get(edje, part); edje_object_part_swallow(edje, part, NULL); if (!content) return NULL; evas_event_freeze(evas_object_evas_get(obj)); @@ -878,8 +891,15 @@ _content_get_hook(const Evas_Object *obj, const char *part) else edje = wd->ent; - if (edje) + if (!edje) return NULL; + + if (!part || !strcmp(part, "icon")) + content = edje_object_part_swallow_get(edje, "elm.swallow.icon"); + else if (!strcmp(part, "end")) + content = edje_object_part_swallow_get(edje, "elm.swallow.end"); + else content = edje_object_part_swallow_get(edje, part); + return content; } @@ -3298,21 +3318,21 @@ elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon) { ELM_CHECK_WIDTYPE(obj, widtype); EINA_SAFETY_ON_NULL_RETURN(icon); - _content_set_hook(obj, "elm.swallow.icon", icon); + _content_set_hook(obj, NULL, icon); } EAPI Evas_Object * elm_entry_icon_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - return _content_get_hook(obj, "elm.swallow.icon"); + return _content_get_hook(obj, NULL); } EAPI Evas_Object * elm_entry_icon_unset(Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - return _content_unset_hook(obj, "elm.swallow.icon"); + return _content_unset_hook(obj, NULL); } EAPI void @@ -3340,21 +3360,21 @@ elm_entry_end_set(Evas_Object *obj, Evas_Object *end) { ELM_CHECK_WIDTYPE(obj, widtype); EINA_SAFETY_ON_NULL_RETURN(end); - _content_set_hook(obj, "elm.swallow.end", end); + _content_set_hook(obj, "end", end); } EAPI Evas_Object * elm_entry_end_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - return _content_get_hook(obj, "elm.swallow.end"); + return _content_get_hook(obj, "end"); } EAPI Evas_Object * elm_entry_end_unset(Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) NULL; - return _content_unset_hook(obj, "elm.swallow.end"); + return _content_unset_hook(obj, "end"); } EAPI void diff --git a/src/lib/elm_entry.h b/src/lib/elm_entry.h index 7d90d0d..20f1c5d 100644 --- a/src/lib/elm_entry.h +++ b/src/lib/elm_entry.h @@ -256,8 +256,8 @@ typedef enum * @li "language,changed": Program language changed. * * Default contents parts of the entry items that you can use for are: - * @li "elm.swallow.icon" - An icon in the entry - * @li "elm.swallow.end" - A content in the end of the entry + * @li "icon" - An icon in the entry + * @li "end" - A content in the end of the entry * * Default text parts of the entry that you can use for are: * @li "default" - text of the entry @@ -1007,44 +1007,6 @@ EAPI void elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scr EAPI Eina_Bool elm_entry_scrollable_get(const Evas_Object *obj); /** - * This sets a widget to be displayed to the left of a scrolled entry. - * - * @param obj The scrolled entry object - * @param icon The widget to display on the left side of the scrolled - * entry. - * - * @note A previously set widget will be destroyed. - * @note If the object being set does not have minimum size hints set, - * it won't get properly displayed. - * - * @see elm_entry_end_set() - */ -EAPI void elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon); - -/** - * Gets the leftmost widget of the scrolled entry. This object is - * owned by the scrolled entry and should not be modified. - * - * @param obj The scrolled entry object - * @return the left widget inside the scroller - */ -// XXX: deprecate - used elm_object_content_set() -EAPI Evas_Object *elm_entry_icon_get(const Evas_Object *obj); - -/** - * Unset the leftmost widget of the scrolled entry, unparenting and - * returning it. - * - * @param obj The scrolled entry object - * @return the previously set icon sub-object of this entry, on - * success. - * - * @see elm_entry_icon_set() - */ -// XXX: deprecate - used elm_object_content_set() -EAPI Evas_Object *elm_entry_icon_unset(Evas_Object *obj); - -/** * Sets the visibility of the left-side widget of the scrolled entry, * set by elm_entry_icon_set(). * @@ -1055,45 +1017,6 @@ EAPI Evas_Object *elm_entry_icon_unset(Evas_Object *obj); EAPI void elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting); /** - * This sets a widget to be displayed to the end of a scrolled entry. - * - * @param obj The scrolled entry object - * @param end The widget to display on the right side of the scrolled - * entry. - * - * @note A previously set widget will be destroyed. - * @note If the object being set does not have minimum size hints set, - * it won't get properly displayed. - * - * @see elm_entry_icon_set - */ -// XXX: deprecate - used elm_object_content_set() -EAPI void elm_entry_end_set(Evas_Object *obj, Evas_Object *end); - -/** - * Gets the endmost widget of the scrolled entry. This object is owned - * by the scrolled entry and should not be modified. - * - * @param obj The scrolled entry object - * @return the right widget inside the scroller - */ -// XXX: deprecate - used elm_object_content_set() -EAPI Evas_Object *elm_entry_end_get(const Evas_Object *obj); - -/** - * Unset the endmost widget of the scrolled entry, unparenting and - * returning it. - * - * @param obj The scrolled entry object - * @return the previously set icon sub-object of this entry, on - * success. - * - * @see elm_entry_icon_set() - */ -// XXX: deprecate - used elm_object_content_set() -EAPI Evas_Object *elm_entry_end_unset(Evas_Object *obj); - -/** * Sets the visibility of the end widget of the scrolled entry, set by * elm_entry_end_set(). * -- 2.7.4