some more work on shelves/gadcon
authorCarsten Haitzler <raster@rasterman.com>
Mon, 3 Apr 2006 14:01:00 +0000 (14:01 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 3 Apr 2006 14:01:00 +0000 (14:01 +0000)
SVN revision: 21778

src/bin/e_config.c
src/bin/e_config.h
src/bin/e_gadcon.c
src/bin/e_int_config_theme.c
src/bin/e_shelf.c
src/bin/e_shelf.h

index bc1c411..c402acd 100644 (file)
@@ -113,6 +113,8 @@ e_config_init(void)
    E_CONFIG_VAL(D, T, h, INT);
    E_CONFIG_VAL(D, T, orient, INT);
    E_CONFIG_VAL(D, T, style, STR);
+   E_CONFIG_VAL(D, T, fit_along, UCHAR);
+   E_CONFIG_VAL(D, T, fit_size, UCHAR);
    
    _e_config_shelf_edd = E_CONFIG_DD_NEW("E_Config_Shelf", E_Config_Shelf);
 #undef T
@@ -1045,6 +1047,8 @@ e_config_init(void)
        cf_escf->w = 800;
        cf_escf->h = 40;
        cf_escf->orient = E_GADCON_ORIENT_TOP;
+       cf_escf->fit_along = 1;
+       cf_escf->fit_size = 0;
        cf_escf->style = evas_stringshare_add("default");
        cf_es->configs = evas_list_append(cf_es->configs, cf_escf);
      }
index 8e3b57d..2576c85 100644 (file)
@@ -335,6 +335,8 @@ struct _E_Config_Shelf_Config
    int x, y, w, h;
    int orient;
    const char *style;
+   unsigned char fit_along;
+   unsigned char fit_size;
 };
 
 EAPI int        e_config_init(void);
index 3d74264..8da69c3 100644 (file)
@@ -72,6 +72,12 @@ __test2(E_Gadcon_Client *gcc)
    evas_object_del(gcc->o_base);
 }
 
+static void
+__test3(E_Gadcon_Client *gcc)
+{
+   e_gadcon_client_min_size_set(gcc, 80, 20);
+}
+
 /* externally accessible functions */
 EAPI int
 e_gadcon_init(void)
@@ -84,7 +90,7 @@ e_gadcon_init(void)
             GADCON_CLIENT_CLASS_VERSION,
               "ibar",
               {
-                 __test, __test2, NULL
+                 __test, __test2, __test3
               }
          };
        e_gadcon_provider_register(&cc);
@@ -585,12 +591,14 @@ _e_gadcon_cb_size_request(void *data, Evas *e, Evas_Object *obj, void *event_inf
        Evas_Coord w, h;
        
        e_gadcon_layout_min_size_get(gc->o_container, &w, &h);
+       /* FIXME: this needs to be controlled */
        if (gc->edje.o_parent)
          {
             edje_extern_object_min_size_set(gc->o_container, w, h);
             edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name,
                                      gc->o_container);
          }
+       printf("new minh/h\n");
        gc->resize_request.func(gc->resize_request.data, gc, w, h);
      }
 }
@@ -1658,7 +1666,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
          {
             sd->minw = min;
             sd->minh = mino;
-            evas_object_smart_callback_call(sd->obj, "size_requeset", NULL);
+            evas_object_smart_callback_call(sd->obj, "size_request", NULL);
          }
      }
    else
@@ -1667,7 +1675,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
          {
             sd->minw = mino;
             sd->minh = min;
-            evas_object_smart_callback_call(sd->obj, "size_requeset", NULL);
+            evas_object_smart_callback_call(sd->obj, "size_request", NULL);
          }
      }
 }
index 6108eae..36a6c6f 100644 (file)
@@ -200,7 +200,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
                  E_Cfg_Theme_Data *cb_data;
                  
                  if (!e_thumb_exists(fulltheme))
-                   o3 = e_thumb_generate_begin(fulltheme, 48, 48, cfd->dia->win->evas, &o, NULL, NULL);
+                   o3 = e_thumb_generate_begin(fulltheme, 48, 48, cfd->dia->win->evas, &o3, NULL, NULL);
                  else
                    o3 = e_thumb_evas_object_get(fulltheme, cfd->dia->win->evas, 48, 48, 1);
                  
index ef08f3f..f242307 100644 (file)
@@ -5,10 +5,7 @@
 
 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 void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
 
 static Evas_List *shelves = NULL;
 static int shelf_id = 0;
@@ -133,6 +130,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
        es->ee = zone->container->bg_ecore_evas;
        es->evas = zone->container->bg_evas;
      }
+//   es->fit_along = 1;
    es->layer = layer;
    es->zone = zone;
    es->style = evas_stringshare_add(style);
@@ -155,19 +153,11 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
        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++;
    es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items");
+   e_gadcon_size_request_callback_set(es->gadcon, _e_shelf_gadcon_size_request,
+                                     es);
    e_gadcon_orient(es->gadcon, E_GADCON_ORIENT_TOP);
    e_gadcon_zone_set(es->gadcon, zone);
    e_gadcon_ecore_evas_set(es->gadcon, es->ee);
@@ -419,60 +409,56 @@ _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)
-{
-   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_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h)
 {
    E_Shelf *es;
+   Evas_Coord nx, ny, nw, nh;
    
    es = data;
-   if (es->moveresize.move)
+   nx = es->x;
+   ny = es->y;
+   nw = es->w;
+   nh = es->h;
+   edje_object_size_min_calc(es->o_base, &nw, &nh);
+       printf("new w, h = %i %i\n", nw, nh);
+   switch (gc->orient)
      {
-       printf("MV stop\n");
-       es->moveresize.move = 0;
+      case E_GADCON_ORIENT_FLOAT:
+       break;
+      case E_GADCON_ORIENT_HORIZ:
+       break;
+      case E_GADCON_ORIENT_VERT:
+       break;
+      case E_GADCON_ORIENT_LEFT:
+       break;
+      case E_GADCON_ORIENT_RIGHT:
+       break;
+      case E_GADCON_ORIENT_TOP:
+       if (!es->fit_along) nw = es->w;
+       if (!es->fit_size) nh = es->h;
+       if (nw > es->zone->w) nw = es->zone->w;
+       if (nh > es->zone->h) nh = es->zone->h;
+       if (nw != es->w) nx = es->x + ((es->w - es->w) / 2);
+       ny = 0;
+       break;
+      case E_GADCON_ORIENT_BOTTOM:
+       if (!es->fit_along) nw = es->w;
+       if (!es->fit_size) nh = es->h;
+       if (nw > es->zone->w) nw = es->zone->w;
+       if (nh > es->zone->h) nh = es->zone->h;
+       if (nw != es->w) nx = es->x + ((es->w - es->w) / 2);
+       ny = es->zone->h - nh;
+       break;
+      case E_GADCON_ORIENT_CORNER_TL:
+       break;
+      case E_GADCON_ORIENT_CORNER_TR:
+       break;
+      case E_GADCON_ORIENT_CORNER_BL:
+       break;
+      case E_GADCON_ORIENT_CORNER_BR:
+       break;
+      default:
+       break;
      }
+   e_shelf_move_resize(es, nx, ny, nw, nh);
 }
index ddec495..8e0790a 100644 (file)
@@ -25,14 +25,8 @@ 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;
+   unsigned char        fit_along : 1;
+   unsigned char        fit_size : 1;
 };
 
 EAPI int              e_shelf_init(void);