add elm_frame_collapse_go() to trigger frame animations, elm_frame_collapse_set(...
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 14 Jan 2012 04:12:45 +0000 (04:12 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 14 Jan 2012 04:12:45 +0000 (04:12 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67207 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

data/themes/widgets/frame.edc
src/lib/elm_frame.c
src/lib/elm_frame.h

index a3bf544..07937fb 100644 (file)
@@ -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";
       }
index 82310e4..f118a96 100644 (file)
@@ -293,6 +293,22 @@ elm_frame_collapse_set(Evas_Object *obj, Eina_Bool enable)
    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);
+   wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   enable = !!enable;
+   if (wd->collapsed == enable) return;
    edje_object_signal_emit(wd->frm, "elm,action,toggle", "elm");
    evas_object_smart_callback_add(wd->frm, "recalc", (Evas_Smart_Cb)_recalc, obj);
    wd->collapsed = enable;
index 67750a7..f7b2567 100644 (file)
@@ -70,15 +70,24 @@ 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
  * @return true if collapsed, false otherwise