some more work on shelves/gadcon

SVN revision: 21778
This commit is contained in:
Carsten Haitzler 2006-04-03 14:01:00 +00:00
parent 4f5c2636fc
commit 218b8215bc
6 changed files with 70 additions and 76 deletions

View File

@ -113,6 +113,8 @@ e_config_init(void)
E_CONFIG_VAL(D, T, h, INT); E_CONFIG_VAL(D, T, h, INT);
E_CONFIG_VAL(D, T, orient, INT); E_CONFIG_VAL(D, T, orient, INT);
E_CONFIG_VAL(D, T, style, STR); 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); _e_config_shelf_edd = E_CONFIG_DD_NEW("E_Config_Shelf", E_Config_Shelf);
#undef T #undef T
@ -1045,6 +1047,8 @@ e_config_init(void)
cf_escf->w = 800; cf_escf->w = 800;
cf_escf->h = 40; cf_escf->h = 40;
cf_escf->orient = E_GADCON_ORIENT_TOP; 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_escf->style = evas_stringshare_add("default");
cf_es->configs = evas_list_append(cf_es->configs, cf_escf); cf_es->configs = evas_list_append(cf_es->configs, cf_escf);
} }

View File

@ -335,6 +335,8 @@ struct _E_Config_Shelf_Config
int x, y, w, h; int x, y, w, h;
int orient; int orient;
const char *style; const char *style;
unsigned char fit_along;
unsigned char fit_size;
}; };
EAPI int e_config_init(void); EAPI int e_config_init(void);

View File

@ -72,6 +72,12 @@ __test2(E_Gadcon_Client *gcc)
evas_object_del(gcc->o_base); 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 */ /* externally accessible functions */
EAPI int EAPI int
e_gadcon_init(void) e_gadcon_init(void)
@ -84,7 +90,7 @@ e_gadcon_init(void)
GADCON_CLIENT_CLASS_VERSION, GADCON_CLIENT_CLASS_VERSION,
"ibar", "ibar",
{ {
__test, __test2, NULL __test, __test2, __test3
} }
}; };
e_gadcon_provider_register(&cc); 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; Evas_Coord w, h;
e_gadcon_layout_min_size_get(gc->o_container, &w, &h); e_gadcon_layout_min_size_get(gc->o_container, &w, &h);
/* FIXME: this needs to be controlled */
if (gc->edje.o_parent) if (gc->edje.o_parent)
{ {
edje_extern_object_min_size_set(gc->o_container, w, h); edje_extern_object_min_size_set(gc->o_container, w, h);
edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name, edje_object_part_swallow(gc->edje.o_parent, gc->edje.swallow_name,
gc->o_container); gc->o_container);
} }
printf("new minh/h\n");
gc->resize_request.func(gc->resize_request.data, gc, w, h); 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->minw = min;
sd->minh = mino; sd->minh = mino;
evas_object_smart_callback_call(sd->obj, "size_requeset", NULL); evas_object_smart_callback_call(sd->obj, "size_request", NULL);
} }
} }
else else
@ -1667,7 +1675,7 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
{ {
sd->minw = mino; sd->minw = mino;
sd->minh = min; sd->minh = min;
evas_object_smart_callback_call(sd->obj, "size_requeset", NULL); evas_object_smart_callback_call(sd->obj, "size_request", NULL);
} }
} }
} }

View 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; E_Cfg_Theme_Data *cb_data;
if (!e_thumb_exists(fulltheme)) 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 else
o3 = e_thumb_evas_object_get(fulltheme, cfd->dia->win->evas, 48, 48, 1); o3 = e_thumb_evas_object_get(fulltheme, cfd->dia->win->evas, 48, 48, 1);

View File

