summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <conr2d@gmail.com>2015-06-25 15:56:48 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-25 17:21:09 +0200
commitef491e697e60a6e79bec27164342bfb103d2c95a (patch)
treef88a47eb729816224266c7394dc82bdffa2c19a5
parent70e5687f6c43ffd3a66de592e625ff59c15909b6 (diff)
edje: implement methods for mouse_events with edje_part for Edje Embryo script.
Summary: In edje_embryo.c, there are the list for supported methods in script. However, methods listed from line 175 to 188 don't exist actually. This patch implements 4 methods among them. set_mouse_events(part_id, ev) get_mouse_events(part_id) set_repeat_events(part_id, rep) get_repeat_events(part_id) Reviewers: Hermet, woohyun, cedric Reviewed By: cedric Subscribers: cedric, Hermet Differential Revision: https://phab.enlightenment.org/D2766 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--data/edje/include/edje.inc4
-rw-r--r--src/lib/edje/edje_embryo.c95
-rw-r--r--src/lib/edje/edje_private.h5
-rw-r--r--src/lib/edje/edje_util.c48
4 files changed, 152 insertions, 0 deletions
diff --git a/data/edje/include/edje.inc b/data/edje/include/edje.inc
index 5a3e9dd290..98105b6c97 100644
--- a/data/edje/include/edje.inc
+++ b/data/edje/include/edje.inc
@@ -131,6 +131,10 @@ native stop_program (program_id);
131native stop_programs_on (part_id); 131native stop_programs_on (part_id);
132native set_min_size (Float:w, Float:h); 132native set_min_size (Float:w, Float:h);
133native set_max_size (Float:w, Float:h); 133native set_max_size (Float:w, Float:h);
134native set_mouse_events (part_id, ev);
135native get_mouse_events (part_id);
136native set_repeat_events(part_id, rep);
137native get_repeat_events(part_id);
134native part_swallow (part_id, GROUP:str[]); 138native part_swallow (part_id, GROUP:str[]);
135 139
136native external_param_get_int(id, param_name[]); 140native external_param_get_int(id, param_name[]);
diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c
index 2977a544d4..ddf4ebdfda 100644
--- a/src/lib/edje/edje_embryo.c
+++ b/src/lib/edje/edje_embryo.c
@@ -3462,6 +3462,96 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params)
3462 return 0; 3462 return 0;
3463} 3463}
3464 3464
3465/* set_mouse_events(part_id, ev) */
3466static Embryo_Cell
3467_edje_embryo_fn_set_mouse_events(Embryo_Program *ep, Embryo_Cell *params)
3468{
3469 int part_id = 0;
3470 Edje *ed;
3471 Edje_Real_Part *rp;
3472
3473 CHKPARAM(2);
3474
3475 part_id = params[1];
3476 if (part_id < 0) return 0;
3477
3478 ed = embryo_program_data_get(ep);
3479 rp = ed->table_parts[part_id % ed->table_parts_size];
3480
3481 if (rp)
3482 _edje_part_mouse_events_set(ed, rp, params[2]);
3483
3484 return 0;
3485}
3486
3487/* get_mouse_events(part_id) */
3488static Embryo_Cell
3489_edje_embryo_fn_get_mouse_events(Embryo_Program *ep, Embryo_Cell *params)
3490{
3491 int part_id = 0;
3492 Edje *ed;
3493 Edje_Real_Part *rp;
3494
3495 CHKPARAM(1);
3496
3497 part_id = params[1];
3498 if (part_id < 0) return 0;
3499
3500 ed = embryo_program_data_get(ep);
3501 rp = ed->table_parts[part_id % ed->table_parts_size];
3502
3503 if (rp)
3504 return (Embryo_Cell)_edje_var_int_get(ed, (int)_edje_part_mouse_events_get(ed, rp));
3505
3506 return 0;
3507
3508}
3509
3510/* set_repeat_events(part_id, rep) */
3511static Embryo_Cell
3512_edje_embryo_fn_set_repeat_events(Embryo_Program *ep, Embryo_Cell *params)
3513{
3514 int part_id = 0;
3515 Edje *ed;
3516 Edje_Real_Part *rp;
3517
3518 CHKPARAM(2);
3519
3520 part_id = params[1];
3521 if (part_id < 0) return 0;
3522
3523 ed = embryo_program_data_get(ep);
3524 rp = ed->table_parts[part_id % ed->table_parts_size];
3525
3526 if (rp)
3527 _edje_part_repeat_events_set(ed, rp, params[2]);
3528
3529 return 0;
3530}
3531
3532/* get_repeat_events(part_id) */
3533static Embryo_Cell
3534_edje_embryo_fn_get_repeat_events(Embryo_Program *ep, Embryo_Cell *params)
3535{
3536 int part_id = 0;
3537 Edje *ed;
3538 Edje_Real_Part *rp;
3539
3540 CHKPARAM(1);
3541
3542 part_id = params[1];
3543 if (part_id < 0) return 0;
3544
3545 ed = embryo_program_data_get(ep);
3546 rp = ed->table_parts[part_id % ed->table_parts_size];
3547
3548 if (rp)
3549 return (Embryo_Cell)_edje_var_int_get(ed, (int)_edje_part_repeat_events_get(ed, rp));
3550
3551 return 0;
3552
3553}
3554
3465/* part_swallow(part_id, group_name) */ 3555/* part_swallow(part_id, group_name) */
3466static Embryo_Cell 3556static Embryo_Cell
3467_edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params) 3557_edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params)
@@ -4191,6 +4281,11 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
4191 embryo_program_native_call_add(ep, "get_state_val", _edje_embryo_fn_get_state_val); 4281 embryo_program_native_call_add(ep, "get_state_val", _edje_embryo_fn_get_state_val);
4192 embryo_program_native_call_add(ep, "set_state_anim", _edje_embryo_fn_set_state_anim); 4282 embryo_program_native_call_add(ep, "set_state_anim", _edje_embryo_fn_set_state_anim);
4193 4283
4284 embryo_program_native_call_add(ep, "set_mouse_events", _edje_embryo_fn_set_mouse_events);
4285 embryo_program_native_call_add(ep, "get_mouse_events", _edje_embryo_fn_get_mouse_events);
4286 embryo_program_native_call_add(ep, "set_repeat_events", _edje_embryo_fn_set_repeat_events);
4287 embryo_program_native_call_add(ep, "get_repeat_events", _edje_embryo_fn_get_repeat_events);
4288
4194 embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow); 4289 embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
4195 4290
4196 embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int); 4291 embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 9125f1a8d4..2b1ec6b43a 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2849,6 +2849,11 @@ void _animation_get(Eo *obj, void *_pd, va_list *list);
2849void edje_signal_init(void); 2849void edje_signal_init(void);
2850void edje_signal_shutdown(void); 2850void edje_signal_shutdown(void);
2851 2851
2852Eina_Bool _edje_part_mouse_events_get(Edje *ed, Edje_Real_Part *rp);
2853void _edje_part_mouse_events_set(Edje *ed, Edje_Real_Part *rp, Eina_Bool mouse_events);
2854Eina_Bool _edje_part_repeat_events_get(Edje *ed, Edje_Real_Part *rp);
2855void _edje_part_repeat_events_set(Edje *ed, Edje_Real_Part *rp, Eina_Bool repeat_events);
2856
2852#ifdef HAVE_LIBREMIX 2857#ifdef HAVE_LIBREMIX
2853#include <remix/remix.h> 2858#include <remix/remix.h>
2854#endif 2859#endif
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index d99084b276..c7913ecbac 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -5717,4 +5717,52 @@ edje_object_part_object_name_get(const Evas_Object *obj)
5717 return rp ? rp->part->name : NULL; 5717 return rp ? rp->part->name : NULL;
5718} 5718}
5719 5719
5720Eina_Bool
5721_edje_part_mouse_events_get(Edje *ed EINA_UNUSED, Edje_Real_Part *rp)
5722{
5723 if (!rp) return EINA_FALSE;
5724
5725 return rp->part->mouse_events;
5726}
5727
5728void
5729_edje_part_mouse_events_set(Edje *ed EINA_UNUSED, Edje_Real_Part *rp, Eina_Bool mouse_events)
5730{
5731 if (!rp) return;
5732
5733 rp->part->mouse_events = !!mouse_events;
5734
5735 if (mouse_events)
5736 {
5737 evas_object_pass_events_set(rp->object, 0);
5738 _edje_callbacks_add(rp->object, ed, rp);
5739 }
5740 else
5741 {
5742 evas_object_pass_events_set(rp->object, 1);
5743 _edje_callbacks_del(rp->object, ed);
5744 }
5745}
5746
5747Eina_Bool
5748_edje_part_repeat_events_get(Edje *ed EINA_UNUSED, Edje_Real_Part *rp)
5749{
5750 if (!rp) return EINA_FALSE;
5751
5752 return rp->part->repeat_events;
5753}
5754
5755void
5756_edje_part_repeat_events_set(Edje *ed EINA_UNUSED, Edje_Real_Part *rp, Eina_Bool repeat_events)
5757{
5758 if (!rp) return;
5759
5760 rp->part->repeat_events = !!repeat_events;
5761
5762 if (repeat_events)
5763 evas_object_repeat_events_set(rp->object, 1);
5764 else
5765 evas_object_repeat_events_set(rp->object, 0);
5766}
5767
5720/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ 5768/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/