Start of fix for drag and drop to autoscrolling ibar/ibox.

SVN revision: 27068
This commit is contained in:
metrics 2006-11-12 11:32:44 +00:00 committed by metrics
parent 93e6517c22
commit 5cc25e147a
7 changed files with 56 additions and 12 deletions

View File

@ -323,6 +323,20 @@ e_box_align_set(Evas_Object *obj, double ax, double ay)
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd); if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
} }
/*
* Returns the number of pixels that are hidden on the left/top side.
*/
EAPI void
e_box_align_pixel_offset_get(Evas_Object *obj, int *x, int *y)
{
E_Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
if (!sd) return;
if (x) *x = (sd->min.w - sd->w) * (1.0 - sd->align.x);
if (y) *y = (sd->min.h - sd->h) * (1.0 - sd->align.y);
}
/* local subsystem functions */ /* local subsystem functions */
static E_Box_Item * static E_Box_Item *
_e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj) _e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)

View File

@ -26,6 +26,7 @@ EAPI void e_box_min_size_get (Evas_Object *obj, Evas_Coord *minw, E
EAPI void e_box_max_size_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); EAPI void e_box_max_size_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay); EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay);
EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay); EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay);
EAPI void e_box_align_pixel_offset_get (Evas_Object *obj, int *x, int *y);
#endif #endif
#endif #endif

View File

@ -506,6 +506,9 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
case E_GADCON_TYPE: case E_GADCON_TYPE:
e_gadcon_canvas_zone_geometry_get((E_Gadcon *)(h->obj), &px, &py, NULL, NULL); e_gadcon_canvas_zone_geometry_get((E_Gadcon *)(h->obj), &px, &py, NULL, NULL);
break; break;
case E_GADCON_CLIENT_TYPE:
evas_object_geometry_get(((E_Gadcon_Client *)(h->obj))->o_box, dx, dy, dw, dh);
break;
case E_WIN_TYPE: case E_WIN_TYPE:
px = ((E_Win *)(h->obj))->x; px = ((E_Win *)(h->obj))->x;
py = ((E_Win *)(h->obj))->y; py = ((E_Win *)(h->obj))->y;
@ -518,7 +521,7 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
px = ((E_Popup *)(h->obj))->x; px = ((E_Popup *)(h->obj))->x;
py = ((E_Popup *)(h->obj))->y; py = ((E_Popup *)(h->obj))->y;
break; break;
/* FIXME: add mroe types as needed */ /* FIXME: add more types as needed */
default: default:
break; break;
} }
@ -539,6 +542,9 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
case E_GADCON_TYPE: case E_GADCON_TYPE:
hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj)); hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj));
break; break;
case E_GADCON_CLIENT_TYPE:
hwin = e_gadcon_dnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon);
break;
case E_WIN_TYPE: case E_WIN_TYPE:
hwin = ((E_Win *)(h->obj))->evas_win; hwin = ((E_Win *)(h->obj))->evas_win;
break; break;
@ -548,7 +554,7 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
case E_POPUP_TYPE: case E_POPUP_TYPE:
hwin = ((E_Popup *)(h->obj))->evas_win; hwin = ((E_Popup *)(h->obj))->evas_win;
break; break;
/* FIXME: add mroe types as needed */ /* FIXME: add more types as needed */
default: default:
break; break;
} }

View File

@ -1348,6 +1348,7 @@ _e_gadcon_cb_client_scroll_animator(void *data)
gcc->scroll_animator = NULL; gcc->scroll_animator = NULL;
return 0; return 0;
} }
return 1; return 1;
} }
@ -1356,17 +1357,26 @@ _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void
{ {
Evas_Event_Mouse_Move *ev; Evas_Event_Mouse_Move *ev;
E_Gadcon_Client *gcc; E_Gadcon_Client *gcc;
Evas_Coord x, y, w, h; Evas_Coord x, y;
ev = event_info; ev = event_info;
gcc = data; gcc = data;
evas_object_geometry_get(gcc->o_box, &x, &y, NULL, NULL);
e_gadcon_client_autoscroll_update(gcc, ev->cur.output.x - x, ev->cur.output.y - y);
}
/*
* NOTE: x & y are relative to the o_box of the gadcon.
*/
EAPI void
e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, Evas_Coord x, Evas_Coord y)
{
if (gcc->autoscroll) if (gcc->autoscroll)
{ {
Evas_Coord w, h;
double d; double d;
evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h); evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h);
x = ev->cur.output.x - x;
y = ev->cur.output.y - y;
if (e_box_orientation_get(gcc->o_box)) if (e_box_orientation_get(gcc->o_box))
{ {
if (w > 1) d = (double)x / (double)(w - 1); if (w > 1) d = (double)x / (double)(w - 1);

View File

@ -175,6 +175,7 @@ EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Co
EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h); EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll); EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, int mx, int my);
EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable); EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags); EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);

