From 273608a3b953e6271e9e29b8760ee786e1078b82 Mon Sep 17 00:00:00 2001 From: yoz Date: Mon, 31 Oct 2011 14:36:49 +0000 Subject: [PATCH] elementary: deprecate elm_toolbar_orientation_set and elm_toolbar_orientation_get to match and be conformant with the rest of api git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64562 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 24 +++++++++++++++++++++--- src/lib/elm_toolbar.c | 37 ++++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index ec240c2..b8eae05 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -14341,7 +14341,8 @@ extern "C" { ELM_TOOLBAR_SHRINK_NONE, /**< Set toolbar minimun size to fit all the items. */ ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */ ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a scroller. */ - ELM_TOOLBAR_SHRINK_MENU /**< Inserts a button to pop up a menu with exceeding items. */ + ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding items. */ + ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */ } Elm_Toolbar_Shrink_Mode; typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item; /**< Item of Elm_Toolbar. Sub-type of Elm_Widget_Item. Can be created with elm_toolbar_item_append(), elm_toolbar_item_prepend() and functions to add items in relative positions, like elm_toolbar_item_insert_before(), and deleted with elm_toolbar_item_del(). */ @@ -15547,7 +15548,16 @@ extern "C" { * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar. * @ingroup Toolbar */ - EAPI void elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI void elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical) EINA_ARG_NONNULL(1); + + /** + * Change a toolbar's orientation + * @param obj The toolbar object + * @param horizontal If @c EINA_TRUE, the toolbar is horizontal + * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar. + * @ingroup Toolbar + */ + EAPI void elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) EINA_ARG_NONNULL(1); /** * Get a toolbar's orientation @@ -15556,9 +15566,17 @@ extern "C" { * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical. * @ingroup Toolbar */ - EAPI Eina_Bool elm_toolbar_orientation_get(Evas_Object *obj) EINA_ARG_NONNULL(1); + EINA_DEPRECATED EAPI Eina_Bool elm_toolbar_orientation_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** + * Get a toolbar's orientation + * @param obj The toolbar object + * @return If @c EINA_TRUE, the toolbar is horizontal + * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical. + * @ingroup Toolbar + */ + EAPI Eina_Bool elm_toolbar_horizontal_get(const Evas_Object *obj); + /** * @} */ diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 0430bfa..4c26b41 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -407,18 +407,15 @@ _sizing_eval(Evas_Object *obj) if ((!wd->vertical) && (w > minw)) minw = w; evas_object_resize(wd->bx, minw, minh); elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh); - switch (wd->shrink_mode) + if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE) { - case ELM_TOOLBAR_SHRINK_MENU: /* fallthrough */ - case ELM_TOOLBAR_SHRINK_HIDE: /* fallthrough */ - case ELM_TOOLBAR_SHRINK_SCROLL: - if (wd->vertical) minh = h - vh; - else minw = w - vw; - break; - case ELM_TOOLBAR_SHRINK_NONE: if (wd->vertical) minh = minh_bx + (h - vh); else minw = minw_bx + (w - vw); - break; + } + else + { + if (wd->vertical) minh = h - vh; + else minw = w - vw; } minh = minh + (h - vh); evas_object_size_hint_min_set(obj, minw, minh); @@ -1931,21 +1928,35 @@ elm_toolbar_icon_order_lookup_get(const Evas_Object *obj) return wd->lookup_order; } -EAPI void +EINA_DEPRECATED EAPI void elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical) { + elm_toolbar_horizontal_set(obj, !vertical); +} + +EINA_DEPRECATED EAPI Eina_Bool +elm_toolbar_orientation_get(const Evas_Object *obj) +{ + return !elm_toolbar_horizontal_get(obj); +} + +EAPI void +elm_toolbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->vertical = vertical; + wd->vertical = !horizontal; _sizing_eval(obj); } EAPI Eina_Bool -elm_toolbar_orientation_get(Evas_Object *obj) +elm_toolbar_horizontal_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - return wd->vertical; + return !wd->vertical; } + + -- 2.7.4