elementary/ctxpopup - + hide effect
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Feb 2012 11:26:25 +0000 (11:26 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Feb 2012 11:26:25 +0000 (11:26 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67673 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

data/themes/widgets/ctxpopup.edc
src/lib/elc_ctxpopup.c

index 1fe11a0..c07990c 100644 (file)
@@ -424,6 +424,7 @@ group { name: "elm/ctxpopup/bg/default";
          source: "elm";
          action: STATE_SET "default" 0.0;
          target: "ctxpopup_bg";
+         transition: LINEAR 0.25;
       }
    }
 }
@@ -620,26 +621,46 @@ group { name: "elm/ctxpopup/base/default";
             rel1 { to:"base"; relative: 0 0; }
             rel2 { to:"base"; relative: 0 1; }
          }
-         description { state: "up" 0.0;
+         description { state: "show_up" 0.0;
             color: 255 255 255 0;
             rel1 { to:"arrow_area_down"; relative: 0 1; }
             rel2 { to:"arrow_area_down"; relative: 1 1; }
          }
-         description { state: "left" 0.0;
+         description { state: "show_left" 0.0;
             color: 255 255 255 0;
             rel1 { to:"arrow_area_right"; relative: 1 0; }
             rel2 { to:"arrow_area_right"; relative: 1 1; }
          }
-         description { state: "right" 0.0;
+         description { state: "show_right" 0.0;
             color: 255 255 255 0;
             rel1 { to:"arrow_area_left"; relative: 0 0; }
             rel2 { to:"arrow_area_left"; relative: 0 1; }
          }
-         description { state: "down" 0.0;
+         description { state: "show_down" 0.0;
             color: 255 255 255 0;
             rel1 { to:"arrow_area_up"; relative: 0 0; }
             rel2 { to:"arrow_area_up"; relative: 1 0; }
          }
+         description { state: "hide_up" 0.0;
+            color: 255 255 255 255;
+            rel1 { to:"arrow_area_down"; relative: 0 1; }
+            rel2 { to:"arrow_area_down"; relative: 1 1; }
+         }
+         description { state: "hide_left" 0.0;
+            color: 255 255 255 255;
+            rel1 { to:"arrow_area_right"; relative: 1 0; }
+            rel2 { to:"arrow_area_right"; relative: 1 1; }
+         }
+         description { state: "hide_right" 0.0;
+            color: 255 255 255 255;
+            rel1 { to:"arrow_area_left"; relative: 0 0; }
+            rel2 { to:"arrow_area_left"; relative: 0 1; }
+         }
+         description { state: "hide_down" 0.0;
+            color: 255 255 255 255;
+            rel1 { to:"arrow_area_up"; relative: 0 0; }
+            rel2 { to:"arrow_area_up"; relative: 1 0; }
+         }
          description { state: "visible" 0.0;
             color: 255 255 255 255;
             rel1 { to_x:"arrow_area_left"; to_y:"arrow_area_up"; }
@@ -655,34 +676,70 @@ group { name: "elm/ctxpopup/base/default";
          transition: LINEAR 0.25;
          target: "ctxpopup_clip";
       }
-      program { name: "up";
+      program { name: "show_up";
          signal: "elm,state,show,up";
          source: "elm";
-         action: STATE_SET "up" 0.0;
+         action: STATE_SET "show_up" 0.0;
          transition: LINEAR 0.25;
          target: "ctxpopup_clip";
       }
-      program { name: "left";
+      program { name: "show_left";
          signal: "elm,state,show,left";
          source: "elm";
-         action: STATE_SET "left" 0.0;
+         action: STATE_SET "show_left" 0.0;
          transition: LINEAR 0.25;
          target: "ctxpopup_clip";
       }
-      program { name: "right";
+      program { name: "show_right";
          signal: "elm,state,show,right";
          source: "elm";
-         action: STATE_SET "right" 0.0;
+         action: STATE_SET "show_right" 0.0;
          transition: LINEAR 0.25;
          target: "ctxpopup_clip";
       }
-      program { name: "down";
+      program { name: "show_down";
          signal: "elm,state,show,down";
          source: "elm";
-         action: STATE_SET "down" 0.0;
+         action: STATE_SET "show_down" 0.0;
+         transition: LINEAR 0.25;
+         target: "ctxpopup_clip";
+      }
+      program { name: "hide_up";
+         signal: "elm,state,hide,up";
+         source: "elm";
+         action: STATE_SET "hide_up" 0.0;
+         transition: LINEAR 0.25;
+         target: "ctxpopup_clip";
+         after: "hide_finished";
+      }
+      program { name: "hide_left";
+         signal: "elm,state,hide,left";
+         source: "elm";
+         action: STATE_SET "hide_left" 0.0;
          transition: LINEAR 0.25;
          target: "ctxpopup_clip";
+         after: "hide_finished";
+      }
+      program { name: "hide_right";
+         signal: "elm,state,hide,right";
+         source: "elm";
+         action: STATE_SET "hide_right" 0.0;
+         transition: LINEAR 0.25;
+         target: "ctxpopup_clip";
+         after: "hide_finished";
+      }
+      program { name: "hide_down";
+         signal: "elm,state,hide,down";
+         source: "elm";
+         action: STATE_SET "hide_down" 0.0;
+         transition: LINEAR 0.25;
+         target: "ctxpopup_clip";
+         after: "hide_finished";
+      }
+      program { name: "hide_finished";
+         action: SIGNAL_EMIT "elm,action,hide,finished" "";
       }
+
    }
 }
 ///////////////////////////////////////////////////////////////////////////////
index 3f6e0d9..4ef17dd 100644 (file)
@@ -68,6 +68,10 @@ static void _update_arrow(Evas_Object *obj,
                           Elm_Ctxpopup_Direction dir,
                           Evas_Coord_Rectangle rect);
 static void _sizing_eval(Evas_Object *obj);
+static void _hide_signal_emit(Evas_Object *obj,
+                              Elm_Ctxpopup_Direction dir);
+static void _show_signal_emit(Evas_Object *obj,
+                              Elm_Ctxpopup_Direction dir);
 static void _shift_base_by_arrow(Evas_Object *arrow,
                                  Elm_Ctxpopup_Direction dir,
                                  Evas_Coord_Rectangle *rect);
@@ -102,6 +106,10 @@ static void _ctxpopup_show(void *data,
                            Evas *e,
                            Evas_Object *obj,
                            void *event_info);
+static void _hide_finished(void *data,
+                           Evas_Object *obj,
+                           const char *emission,
+                           const char *source __UNUSED__);
 static void _hide(Evas_Object *obj);
 static void _ctxpopup_hide(void *data,
                            Evas *e,
@@ -614,12 +622,41 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir,
 }
 
 static void
+_hide_signal_emit(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
+{
+   Widget_Data *wd;
+
+   wd = elm_widget_data_get(obj);
+   if (!wd->visible) return;
+
+   switch (dir)
+     {
+        case ELM_CTXPOPUP_DIRECTION_UP:
+           edje_object_signal_emit(wd->base, "elm,state,hide,up", "elm");
+           break;
+        case ELM_CTXPOPUP_DIRECTION_LEFT:
+           edje_object_signal_emit(wd->base, "elm,state,hide,left", "elm");
+           break;
+        case ELM_CTXPOPUP_DIRECTION_RIGHT:
+           edje_object_signal_emit(wd->base, "elm,state,hide,right", "elm");
+           break;
+        case ELM_CTXPOPUP_DIRECTION_DOWN:
+           edje_object_signal_emit(wd->base, "elm,state,hide,down", "elm");
+           break;
+        default:
+           break;
+     }
+
+   edje_object_signal_emit(wd->bg, "elm,state,hide", "elm");
+}
+
+static void
 _show_signal_emit(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
 {
    Widget_Data *wd;
 
    wd = elm_widget_data_get(obj);
-   if (!wd || wd->visible) return;
+   if (wd->visible) return;
 
    switch (dir)
      {
@@ -1023,6 +1060,13 @@ _ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
 }
 
 static void
+_hide_finished(void *data, Evas_Object *obj __UNUSED__,
+               const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+   _hide(data);
+}
+
+static void
 _hide(Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
@@ -1043,7 +1087,9 @@ static void
 _ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
                void *event_info __UNUSED__)
 {
-   _hide(obj);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   _hide_signal_emit(obj, wd->dir);
 }
 
 static void
@@ -1302,6 +1348,8 @@ elm_ctxpopup_add(Evas_Object *parent)
    wd->base = edje_object_add(e);
    elm_widget_sub_object_add(obj, wd->base);
    _elm_theme_object_set(obj, wd->base, "ctxpopup", "base", "default");
+   edje_object_signal_callback_add(wd->base, "elm,action,hide,finished", "",
+                                   _hide_finished, obj);
 
    //Arrow
    wd->arrow = edje_object_add(e);