diff --git a/legacy/elementary/data/themes/widgets/frame.edc b/legacy/elementary/data/themes/widgets/frame.edc index a3bf544e64..07937fb456 100644 --- a/legacy/elementary/data/themes/widgets/frame.edc +++ b/legacy/elementary/data/themes/widgets/frame.edc @@ -145,6 +145,19 @@ group { name: "elm/frame/base/default"; run_program(PROGRAM:"expand"); } } + program { name: "switch"; + signal: "elm,action,switch"; + source: "elm"; + script { + new st[31]; + new Float:vl; + get_state(PART:"elm.swallow.content", st, 30, vl); + if (!strcmp(st, "default")) + set_state(PART:"elm.swallow.content", "collapsed", 0.0); + else + set_state(PART:"elm.swallow.content", "default", 0.0); + } + } program { name: "signal"; action: SIGNAL_EMIT "elm,anim,done" "elm"; } diff --git a/legacy/elementary/src/lib/elm_frame.c b/legacy/elementary/src/lib/elm_frame.c index 82310e434e..f118a969d5 100644 --- a/legacy/elementary/src/lib/elm_frame.c +++ b/legacy/elementary/src/lib/elm_frame.c @@ -286,6 +286,22 @@ elm_frame_autocollapse_get(Evas_Object *obj) 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,switch", "elm"); + edje_object_message_signal_process(wd->frm); + wd->collapsed = enable; + wd->anim = EINA_FALSE; + _sizing_eval(obj); +} + +EAPI void +elm_frame_collapse_go(Evas_Object *obj, Eina_Bool enable) { Widget_Data *wd; ELM_CHECK_WIDTYPE(obj, widtype); diff --git a/legacy/elementary/src/lib/elm_frame.h b/legacy/elementary/src/lib/elm_frame.h index 67750a781f..f7b2567d44 100644 --- a/legacy/elementary/src/lib/elm_frame.h +++ b/legacy/elementary/src/lib/elm_frame.h @@ -70,14 +70,23 @@ EAPI void elm_frame_autocollapse_set(Evas_Object *obj, Eina_Bool enable); EAPI Eina_Bool elm_frame_autocollapse_get(Evas_Object *obj); /** - * @brief Manually collapse a frame + * @brief Manually collapse a frame without animations * @param obj The frame * @param enable true to collapse, false to expand * - * Use this to toggle the collapsed state of a frame. + * Use this to toggle the collapsed state of a frame, bypassing animations. */ EAPI void elm_frame_collapse_set(Evas_Object *obj, Eina_Bool enable); +/** + * @brief Manually collapse a frame with animations + * @param obj The frame + * @param enable true to collapse, false to expand + * + * Use this to toggle the collapsed state of a frame, triggering animations. + */ +EAPI void elm_frame_collapse_go(Evas_Object *obj, Eina_Bool enable); + /** * @brief Determine the collapse state of a frame * @param obj The frame