Add move callback

SVN revision: 14533
This commit is contained in:
sebastid 2005-05-01 18:34:56 +00:00 committed by sebastid
parent 43b881b6ea
commit 2d9bdc762d
2 changed files with 28 additions and 0 deletions

View File

@ -61,6 +61,7 @@ typedef struct _E_Rect E_Rect;
/* convenience macro to compress code and avoid typos */
#define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
#define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
#define E_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy)))
#define E_SPANS_COMMON(x1, w1, x2, w2) (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define E_REALLOC(p, s, n) p = realloc(p, sizeof(s) * n)
#define E_NEW(s, n) calloc(n, sizeof(s))

View File

@ -154,6 +154,8 @@ e_drag_start(E_Container *con, const char *type, void *data,
void
e_drag_update(int x, int y)
{
Evas_List *l;
E_Move_Event *ev;
int w, h;
if (!drag_ee) return;
@ -168,6 +170,31 @@ e_drag_update(int x, int y)
evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h);
ecore_evas_move(drag_ee, x - (w / 2), y - (h / 2));
ev = E_NEW(E_Move_Event, 1);
if (!ev) goto end;
ev->x = x;
ev->y = y;
for (l = drop_handlers; l; l = l->next)
{
E_Drop_Handler *h;
h = l->data;
if (!h->active)
continue;
if ((h->cb.move)
&& E_INSIDE(x, y, h->x, h->y, h->w, h->h))
{
h->cb.move(h->data, drag_type, ev);
}
}
free(ev);
end:
return;
}
void