From df0d6845c008957f4c59d46e4a93c41ef142df0e 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: https://svn.enlightenment.org/svn/e/trunk/elementary@64562 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 1 + src/lib/elm_toolbar.c | 44 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index f56113d..ccd2056 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -14359,6 +14359,7 @@ extern "C" { 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_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(). */ diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 7f08947..ad13669 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -405,12 +405,15 @@ _sizing_eval(Evas_Object *obj) if (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: minw = w - vw; break; - case ELM_TOOLBAR_SHRINK_NONE: minw = minw_bx + (w - vw); break; + if (wd->vertical) minh = minh_bx + (h - vh); + else minw = minw_bx + (w - vw); + } + else + { + if (wd->vertical) minh = h - vh; + else minw = w - vw; } minh = minh + (h - vh); evas_object_size_hint_min_set(obj, minw, minh); @@ -1850,3 +1853,34 @@ elm_toolbar_icon_order_lookup_get(const Evas_Object *obj) if (!wd) return ELM_ICON_LOOKUP_THEME_FDO; return wd->lookup_order; } + +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 = !horizontal; + _sizing_eval(obj); +} + +EAPI Eina_Bool +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; +} -- 2.7.4