Show shelves on dnd enter.

SVN revision: 29915
This commit is contained in:
Sebastian Dransfeld 2007-05-07 19:54:12 +00:00
parent ccdf9f9ac6
commit 80b32e7c7b
4 changed files with 65 additions and 1 deletions

View File

@ -20,6 +20,8 @@ static void _e_drag_hide(E_Drag *drag);
static void _e_drag_move(E_Drag *drag, int x, int y);
static void _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh);
static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win);
static void _e_drag_win_show(E_Drop_Handler *h);
static void _e_drag_win_hide(E_Drop_Handler *h);
static void _e_drag_update(int x, int y);
static void _e_drag_end(int x, int y);
static void _e_drag_xdnd_end(int x, int y);
@ -585,6 +587,46 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
return 0;
}
static void
_e_drag_win_show(E_Drop_Handler *h)
{
if (h->obj)
{
switch (h->obj->type)
{
case E_GADCON_TYPE:
e_shelf_toggle(e_gadcon_shelf_get((E_Gadcon *)(h->obj)), 1);
break;
case E_GADCON_CLIENT_TYPE:
e_shelf_toggle(e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon), 1);
break;
/* FIXME: add more types as needed */
default:
break;
}
}
}
static void
_e_drag_win_hide(E_Drop_Handler *h)
{
if (h->obj)
{
switch (h->obj->type)
{
case E_GADCON_TYPE:
e_shelf_toggle(e_gadcon_shelf_get((E_Gadcon *)(h->obj)), 0);
break;
case E_GADCON_CLIENT_TYPE:
e_shelf_toggle(e_gadcon_shelf_get(((E_Gadcon_Client *)(h->obj))->gadcon), 0);
break;
/* FIXME: add more types as needed */
default:
break;
}
}
}
static void
_e_drag_update(int x, int y)
{
@ -632,6 +674,7 @@ _e_drag_update(int x, int y)
{
if (!h->entered)
{
_e_drag_win_show(h);
if (h->cb.enter)
{
if (_drag_current->cb.convert)
@ -654,6 +697,7 @@ _e_drag_update(int x, int y)
{
if (h->cb.leave)
h->cb.leave(h->cb.data, h->active_type, &leave_ev);
_e_drag_win_hide(h);
h->entered = 0;
}
}

View File

@ -632,7 +632,7 @@ e_gadcon_util_menu_attach_func_set(E_Gadcon *gc,
gc->menu_attach.func = func;
gc->menu_attach.data = data;
}
EAPI void
e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win)
{
@ -649,6 +649,22 @@ e_gadcon_dnd_window_get(E_Gadcon *gc)
return gc->dnd_win;
}
EAPI void
e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf)
{
E_OBJECT_CHECK(gc);
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
gc->shelf = shelf;
}
EAPI E_Shelf *
e_gadcon_shelf_get(E_Gadcon *gc)
{
E_OBJECT_CHECK_RETURN(gc, NULL);
E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL);
return gc->shelf;
}
EAPI E_Config_Gadcon_Client *
e_gadcon_client_config_new(E_Gadcon *gc, const char *name)
{

View File

@ -81,6 +81,7 @@ struct _E_Gadcon
E_Config_Dialog *config_dialog;
unsigned char editing : 1;
Ecore_X_Window dnd_win;
E_Shelf *shelf;
E_Drop_Handler *drop_handler;
};
@ -181,6 +182,8 @@ EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, in
EAPI void e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Menu *menu), void *data);
EAPI void e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win);
EAPI Ecore_X_Window e_gadcon_dnd_window_get(E_Gadcon *gc);
EAPI void e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf);
EAPI E_Shelf *e_gadcon_shelf_get(E_Gadcon *gc);
EAPI E_Config_Gadcon_Client *e_gadcon_client_config_new(E_Gadcon *gc, const char *name);
EAPI E_Config_Gadcon_Client *e_gadcon_client_config_get(E_Gadcon *gc, const char *id);

View File

@ -194,6 +194,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
edje_object_message_signal_process(es->o_base);
e_gadcon_zone_set(es->gadcon, zone);
e_gadcon_ecore_evas_set(es->gadcon, es->ee);
e_gadcon_shelf_set(es->gadcon, es);
if (popup)
{
e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win);