From: discomfitor Date: Wed, 4 Jan 2012 03:03:15 +0000 (+0000) Subject: add api for manipulating frame collapse X-Git-Tag: REL_F_I9500_20120323_1~17^2~947 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fb72c2d98ef55cb6fa8d4992f9073ef17eab7f6;p=framework%2Fuifw%2Felementary.git add api for manipulating frame collapse git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@66833 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_frame.c b/src/lib/elm_frame.c index 3ca1d91..400257d 100644 --- a/src/lib/elm_frame.c +++ b/src/lib/elm_frame.c @@ -8,6 +8,8 @@ struct _Widget_Data Evas_Object *frm; Evas_Object *content; const char *label; + Eina_Bool collapsed : 1; + Eina_Bool collapsible : 1; }; static const char SIG_CLICKED[] = "clicked"; @@ -192,6 +194,9 @@ _signal_click(Evas_Object *fr, Evas_Object *obj __UNUSED__, const char *emission wd = elm_widget_data_get(fr); if (!wd) return; evas_object_smart_callback_call(fr, SIG_CLICKED, NULL); + if (!wd->collapsible) return; + edje_object_signal_emit(wd->frm, "elm,action,collapse", "elm"); + wd->collapsed++; } EAPI Evas_Object * @@ -232,6 +237,50 @@ elm_frame_add(Evas_Object *parent) } EAPI void +elm_frame_autocollapse_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + wd->collapsible = !!enable; +} + +EAPI Eina_Bool +elm_frame_autocollapse_get(Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->collapsible; +} + +EAPI void +elm_frame_collapse_set(Evas_Object *obj, Eina_Bool enable) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype); + wd = elm_widget_data_get(obj); + if (!wd) return; + enable = !!enable; + if (wd->collapsed == enable) return; + edje_object_signal_emit(wd->frm, "elm,action,collapse", "elm"); + wd->collapsed = enable; +} + +EAPI Eina_Bool +elm_frame_collapse_get(Evas_Object *obj) +{ + Widget_Data *wd; + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->collapsed; +} + + +EAPI void elm_frame_label_set(Evas_Object *obj, const char *label) { _elm_frame_label_set(obj, NULL, label); diff --git a/src/lib/elm_frame.h b/src/lib/elm_frame.h index 7b50749..452d2cf 100644 --- a/src/lib/elm_frame.h +++ b/src/lib/elm_frame.h @@ -41,5 +41,44 @@ EAPI Evas_Object *elm_frame_add(Evas_Object *parent); /** + * @brief Toggle autocollapsing of a frame + * @param obj The frame + * @param enable Whether to enable autocollapse + * + * When @p enable is EINA_TRUE, clicking a frame's label will collapse the frame + * vertically, shrinking it to the height of the label. + * By default, this is DISABLED. + */ +EAPI void elm_frame_autocollapse_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @brief Determine autocollapsing of a frame + * @param obj The frame + * @return Whether autocollapse is enabled + * + * When this returns EINA_TRUE, clicking a frame's label will collapse the frame + * vertically, shrinking it to the height of the label. + * By default, this is DISABLED. + */ +EAPI Eina_Bool elm_frame_autocollapse_get(Evas_Object *obj); + +/** + * @brief Manually collapse a frame + * @param obj The frame + * @param enable true to collapse, false to expand + * + * Use this to toggle the collapsed state of a frame. + */ +EAPI void elm_frame_collapse_set(Evas_Object *obj, Eina_Bool enable); + +/** + * @brief Determine the collapse state of a frame + * @param obj The frame + * @return true if collapsed, false otherwise + * + * Use this to determine the collapse state of a frame. + */ +EAPI Eina_Bool elm_frame_collapse_get(Evas_Object *obj); +/** * @} */