forked from enlightenment/efl
parent
a1a07c06c3
commit
24e1406536
|
@ -201,7 +201,11 @@ collections {
|
||||||
parts {
|
parts {
|
||||||
part {
|
part {
|
||||||
name: "background";
|
name: "background";
|
||||||
mouse_events: 0;
|
mouse_events: 1;
|
||||||
|
dragable {
|
||||||
|
events: "dragable";
|
||||||
|
}
|
||||||
|
|
||||||
description {
|
description {
|
||||||
state: "default" 0.0;
|
state: "default" 0.0;
|
||||||
color_class: "bg";
|
color_class: "bg";
|
||||||
|
|
|
@ -30,6 +30,7 @@ static void st_collections_group_parts_part_clip_to_id(void);
|
||||||
static void st_collections_group_parts_part_dragable_x(void);
|
static void st_collections_group_parts_part_dragable_x(void);
|
||||||
static void st_collections_group_parts_part_dragable_y(void);
|
static void st_collections_group_parts_part_dragable_y(void);
|
||||||
static void st_collections_group_parts_part_dragable_confine(void);
|
static void st_collections_group_parts_part_dragable_confine(void);
|
||||||
|
static void st_collections_group_parts_part_dragable_events(void);
|
||||||
|
|
||||||
static void ob_collections_group_parts_part_description(void);
|
static void ob_collections_group_parts_part_description(void);
|
||||||
static void st_collections_group_parts_part_description_inherit(void);
|
static void st_collections_group_parts_part_description_inherit(void);
|
||||||
|
@ -118,6 +119,7 @@ New_Statement_Handler statement_handlers[] =
|
||||||
{"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
|
{"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
|
||||||
{"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
|
{"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
|
||||||
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
|
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
|
||||||
|
{"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
|
||||||
{"collections.group.parts.part.image", st_images_image}, /* dup */
|
{"collections.group.parts.part.image", st_images_image}, /* dup */
|
||||||
{"collections.group.parts.part.images.image", st_images_image}, /* dup */
|
{"collections.group.parts.part.images.image", st_images_image}, /* dup */
|
||||||
{"collections.group.parts.part.font", st_fonts_font}, /* dup */
|
{"collections.group.parts.part.font", st_fonts_font}, /* dup */
|
||||||
|
@ -573,6 +575,7 @@ ob_collections_group_parts_part(void)
|
||||||
ep->repeat_events = 0;
|
ep->repeat_events = 0;
|
||||||
ep->clip_to_id = -1;
|
ep->clip_to_id = -1;
|
||||||
ep->dragable.confine_id = -1;
|
ep->dragable.confine_id = -1;
|
||||||
|
ep->dragable.events_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -718,6 +721,25 @@ st_collections_group_parts_part_dragable_confine(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
st_collections_group_parts_part_dragable_events(void)
|
||||||
|
{
|
||||||
|
Edje_Part_Collection *pc;
|
||||||
|
Edje_Part *ep;
|
||||||
|
|
||||||
|
check_arg_count(1);
|
||||||
|
|
||||||
|
pc = evas_list_data(evas_list_last(edje_collections));
|
||||||
|
ep = evas_list_data(evas_list_last(pc->parts));
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
name = parse_str(0);
|
||||||
|
data_queue_part_lookup(pc, name, &(ep->dragable.events_id));
|
||||||
|
free(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ob_collections_group_parts_part_description(void)
|
ob_collections_group_parts_part_description(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
/*
|
||||||
|
* vim: ts=8
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Edje.h"
|
#include "Edje.h"
|
||||||
#include "edje_private.h"
|
#include "edje_private.h"
|
||||||
|
|
||||||
|
@ -54,14 +59,75 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
_edje_ref(ed);
|
_edje_ref(ed);
|
||||||
_edje_freeze(ed);
|
_edje_freeze(ed);
|
||||||
_edje_emit(ed, buf, rp->part->name);
|
_edje_emit(ed, buf, rp->part->name);
|
||||||
|
|
||||||
|
if (rp->events_to)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
Edje_Real_Part* events;
|
||||||
|
events = rp->events_to;
|
||||||
|
|
||||||
|
//fprintf(stderr,"rp = %s, events = %s\n", rp->part->name, events->part->name);
|
||||||
|
|
||||||
|
evas_object_geometry_get(rp->object, &x, &y, NULL, NULL);
|
||||||
|
/*
|
||||||
|
fprintf(stderr,"x = %d, y = %d\n", x, y);
|
||||||
|
fprintf(stderr,"ev->canvas.x = %d\n", ev->canvas.x);
|
||||||
|
*
|
||||||
|
x = ed->x;
|
||||||
|
y = ed->y;
|
||||||
|
*/
|
||||||
|
if ((events->part->dragable.x) || (events->part->dragable.y))
|
||||||
|
{
|
||||||
|
if (events->part->dragable.x)
|
||||||
|
{
|
||||||
|
events->drag.tmp.x = ev->canvas.x - x - (events->x + events->w/2);
|
||||||
|
events->drag.down.x = ev->canvas.x - x;
|
||||||
|
events->x = ev->canvas.x - x - events->w/2;
|
||||||
|
}
|
||||||
|
if (events->part->dragable.y)
|
||||||
|
{
|
||||||
|
events->drag.tmp.y = ev->canvas.y - y - (events->y + events->h/2);
|
||||||
|
events->drag.down.y = ev->canvas.y - y;
|
||||||
|
events->y = ev->canvas.y - y - events->h/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
|
||||||
|
_edje_emit(ed, buf, events->part->name);
|
||||||
|
ed->dirty = 1;
|
||||||
|
}
|
||||||
|
_edje_recalc(ed);
|
||||||
|
_edje_thaw(ed);
|
||||||
|
_edje_unref(ed);
|
||||||
|
_edje_ref(ed);
|
||||||
|
_edje_freeze(ed);
|
||||||
|
|
||||||
|
rp = events;
|
||||||
|
{
|
||||||
|
double dx, dy;
|
||||||
|
int dir;
|
||||||
|
|
||||||
|
dir = _edje_part_dragable_calc(ed, rp, &dx, &dy);
|
||||||
|
// fprintf(stderr,"dx = %f, dy = %f\n", dx, dy);
|
||||||
|
if ((dx != rp->drag.val.x) || (dy != rp->drag.val.y))
|
||||||
|
{
|
||||||
|
rp->drag.val.x = dx;
|
||||||
|
rp->drag.val.y = dy;
|
||||||
|
_edje_emit(ed, "drag", rp->part->name);
|
||||||
|
ed->dirty = 1;
|
||||||
|
rp->drag.need_reset = 1;
|
||||||
|
_edje_recalc(ed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
||||||
{
|
{
|
||||||
if (rp->drag.down.count == 0)
|
if (rp->drag.down.count == 0)
|
||||||
{
|
{
|
||||||
if (rp->part->dragable.x)
|
if (rp->part->dragable.x)
|
||||||
rp->drag.down.x = ev->canvas.x;
|
rp->drag.down.x = ev->canvas.x;
|
||||||
if (rp->part->dragable.y)
|
if (rp->part->dragable.y)
|
||||||
rp->drag.down.y = ev->canvas.y;
|
rp->drag.down.y = ev->canvas.y;
|
||||||
_edje_emit(ed, "drag,start", rp->part->name);
|
_edje_emit(ed, "drag,start", rp->part->name);
|
||||||
}
|
}
|
||||||
rp->drag.down.count++;
|
rp->drag.down.count++;
|
||||||
|
@ -90,9 +156,18 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ed = data;
|
ed = data;
|
||||||
rp = evas_object_data_get(obj, "real_part");
|
rp = evas_object_data_get(obj, "real_part");
|
||||||
if (!rp) return;
|
if (!rp) return;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
|
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
|
||||||
_edje_ref(ed);
|
_edje_ref(ed);
|
||||||
_edje_emit(ed, buf, rp->part->name);
|
_edje_emit(ed, buf, rp->part->name);
|
||||||
|
|
||||||
|
if(rp->events_to)
|
||||||
|
{
|
||||||
|
rp = rp->events_to;
|
||||||
|
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
|
||||||
|
_edje_emit(ed, buf, rp->part->name);
|
||||||
|
}
|
||||||
|
|
||||||
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
||||||
{
|
{
|
||||||
if (rp->drag.down.count > 0)
|
if (rp->drag.down.count > 0)
|
||||||
|
@ -132,6 +207,9 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ed = data;
|
ed = data;
|
||||||
rp = evas_object_data_get(obj, "real_part");
|
rp = evas_object_data_get(obj, "real_part");
|
||||||
if (!rp) return;
|
if (!rp) return;
|
||||||
|
if (rp->events_to)
|
||||||
|
rp = rp->events_to;
|
||||||
|
|
||||||
if (rp->still_in)
|
if (rp->still_in)
|
||||||
{
|
{
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
|
|
@ -238,6 +238,7 @@ _edje_edd_setup(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
|
||||||
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.events_id", dragable.events_id, EET_T_INT);
|
||||||
|
|
||||||
_edje_edd_edje_part_collection =
|
_edje_edd_edje_part_collection =
|
||||||
NEWD("Edje_Part_Collection",
|
NEWD("Edje_Part_Collection",
|
||||||
|
|
|
@ -85,6 +85,7 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
||||||
desc = hist->data;
|
desc = hist->data;
|
||||||
if (desc->color_class) _edje_color_class_member_add(ed, desc->color_class);
|
if (desc->color_class) _edje_color_class_member_add(ed, desc->color_class);
|
||||||
}
|
}
|
||||||
|
hist = NULL;
|
||||||
hist = evas_list_append(hist, ep);
|
hist = evas_list_append(hist, ep);
|
||||||
while (ep->dragable.confine_id >= 0)
|
while (ep->dragable.confine_id >= 0)
|
||||||
{
|
{
|
||||||
|
@ -101,6 +102,32 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
||||||
evas_list_free(hist);
|
evas_list_free(hist);
|
||||||
hist = NULL;
|
hist = NULL;
|
||||||
hist = evas_list_append(hist, ep);
|
hist = evas_list_append(hist, ep);
|
||||||
|
while (ep->dragable.events_id >= 0)
|
||||||
|
{
|
||||||
|
Edje_Part* prev;
|
||||||
|
|
||||||
|
prev = ep;
|
||||||
|
|
||||||
|
ep = evas_list_nth(ed->collection->parts,
|
||||||
|
ep->dragable.events_id);
|
||||||
|
|
||||||
|
if (!ep->dragable.x && !ep->dragable.y)
|
||||||
|
{
|
||||||
|
prev->dragable.events_id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evas_list_find(hist, ep))
|
||||||
|
{
|
||||||
|
printf("EDJE ERROR: events_to loops. invalidating loop.\n");
|
||||||
|
ep->dragable.events_id = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hist = evas_list_append(hist, ep);
|
||||||
|
}
|
||||||
|
evas_list_free(hist);
|
||||||
|
hist = NULL;
|
||||||
|
hist = evas_list_append(hist, ep);
|
||||||
while (ep->clip_to_id >= 0)
|
while (ep->clip_to_id >= 0)
|
||||||
{
|
{
|
||||||
ep = evas_list_nth(ed->collection->parts,
|
ep = evas_list_nth(ed->collection->parts,
|
||||||
|
@ -232,6 +259,18 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
||||||
if (rp->part->dragable.confine_id >= 0)
|
if (rp->part->dragable.confine_id >= 0)
|
||||||
rp->confine_to = evas_list_nth(ed->parts, rp->part->dragable.confine_id);
|
rp->confine_to = evas_list_nth(ed->parts, rp->part->dragable.confine_id);
|
||||||
|
|
||||||
|
/* replay events for dragable */
|
||||||
|
if (rp->part->dragable.events_id >= 0)
|
||||||
|
{
|
||||||
|
rp->events_to =
|
||||||
|
evas_list_nth(ed->parts,
|
||||||
|
rp->part->dragable.events_id);
|
||||||
|
/* events_to may be used only with dragable */
|
||||||
|
if (!rp->events_to->part->dragable.x &&
|
||||||
|
!rp->events_to->part->dragable.y)
|
||||||
|
rp->events_to = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
rp->swallow_params.min.w = 0;
|
rp->swallow_params.min.w = 0;
|
||||||
rp->swallow_params.min.w = 0;
|
rp->swallow_params.min.w = 0;
|
||||||
rp->swallow_params.max.w = -1;
|
rp->swallow_params.max.w = -1;
|
||||||
|
|
|
@ -182,7 +182,7 @@ struct _Edje_Font_Directory_Entry
|
||||||
char *entry; /* the name of the font */
|
char *entry; /* the name of the font */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------*/
|
/*----------*/
|
||||||
|
|
||||||
struct _Edje_Image_Directory
|
struct _Edje_Image_Directory
|
||||||
|
@ -305,6 +305,9 @@ struct _Edje_Part
|
||||||
int count_y; /* drag area divided by n (0 = no limit) */
|
int count_y; /* drag area divided by n (0 = no limit) */
|
||||||
|
|
||||||
int confine_id; /* dragging within this bit, -1 = no */
|
int confine_id; /* dragging within this bit, -1 = no */
|
||||||
|
|
||||||
|
/* davinchi */
|
||||||
|
int events_id; /* If it is used as scrollbar */
|
||||||
} dragable;
|
} dragable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -542,6 +545,7 @@ struct _Edje_Real_Part
|
||||||
Edje_Real_Part *clip_to;
|
Edje_Real_Part *clip_to;
|
||||||
|
|
||||||
Edje_Running_Program *program;
|
Edje_Running_Program *program;
|
||||||
|
Edje_Real_Part *events_to;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Edje_Running_Program
|
struct _Edje_Running_Program
|
||||||
|
|
Loading…
Reference in New Issue