From 218b8215bc5f57196308c5440892c58b5afde2a6 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 3 Apr 2006 14:01:00 +0000 Subject: [PATCH] some more work on shelves/gadcon SVN revision: 21778 --- src/bin/e_config.c | 4 ++ src/bin/e_config.h | 2 + src/bin/e_gadcon.c | 14 ++++- src/bin/e_int_config_theme.c | 2 +- src/bin/e_shelf.c | 114 +++++++++++++++-------------------- src/bin/e_shelf.h | 10 +-- 6 files changed, 70 insertions(+), 76 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index bc1c41102..c402acd2d 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -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); } diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 8e3b57d00..2576c85c4 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -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); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 3d74264b7..8da69c371 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -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); } } } diff --git a/src/bin/e_int_config_theme.c b/src/bin/e_int_config_theme.c index 6108eae1b..36a6c6fff 100644 --- a/src/bin/e_int_config_theme.c +++ b/src/bin/e_int_config_theme.c @@ -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); diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index ef08f3f14..f242307dd 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -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_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; - 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) + 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) { - 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; + 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); } diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index ddec495c8..8e0790ae8 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -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);