forked from enlightenment/efl
the basics of dragables work. signals are generated properly. there's calls
to set/get dragable size relative to its confie and is value relative to its cofine, query what directiosn a dragable can be dragged. you shoudl be able to do scrollbars - except scroll arrows internally in edje making the scrollbar move. SVN revision: 7324
This commit is contained in:
parent
0e51283491
commit
d3ad6fedd9
|
@ -448,6 +448,13 @@ static void
|
|||
cb (void *data, Evas_Object *o, const char *sig, const char *src)
|
||||
{
|
||||
// printf("CALLBACK for %p %p \"%s\" \"%s\"\n", data, o, sig, src);
|
||||
if (!strcmp(sig, "drag"))
|
||||
{
|
||||
double x, y;
|
||||
|
||||
edje_object_part_drag_value_get(o, src, &x, &y);
|
||||
printf("Drag %3.3f %3.3f\n", x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -680,6 +687,9 @@ test_setup(char *file, char *name)
|
|||
edje_object_file_set(o, file, name);
|
||||
// edje_object_signal_callback_add(o, "do_it", "the_source", cb, NULL);
|
||||
// edje_object_signal_callback_add(o, "mouse,*", "logo", cb, NULL);
|
||||
// edje_object_signal_callback_add(o, "*", "*", cb, NULL);
|
||||
// edje_object_part_drag_size_set(o, "dragable", 0.01, 0.5);
|
||||
// edje_object_part_drag_value_set(o, "dragable", 0.5, 0.5);
|
||||
evas_object_move(o, 10 + 10, 10 + 20);
|
||||
evas_object_show(o);
|
||||
edje_object_size_min_get(o, &(de->minw), &(de->minh));
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#include <Evas.h>
|
||||
|
||||
#define EDJE_DRAG_DIR_NONE 0
|
||||
#define EDJE_DRAG_DIR_X 1
|
||||
#define EDJE_DRAG_DIR_Y 2
|
||||
#define EDJE_DRAG_DIR_XY 3
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -46,6 +51,11 @@ extern "C" {
|
|||
void edje_object_part_unswallow (Evas_Object *o, Evas_Object *o_swallow);
|
||||
Evas_Object *edje_object_part_swallow_get (Evas_Object *o, const char *part);
|
||||
const char *edje_object_part_state_get (Evas_Object *o, const char *part, double *val_ret);
|
||||
int edje_object_part_drag_dir_get (Evas_Object *o, const char *part);
|
||||
void edje_object_part_drag_value_set (Evas_Object *o, const char *part, double dx, double dy);
|
||||
void edje_object_part_drag_value_get (Evas_Object *o, const char *part, double *dx, double *dy);
|
||||
void edje_object_part_drag_size_set (Evas_Object *o, const char *part, double dw, double dh);
|
||||
void edje_object_part_drag_size_get (Evas_Object *o, const char *part, double *dw, double *dh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -197,6 +197,7 @@ _edje_recalc(Edje *ed)
|
|||
|
||||
ep = l->data;
|
||||
ep->calculated = 0;
|
||||
ep->calculating = 0;
|
||||
}
|
||||
for (l = ed->parts; l; l = l->next)
|
||||
{
|
||||
|
@ -209,6 +210,67 @@ _edje_recalc(Edje *ed)
|
|||
if (!ed->calc_only) ed->recalc = 0;
|
||||
}
|
||||
|
||||
int
|
||||
_edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y)
|
||||
{
|
||||
if ((ep->part->dragable.x) || (ep->part->dragable.y))
|
||||
{
|
||||
if (ep->confine_to)
|
||||
{
|
||||
double dx, dy, dw, dh;
|
||||
int ret;
|
||||
|
||||
ret = 0;
|
||||
if ((ep->part->dragable.x) && (ep->part->dragable.y)) ret = 3;
|
||||
else if (ep->part->dragable.x) ret = 1;
|
||||
else if (ep->part->dragable.y) ret = 2;
|
||||
|
||||
dx = ep->x - ep->confine_to->x;
|
||||
dw = ep->confine_to->w - ep->w;
|
||||
if (dw < 1) dw = 1;
|
||||
dx /= dw;
|
||||
|
||||
dy = ep->y - ep->confine_to->y;
|
||||
dh = ep->confine_to->h - ep->h;
|
||||
if (dh < 1) dh = 1;
|
||||
dy /= dh;
|
||||
|
||||
if (x) *x = dx;
|
||||
if (y) *y = dy;
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x) *x = (double)(ep->drag.tmp.x + ep->drag.x);
|
||||
if (y) *y = (double)(ep->drag.tmp.y + ep->drag.y);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (x) *x = 0.0;
|
||||
if (y) *y = 0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y)
|
||||
{
|
||||
if ((ep->part->dragable.x) || (ep->part->dragable.y))
|
||||
{
|
||||
if (ep->confine_to)
|
||||
{
|
||||
ep->drag.x = x;
|
||||
ep->drag.y = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
ep->drag.x = x;
|
||||
ep->drag.y = y;
|
||||
}
|
||||
}
|
||||
ed->dirty = 1;
|
||||
_edje_recalc(ed);
|
||||
}
|
||||
|
||||
static void
|
||||
_edje_part_recalc_single(Edje *ed,
|
||||
Edje_Real_Part *ep,
|
||||
|
@ -433,9 +495,14 @@ _edje_part_recalc_single(Edje *ed,
|
|||
{
|
||||
int offset;
|
||||
int step;
|
||||
double v;
|
||||
|
||||
/* complex dragable params */
|
||||
offset = params->x + ep->drag.x - confine_to->x;
|
||||
v = ep->drag.size.x * confine_to->w;
|
||||
if ((((minw > 0) && (v > minw)) || (minw <= 0)) &&
|
||||
(((maxw >= 0) && (v < maxw)) || (maxw < 0))) params->w = v;
|
||||
offset = (ep->drag.x * (confine_to->w - params->w)) +
|
||||
ep->drag.tmp.x + confine_to->x;
|
||||
if (ep->part->dragable.step_x > 0)
|
||||
{
|
||||
params->x = confine_to->x +
|
||||
|
@ -447,7 +514,11 @@ _edje_part_recalc_single(Edje *ed,
|
|||
params->x = confine_to->x +
|
||||
((offset / step) * step);
|
||||
}
|
||||
offset = params->y + ep->drag.y - confine_to->y;
|
||||
v = ep->drag.size.y * confine_to->h;
|
||||
if ((((minh > 0) && (v > minh)) || (minh <= 0)) &&
|
||||
(((maxh >= 0) && (v < maxh)) || (maxh < 0))) params->h = v;
|
||||
offset = (ep->drag.y * (confine_to->h - params->h)) +
|
||||
ep->drag.tmp.y + confine_to->y;
|
||||
if (ep->part->dragable.step_y > 0)
|
||||
{
|
||||
params->y = confine_to->y +
|
||||
|
@ -459,6 +530,10 @@ _edje_part_recalc_single(Edje *ed,
|
|||
params->y = confine_to->y +
|
||||
((offset / step) * step);
|
||||
}
|
||||
params->req_drag.x = params->x;
|
||||
params->req_drag.y = params->y;
|
||||
params->req_drag.w = params->w;
|
||||
params->req_drag.h = params->h;
|
||||
/* limit to confine */
|
||||
if (params->x < confine_to->x)
|
||||
{
|
||||
|
@ -466,7 +541,7 @@ _edje_part_recalc_single(Edje *ed,
|
|||
}
|
||||
if ((params->x + params->w) > (confine_to->x + confine_to->w))
|
||||
{
|
||||
params->x = confine_to->w - params->w;
|
||||
params->x = confine_to->x + (confine_to->w - params->w);
|
||||
}
|
||||
if (params->y < confine_to->y)
|
||||
{
|
||||
|
@ -474,14 +549,18 @@ _edje_part_recalc_single(Edje *ed,
|
|||
}
|
||||
if ((params->y + params->h) > (confine_to->y + confine_to->h))
|
||||
{
|
||||
params->y = confine_to->h - params->y;
|
||||
params->y = confine_to->y + (confine_to->h - params->h);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* simple dragable params */
|
||||
params->x += ep->drag.x;
|
||||
params->y += ep->drag.y;
|
||||
params->x += ep->drag.x + ep->drag.tmp.x;
|
||||
params->y += ep->drag.y + ep->drag.tmp.y;
|
||||
params->req_drag.x = params->x;
|
||||
params->req_drag.y = params->y;
|
||||
params->req_drag.w = params->w;
|
||||
params->req_drag.h = params->h;
|
||||
}
|
||||
/* fill */
|
||||
params->smooth = desc->fill.smooth;
|
||||
|
@ -519,29 +598,30 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
|||
double pos = 0.0;
|
||||
|
||||
if (ep->calculated) return;
|
||||
if (ep->calculating) return;
|
||||
ep->calculating = 1;
|
||||
if (ep->param1.rel1_to_x) _edje_part_recalc(ed, ep->param1.rel1_to_x);
|
||||
if (ep->param1.rel1_to_y) _edje_part_recalc(ed, ep->param1.rel1_to_y);
|
||||
if (ep->param1.rel2_to_x) _edje_part_recalc(ed, ep->param1.rel2_to_x);
|
||||
if (ep->param1.rel2_to_y) _edje_part_recalc(ed, ep->param1.rel2_to_y);
|
||||
if (ep->param1.confine_to) _edje_part_recalc(ed, ep->param1.confine_to);
|
||||
if (ep->confine_to) _edje_part_recalc(ed, ep->confine_to);
|
||||
if (ep->param2.rel1_to_x) _edje_part_recalc(ed, ep->param2.rel1_to_x);
|
||||
if (ep->param2.rel1_to_y) _edje_part_recalc(ed, ep->param2.rel1_to_y);
|
||||
if (ep->param2.rel2_to_x) _edje_part_recalc(ed, ep->param2.rel2_to_x);
|
||||
if (ep->param2.rel2_to_y) _edje_part_recalc(ed, ep->param2.rel2_to_y);
|
||||
if (ep->param2.confine_to) _edje_part_recalc(ed, ep->param2.confine_to);
|
||||
|
||||
/* actually calculate now */
|
||||
if (ep->description_pos == 0.0)
|
||||
chosen_desc = ep->param1.description;
|
||||
else
|
||||
chosen_desc = ep->param2.description;
|
||||
|
||||
|
||||
ep->chosen_description = chosen_desc;
|
||||
if (ep->param1.description)
|
||||
_edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y, ep->param1.confine_to, &p1);
|
||||
_edje_part_recalc_single(ed, ep, ep->param1.description, chosen_desc, ep->param1.rel1_to_x, ep->param1.rel1_to_y, ep->param1.rel2_to_x, ep->param1.rel2_to_y, ep->confine_to, &p1);
|
||||
if (ep->param2.description)
|
||||
{
|
||||
_edje_part_recalc_single(ed, ep, ep->param2.description, chosen_desc, ep->param2.rel1_to_x, ep->param2.rel1_to_y, ep->param2.rel2_to_x, ep->param2.rel2_to_y, ep->param2.confine_to, &p2);
|
||||
_edje_part_recalc_single(ed, ep, ep->param2.description, chosen_desc, ep->param2.rel1_to_x, ep->param2.rel1_to_y, ep->param2.rel2_to_x, ep->param2.rel2_to_y, ep->confine_to, &p2);
|
||||
|
||||
pos = ep->description_pos;
|
||||
|
||||
|
@ -577,6 +657,11 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
|||
p3.req.y = (p1.req.y * (1.0 - pos)) + (p2.req.y * (pos));
|
||||
p3.req.w = (p1.req.w * (1.0 - pos)) + (p2.req.w * (pos));
|
||||
p3.req.h = (p1.req.h * (1.0 - pos)) + (p2.req.h * (pos));
|
||||
|
||||
p3.req_drag.x = (p1.req_drag.x * (1.0 - pos)) + (p2.req_drag.x * (pos));
|
||||
p3.req_drag.y = (p1.req_drag.y * (1.0 - pos)) + (p2.req_drag.y * (pos));
|
||||
p3.req_drag.w = (p1.req_drag.w * (1.0 - pos)) + (p2.req_drag.w * (pos));
|
||||
p3.req_drag.h = (p1.req_drag.h * (1.0 - pos)) + (p2.req_drag.h * (pos));
|
||||
|
||||
p3.fill.x = (p1.fill.x * (1.0 - pos)) + (p2.fill.x * (pos));
|
||||
p3.fill.y = (p1.fill.y * (1.0 - pos)) + (p2.fill.y * (pos));
|
||||
|
@ -605,7 +690,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
|||
}
|
||||
else
|
||||
p3 = p1;
|
||||
|
||||
|
||||
if ((ep->part->color_class) && (strlen(ep->part->color_class) > 0))
|
||||
{
|
||||
Ejde_Color_Class *cc;
|
||||
|
@ -627,7 +712,26 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
|||
p3.color3.a = (((int)cc->a3 + 1) * p3.color3.a) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
ep->req.x = p3.req.x;
|
||||
ep->req.y = p3.req.y;
|
||||
ep->req.w = p3.req.w;
|
||||
ep->req.h = p3.req.h;
|
||||
|
||||
if (ep->drag.need_reset)
|
||||
{
|
||||
double dx, dy;
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
_edje_part_dragable_calc(ed, ep, &dx, &dy);
|
||||
printf("%3.3f %3.3f\n", dx, dy);
|
||||
ep->drag.x = dx;
|
||||
ep->drag.y = dy;
|
||||
ep->drag.tmp.x = 0;
|
||||
ep->drag.tmp.y = 0;
|
||||
ep->drag.need_reset = 0;
|
||||
}
|
||||
if (!ed->calc_only)
|
||||
{
|
||||
if (ep->part->type == EDJE_PART_TYPE_RECTANGLE)
|
||||
|
@ -694,4 +798,5 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep)
|
|||
ep->h = p3.h;
|
||||
|
||||
ep->calculated = 1;
|
||||
ep->calculating = 0;
|
||||
}
|
||||
|
|
|
@ -62,12 +62,27 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
|||
else
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf), "mouse,down,%i", ev->button);
|
||||
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
||||
{
|
||||
if (rp->drag.down.count == 0)
|
||||
{
|
||||
if (rp->part->dragable.x)
|
||||
rp->drag.down.x = ev->canvas.x;
|
||||
if (rp->part->dragable.y)
|
||||
rp->drag.down.y = ev->canvas.y;
|
||||
_edje_emit(ed, "drag,start", rp->part->name);
|
||||
}
|
||||
rp->drag.down.count++;
|
||||
}
|
||||
if (rp->clicked_button == 0)
|
||||
{
|
||||
rp->clicked_button = ev->button;
|
||||
rp->still_in = 1;
|
||||
}
|
||||
_edje_freeze(ed);
|
||||
_edje_emit(ed, buf, rp->part->name);
|
||||
_edje_recalc(ed);
|
||||
_edje_thaw(ed);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -84,6 +99,20 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
|||
if (!rp) return;
|
||||
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->drag.down.count > 0)
|
||||
{
|
||||
rp->drag.down.count--;
|
||||
if (rp->drag.down.count == 0)
|
||||
{
|
||||
rp->drag.need_reset = 1;
|
||||
ed->dirty = 1;
|
||||
_edje_emit(ed, "drag,stop", rp->part->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
_edje_freeze(ed);
|
||||
if ((rp->still_in) && (rp->clicked_button == ev->button))
|
||||
{
|
||||
rp->clicked_button = 0;
|
||||
|
@ -91,6 +120,8 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
|||
snprintf(buf, sizeof(buf), "mouse,clicked,%i", ev->button);
|
||||
_edje_emit(ed, buf, rp->part->name);
|
||||
}
|
||||
_edje_recalc(ed);
|
||||
_edje_thaw(ed);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -122,8 +153,40 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
|||
(ev->cur.canvas.x < (x + w)) && (ev->cur.canvas.y < (y + h)))
|
||||
rp->still_in = 1;
|
||||
}
|
||||
|
||||
_edje_freeze(ed);
|
||||
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
||||
{
|
||||
if (rp->drag.down.count > 0)
|
||||
{
|
||||
if (rp->part->dragable.x)
|
||||
rp->drag.tmp.x = ev->cur.canvas.x - rp->drag.down.x;
|
||||
if (rp->part->dragable.y)
|
||||
rp->drag.tmp.y = ev->cur.canvas.y - rp->drag.down.y;
|
||||
ed->dirty = 1;
|
||||
}
|
||||
}
|
||||
_edje_emit(ed, "mouse,move", rp->part->name);
|
||||
ed->calc_only = 1;
|
||||
_edje_recalc(ed);
|
||||
ed->calc_only = 0;
|
||||
_edje_thaw(ed);
|
||||
if ((rp->part->dragable.x) || (rp->part->dragable.y))
|
||||
{
|
||||
if (rp->drag.down.count > 0)
|
||||
{
|
||||
char buf[256];
|
||||
double dx, dy;
|
||||
int dir;
|
||||
|
||||
dir = _edje_part_dragable_calc(ed, rp, &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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -159,6 +159,8 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
|
|||
evas_object_clip_set(rp->object, rp->clip_to->object);
|
||||
}
|
||||
}
|
||||
if (rp->part->dragable.confine_id >= 0)
|
||||
rp->confine_to = evas_list_nth(ed->parts, rp->part->dragable.confine_id);
|
||||
}
|
||||
ed->dirty = 1;
|
||||
_edje_freeze(ed);
|
||||
|
|
|
@ -17,13 +17,9 @@
|
|||
|
||||
/* FIXME:
|
||||
*
|
||||
* dragables have to work
|
||||
* dragable need a way of their sizing being set relative to confine
|
||||
* drag start/top signals etc.
|
||||
* drag needs to have signals with relative pos as arg.
|
||||
* drag vals should be 0.0 -> 1.0 if drag is confined. "rest" pos = 0.0.
|
||||
* query dragable for its relative pos value
|
||||
* dragable needs to be able to affext rel/abs values of other parts
|
||||
* dragable needs to be able to affect rel/abs values of other parts
|
||||
* dragable relative value needs to be able to be applied to other part vals.
|
||||
* dragable relative value needs to be able to be set or ++/-- by actions
|
||||
*
|
||||
* more example edje files
|
||||
*
|
||||
|
@ -409,11 +405,23 @@ struct _Edje_Real_Part
|
|||
} min, max;
|
||||
} swallow_params;
|
||||
unsigned char calculated : 1;
|
||||
unsigned char calculating : 1;
|
||||
unsigned char still_in : 1;
|
||||
int clicked_button;
|
||||
Edje_Part *part;
|
||||
struct {
|
||||
int x, y;
|
||||
struct {
|
||||
unsigned count;
|
||||
int x, y;
|
||||
} down;
|
||||
struct {
|
||||
int x, y;
|
||||
} tmp;
|
||||
double x, y;
|
||||
char need_reset : 1;
|
||||
struct {
|
||||
double x, y;
|
||||
} val, size;
|
||||
} drag;
|
||||
struct {
|
||||
char *text;
|
||||
|
@ -435,9 +443,9 @@ struct _Edje_Real_Part
|
|||
Edje_Real_Part *rel1_to_y;
|
||||
Edje_Real_Part *rel2_to_x;
|
||||
Edje_Real_Part *rel2_to_y;
|
||||
Edje_Real_Part *confine_to;
|
||||
} param1, param2;
|
||||
|
||||
Edje_Real_Part *confine_to;
|
||||
Edje_Real_Part *clip_to;
|
||||
|
||||
Edje_Running_Program *program;
|
||||
|
@ -467,6 +475,9 @@ struct _Edje_Calc_Params
|
|||
struct {
|
||||
double x, y, w, h;
|
||||
} req;
|
||||
struct {
|
||||
double x, y, w, h;
|
||||
} req_drag;
|
||||
char visible : 1;
|
||||
char smooth : 1;
|
||||
struct {
|
||||
|
@ -527,7 +538,9 @@ struct _Ejde_Text_Class
|
|||
void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos);
|
||||
void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, char *d1, double v1, char *d2, double v2);
|
||||
void _edje_recalc(Edje *ed);
|
||||
|
||||
int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y);
|
||||
void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y);
|
||||
|
||||
void _edje_mouse_in_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
|
||||
void _edje_mouse_out_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
|
||||
void _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "Edje.h"
|
||||
#include "edje_private.h"
|
||||
|
||||
static void _edje_emit_cb(Edje *ed, char *sig, char *src);
|
||||
|
||||
static double _edje_frametime = 1.0 / 60.0;
|
||||
|
||||
int _edje_anim_count = 0;
|
||||
|
@ -583,43 +585,8 @@ _edje_emit(Edje *ed, char *sig, char *src)
|
|||
evas_hash_add(ec->prog_cache.matches, tmps, matches);
|
||||
}
|
||||
}
|
||||
_edje_emit_cb(ed, ee->signal, ee->source);
|
||||
if (tmps) free(tmps);
|
||||
ed->walking_callbacks = 1;
|
||||
for (l = ed->callbacks; l; l = l->next)
|
||||
{
|
||||
Edje_Signal_Callback *escb;
|
||||
|
||||
escb = l->data;
|
||||
if ((!escb->just_added) &&
|
||||
(!escb->delete_me) &&
|
||||
(_edje_glob_match(ee->signal, escb->signal)) &&
|
||||
(_edje_glob_match(ee->source, escb->source)))
|
||||
escb->func(escb->data, ed->obj, ee->signal, ee->source);
|
||||
}
|
||||
ed->walking_callbacks = 0;
|
||||
if ((ed->delete_callbacks) || (ed->just_added_callbacks))
|
||||
{
|
||||
ed->delete_callbacks = 0;
|
||||
ed->just_added_callbacks = 0;
|
||||
for (l = ed->callbacks; l;)
|
||||
{
|
||||
Edje_Signal_Callback *escb;
|
||||
Evas_List *next_l;
|
||||
|
||||
escb = l->data;
|
||||
next_l = l->next;
|
||||
if (escb->just_added)
|
||||
escb->just_added = 0;
|
||||
if (escb->delete_me)
|
||||
{
|
||||
ed->callbacks = evas_list_remove_list(ed->callbacks, l);
|
||||
free(escb->signal);
|
||||
free(escb->source);
|
||||
free(escb);
|
||||
}
|
||||
l = next_l;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(ee->signal);
|
||||
free(ee->source);
|
||||
|
@ -630,3 +597,46 @@ _edje_emit(Edje *ed, char *sig, char *src)
|
|||
recursions--;
|
||||
if (recursions == 0) recursion_limit = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_edje_emit_cb(Edje *ed, char *sig, char *src)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
ed->walking_callbacks = 1;
|
||||
for (l = ed->callbacks; l; l = l->next)
|
||||
{
|
||||
Edje_Signal_Callback *escb;
|
||||
|
||||
escb = l->data;
|
||||
if ((!escb->just_added) &&
|
||||
(!escb->delete_me) &&
|
||||
(_edje_glob_match(sig, escb->signal)) &&
|
||||
(_edje_glob_match(src, escb->source)))
|
||||
escb->func(escb->data, ed->obj, sig, src);
|
||||
}
|
||||
ed->walking_callbacks = 0;
|
||||
if ((ed->delete_callbacks) || (ed->just_added_callbacks))
|
||||
{
|
||||
ed->delete_callbacks = 0;
|
||||
ed->just_added_callbacks = 0;
|
||||
for (l = ed->callbacks; l;)
|
||||
{
|
||||
Edje_Signal_Callback *escb;
|
||||
Evas_List *next_l;
|
||||
|
||||
escb = l->data;
|
||||
next_l = l->next;
|
||||
if (escb->just_added)
|
||||
escb->just_added = 0;
|
||||
if (escb->delete_me)
|
||||
{
|
||||
ed->callbacks = evas_list_remove_list(ed->callbacks, l);
|
||||
free(escb->signal);
|
||||
free(escb->source);
|
||||
free(escb);
|
||||
}
|
||||
l = next_l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_sw
|
|||
if (!obj_swallow) return;
|
||||
rp->swallowed_object = obj_swallow;
|
||||
evas_object_smart_member_add(rp->swallowed_object, ed->obj);
|
||||
if (rp->clip_to) evas_object_clip_set(rp->object, rp->clip_to->object);
|
||||
if (rp->clip_to) evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
|
||||
else evas_object_clip_set(rp->swallowed_object, ed->clipper);
|
||||
if (evas_object_layer_get(rp->swallowed_object) != ed->layer)
|
||||
evas_object_layer_set(rp->swallowed_object, ed->layer);
|
||||
|
@ -562,7 +562,128 @@ edje_object_part_state_get(Evas_Object *obj, const char *part, double *val_ret)
|
|||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
edje_object_part_drag_dir_get(Evas_Object *obj, const char *part)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
int v;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part))
|
||||
{
|
||||
return EDJE_DRAG_DIR_NONE;
|
||||
}
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp)
|
||||
{
|
||||
return EDJE_DRAG_DIR_NONE;
|
||||
}
|
||||
if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY;
|
||||
else if (rp->part->dragable.x) return EDJE_DRAG_DIR_X;
|
||||
else if (rp->part->dragable.y) return EDJE_DRAG_DIR_Y;
|
||||
return EDJE_DRAG_DIR_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, double dy)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part))
|
||||
{
|
||||
return;
|
||||
}
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (rp->drag.down.count > 0) return;
|
||||
if (dx < 0.0) dx = 0.0;
|
||||
else if (dx > 1.0) dx = 1.0;
|
||||
if (dy < 0.0) dy = 0.0;
|
||||
else if (dy > 1.0) dy = 1.0;
|
||||
rp->drag.val.x = dx;
|
||||
rp->drag.val.y = dy;
|
||||
_edje_dragable_pos_set(ed, rp, dx, dy);
|
||||
}
|
||||
|
||||
void
|
||||
edje_object_part_drag_value_get(Evas_Object *obj, const char *part, double *dx, double *dy)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part))
|
||||
{
|
||||
if (dx) *dx = 0;
|
||||
if (dy) *dy = 0;
|
||||
return;
|
||||
}
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp)
|
||||
{
|
||||
if (dx) *dx = 0;
|
||||
if (dy) *dy = 0;
|
||||
return;
|
||||
}
|
||||
if (dx) *dx = rp->drag.val.x;
|
||||
if (dy) *dy = rp->drag.val.y;
|
||||
}
|
||||
|
||||
void
|
||||
edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, double dh)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part))
|
||||
{
|
||||
return;
|
||||
}
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (dw < 0.0) dw = 0.0;
|
||||
else if (dw > 1.0) dw = 1.0;
|
||||
if (dh < 0.0) dh = 0.0;
|
||||
else if (dh > 1.0) dh = 1.0;
|
||||
rp->drag.size.x = dw;
|
||||
rp->drag.size.y = dh;
|
||||
ed->dirty = 1;
|
||||
_edje_recalc(ed);
|
||||
}
|
||||
|
||||
void
|
||||
edje_object_part_drag_size_get(Evas_Object *obj, const char *part, double *dw, double *dh)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part))
|
||||
{
|
||||
if (dw) *dw = 0;
|
||||
if (dh) *dh = 0;
|
||||
return;
|
||||
}
|
||||
rp = _edje_real_part_get(ed, (char *)part);
|
||||
if (!rp)
|
||||
{
|
||||
if (dw) *dw = 0;
|
||||
if (dh) *dh = 0;
|
||||
return;
|
||||
}
|
||||
if (dw) *dw = rp->drag.size.x;
|
||||
if (dh) *dh = rp->drag.size.y;
|
||||
}
|
||||
|
||||
Edje_Real_Part *
|
||||
_edje_real_part_get(Edje *ed, char *part)
|
||||
|
|
Loading…
Reference in New Issue