@ -5,10 +5,7 @@
static void _e_shelf_free(E_Shelf *es); 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_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_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
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 Evas_List *shelves = NULL;
static int shelf_id = 0; 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->ee = zone->container->bg_ecore_evas;
es->evas = zone->container->bg_evas; es->evas = zone->container->bg_evas;
} }
// es->fit_along = 1;
es->layer = layer; es->layer = layer;
es->zone = zone; es->zone = zone;
es->style = evas_stringshare_add(style); 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); 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); snprintf(buf, sizeof(buf), "%i", shelf_id);
shelf_id++; shelf_id++;
es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "items"); 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_orient(es->gadcon, E_GADCON_ORIENT_TOP);
e_gadcon_zone_set(es->gadcon, zone); e_gadcon_zone_set(es->gadcon, zone);
e_gadcon_ecore_evas_set(es->gadcon, es->ee); 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 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; E_Shelf *es;
Evas_Coord nx, ny, nw, nh;
es = data; es = data;
printf("SIG: %s %s\n", emission, source); nx = es->x;
} ny = es->y;
nw = es->w;
static void nh = es->h;
_e_shelf_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source) edje_object_size_min_calc(es->o_base, &nw, &nh);
printf("new w, h = %i %i\n", nw, nh);
switch (gc->orient)
{ {
E_Shelf *es; case E_GADCON_ORIENT_FLOAT:
break;
es = data; case E_GADCON_ORIENT_HORIZ:
printf("MV start\n"); break;
es->moveresize.pos.x = es->x; case E_GADCON_ORIENT_VERT:
es->moveresize.pos.y = es->y; break;
es->moveresize.move = 1; case E_GADCON_ORIENT_LEFT:
ecore_x_pointer_last_xy_get(&(es->moveresize.x), &(es->moveresize.y)); break;
} case E_GADCON_ORIENT_RIGHT:
break;
static void case E_GADCON_ORIENT_TOP:
_e_shelf_cb_signal_move_go(void *data, Evas_Object *obj, const char *emission, const char *source) if (!es->fit_along) nw = es->w;
{ if (!es->fit_size) nh = es->h;
E_Shelf *es; if (nw > es->zone->w) nw = es->zone->w;
int x, y; if (nh > es->zone->h) nh = es->zone->h;
if (nw != es->w) nx = es->x + ((es->w - es->w) / 2);
es = data; ny = 0;
if (es->moveresize.move) break;
{ case E_GADCON_ORIENT_BOTTOM:
int x, y, nx, ny, nw, nh; if (!es->fit_along) nw = es->w;
if (!es->fit_size) nh = es->h;
printf("MV go\n"); if (nw > es->zone->w) nw = es->zone->w;
ecore_x_pointer_last_xy_get(&x, &y); if (nh > es->zone->h) nh = es->zone->h;
nx = x = es->moveresize.pos.x + (x - es->moveresize.x); if (nw != es->w) nx = es->x + ((es->w - es->w) / 2);
ny = y = es->moveresize.pos.y + (y - es->moveresize.y); ny = es->zone->h - nh;
e_resist_container_border_position(es->zone->container, break;
NULL, case E_GADCON_ORIENT_CORNER_TL:
es->x, es->y, es->w, es->h, break;
x, y, es->w, es->h, case E_GADCON_ORIENT_CORNER_TR:
&nx, &ny, &nw, &nh); break;
e_shelf_move(es, nx, ny); case E_GADCON_ORIENT_CORNER_BL:
} break;
} case E_GADCON_ORIENT_CORNER_BR:
break;
static void default:
_e_shelf_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source) break;
{
E_Shelf *es;
es = data;
if (es->moveresize.move)
{
printf("MV stop\n");
es->moveresize.move = 0;
} }
e_shelf_move_resize(es, nx, ny, nw, nh);
} }

View File

@ -25,14 +25,8 @@ struct _E_Shelf
const char *name; const char *name;
const char *style; const char *style;
E_Config_Shelf *cfg; E_Config_Shelf *cfg;
struct { unsigned char fit_along : 1;
int x, y; unsigned char fit_size : 1;
struct {
int x, y;
} pos;
int move;
int resize;
} moveresize;
}; };
EAPI int e_shelf_init(void); EAPI int e_shelf_init(void);