start code on moving shelves... need to complete this with resizing too...
authorCarsten Haitzler <raster@rasterman.com>
Sun, 26 Mar 2006 06:06:57 +0000 (06:06 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 26 Mar 2006 06:06:57 +0000 (06:06 +0000)
and do it all properly

SVN revision: 21511

src/bin/e_shelf.c
src/bin/e_shelf.h

index 04a7ac8..ef08f3f 100644 (file)
@@ -5,6 +5,10 @@
 
 static void _e_shelf_free(E_Shelf *es);
 static void _e_shelf_config_port(E_Config_Shelf_Config *cf1, E_Config_Shelf_Config *cf2);
+static void _e_shelf_cb_signal_all(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_shelf_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_shelf_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_shelf_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
 
 static Evas_List *shelves = NULL;
 static int shelf_id = 0;
@@ -150,6 +154,16 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
        evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y);
        evas_object_layer_set(es->o_base, layer);
      }
+
+   edje_object_signal_callback_add(es->o_base, "*", "*",
+                                  _e_shelf_cb_signal_all, es);
+   edje_object_signal_callback_add(es->o_base, "mouse,down,1", "drag*",
+                                  _e_shelf_cb_signal_move_start, es);
+   edje_object_signal_callback_add(es->o_base, "mouse,move", "drag*",
+                                  _e_shelf_cb_signal_move_go, es);
+   edje_object_signal_callback_add(es->o_base, "mouse,up,1", "drag*", 
+                                  _e_shelf_cb_signal_move_stop, es);
+   
    
    snprintf(buf, sizeof(buf), "%i", shelf_id);
    shelf_id++;
@@ -403,3 +417,62 @@ _e_shelf_config_port(E_Config_Shelf_Config *cf1, E_Config_Shelf_Config *cf2)
    cf2->w = px[3] - px[0] + 1;
    cf2->h = py[3] = py[0] + 1;
 }
+
+static void
+_e_shelf_cb_signal_all(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+   E_Shelf *es;
+   
+   es = data;
+   printf("SIG: %s %s\n", emission, source);
+}
+
+static void
+_e_shelf_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+   E_Shelf *es;
+   
+   es = data;
+   printf("MV start\n");
+   es->moveresize.pos.x = es->x;
+   es->moveresize.pos.y = es->y;
+   es->moveresize.move = 1;
+   ecore_x_pointer_last_xy_get(&(es->moveresize.x), &(es->moveresize.y));
+}
+
+static void
+_e_shelf_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+   E_Shelf *es;
+   int x, y;
+   
+   es = data;
+   if (es->moveresize.move)
+     {
+       int x, y, nx, ny, nw, nh;
+       
+       printf("MV go\n");
+       ecore_x_pointer_last_xy_get(&x, &y);
+       nx = x = es->moveresize.pos.x + (x - es->moveresize.x);
+       ny = y = es->moveresize.pos.y + (y - es->moveresize.y);
+       e_resist_container_border_position(es->zone->container,
+                                          NULL,
+                                          es->x, es->y, es->w, es->h,
+                                          x, y, es->w, es->h,
+                                          &nx, &ny, &nw, &nh);
+       e_shelf_move(es, nx, ny);
+     }
+}
+
+static void
+_e_shelf_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+   E_Shelf *es;
+   
+   es = data;
+   if (es->moveresize.move)
+     {
+       printf("MV stop\n");
+       es->moveresize.move = 0;
+     }
+}
index 6d91941..ddec495 100644 (file)
@@ -25,6 +25,14 @@ struct _E_Shelf
    const char          *name;
    const char          *style;
    E_Config_Shelf      *cfg;
+   struct {
+      int               x, y;
+      struct {
+        int            x, y;
+      } pos;
+      int               move;
+      int               resize;
+   } moveresize;
 };
 
 EAPI int              e_shelf_init(void);