View File

@ -146,7 +146,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_geometry_get(o, &x, &y, &w, &h);
inst->drop_handler = inst->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc->gadcon), inst, e_drop_handler_add(E_OBJECT(inst->gcc), inst,
_ibar_inst_cb_enter, _ibar_inst_cb_move, _ibar_inst_cb_enter, _ibar_inst_cb_move,
_ibar_inst_cb_leave, _ibar_inst_cb_drop, _ibar_inst_cb_leave, _ibar_inst_cb_drop,
drop, 3, x, y, w, h); drop, 3, x, y, w, h);
@ -1067,6 +1067,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
Evas_Object *o, *o2; Evas_Object *o, *o2;
IBar_Icon *ic; IBar_Icon *ic;
Evas_Coord xx, yy; Evas_Coord xx, yy;
int x, y;
ev = event_info; ev = event_info;
inst = data; inst = data;
@ -1084,7 +1085,8 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
evas_object_show(o); evas_object_show(o);
evas_object_show(o2); evas_object_show(o2);
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
inst->ibar->ic_drop_before = ic; inst->ibar->ic_drop_before = ic;
if (ic) if (ic)
{ {
@ -1116,6 +1118,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
); );
_ibar_resize_handle(inst->ibar); _ibar_resize_handle(inst->ibar);
_gc_orient(inst->gcc); _gc_orient(inst->gcc);
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
} }
static void static void
@ -1125,12 +1128,14 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
Instance *inst; Instance *inst;
IBar_Icon *ic; IBar_Icon *ic;
Evas_Coord xx, yy; Evas_Coord xx, yy;
int x, y;
ev = event_info; ev = event_info;
inst = data; inst = data;
e_box_unpack(inst->ibar->o_drop); e_box_unpack(inst->ibar->o_drop);
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
inst->ibar->ic_drop_before = ic; inst->ibar->ic_drop_before = ic;
if (ic) if (ic)
{ {
@ -1162,6 +1167,7 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
); );
_ibar_resize_handle(inst->ibar); _ibar_resize_handle(inst->ibar);
_gc_orient(inst->gcc); _gc_orient(inst->gcc);
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
} }
static void static void

View File

@ -156,7 +156,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_geometry_get(o, &x, &y, &w, &h);
inst->drop_handler = inst->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc->gadcon), inst, e_drop_handler_add(E_OBJECT(inst->gcc), inst,
_ibox_inst_cb_enter, _ibox_inst_cb_move, _ibox_inst_cb_enter, _ibox_inst_cb_move,
_ibox_inst_cb_leave, _ibox_inst_cb_drop, _ibox_inst_cb_leave, _ibox_inst_cb_drop,
drop, 1, x, y, w, h); drop, 1, x, y, w, h);
@ -820,6 +820,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
Evas_Object *o, *o2; Evas_Object *o, *o2;
IBox_Icon *ic; IBox_Icon *ic;
Evas_Coord xx, yy; Evas_Coord xx, yy;
int x, y;
ev = event_info; ev = event_info;
inst = data; inst = data;
@ -837,7 +838,8 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
evas_object_show(o); evas_object_show(o);
evas_object_show(o2); evas_object_show(o2);
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx, ev->y + yy); e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
inst->ibox->ic_drop_before = ic; inst->ibox->ic_drop_before = ic;
if (ic) if (ic)
{ {
@ -869,6 +871,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
); );
_ibox_resize_handle(inst->ibox); _ibox_resize_handle(inst->ibox);
_gc_orient(inst->gcc); _gc_orient(inst->gcc);
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
} }
static void static void
@ -878,12 +881,14 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
Instance *inst; Instance *inst;
IBox_Icon *ic; IBox_Icon *ic;
Evas_Coord xx, yy; Evas_Coord xx, yy;
int x, y;
ev = event_info; ev = event_info;
inst = data; inst = data;
e_box_unpack(inst->ibox->o_drop); e_box_unpack(inst->ibox->o_drop);
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
ic = _ibox_icon_at_coord(inst->ibox, ev->x, ev->y); e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
inst->ibox->ic_drop_before = ic; inst->ibox->ic_drop_before = ic;
if (ic) if (ic)
{ {
@ -915,6 +920,7 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
); );
_ibox_resize_handle(inst->ibox); _ibox_resize_handle(inst->ibox);
_gc_orient(inst->gcc); _gc_orient(inst->gcc);
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
} }
static void static void