diff options
-rw-r--r-- | src/bin/elementary/test_external.c | 10 | ||||
-rw-r--r-- | src/lib/edje/edje_part_box.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_part_external.c | 11 | ||||
-rw-r--r-- | src/lib/edje/edje_part_helper.h | 12 | ||||
-rw-r--r-- | src/lib/edje/edje_part_swallow.c | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_part_table.c | 2 | ||||
-rw-r--r-- | src/lib/edje/efl_canvas_layout_external.eo | 12 |
7 files changed, 40 insertions, 11 deletions
diff --git a/src/bin/elementary/test_external.c b/src/bin/elementary/test_external.c index 393d7fe874..616fbaeb3f 100644 --- a/src/bin/elementary/test_external.c +++ b/src/bin/elementary/test_external.c @@ -69,19 +69,17 @@ static Eina_Bool _timer_cb(void *data) { Evas_Object *edje = data; - Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb3, *pb5; + Evas_Object *bt1, *bt2, *bt3, *pb1, *pb2, *pb5; Edje_External_Param param; double progress; Eina_Value v; pb1 = edje_object_part_external_object_get(edje, "ext_pbar1"); pb2 = edje_object_part_external_object_get(edje, "ext_pbar2"); - pb3 = edje_object_part_external_object_get(edje, "ext_pbar3"); progress = elm_progressbar_value_get(pb1) + 0.0123; elm_progressbar_value_set(pb1, progress); elm_progressbar_value_set(pb2, progress); - elm_progressbar_value_set(pb3, progress); /* Test external parameter API */ param.name = "value"; @@ -100,6 +98,9 @@ _timer_cb(void *data) efl_canvas_layout_external_param_set(efl_part(edje, "ext_pbar4"), "value", &v); eina_value_flush(&v); + /* Test EO API for direct function calls */ + efl_ui_progress_value_set(efl_part(edje, "ext_pbar3"), progress); + if (progress < 1.0) return ECORE_CALLBACK_RENEW; @@ -172,6 +173,9 @@ _bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS efl_canvas_layout_external_param_set(efl_part(edje, "ext_pbar4"), "value", &v); eina_value_flush(&v); + /* Test EO API for direct function calls */ + efl_ui_progress_value_set(efl_part(edje, "ext_pbar3"), 0.0); + ecore_timer_add(0.1, _timer_cb, edje); } diff --git a/src/lib/edje/edje_part_box.c b/src/lib/edje/edje_part_box.c index 75bb2687d5..b70d3a7dd8 100644 --- a/src/lib/edje/edje_part_box.c +++ b/src/lib/edje/edje_part_box.c @@ -5,7 +5,7 @@ #include "../evas/canvas/evas_box.eo.h" -PROXY_IMPLEMENTATION(box, BOX) +PROXY_IMPLEMENTATION(box, BOX, EINA_FALSE) #undef PROXY_IMPLEMENTATION typedef struct _Part_Item_Iterator Part_Item_Iterator; diff --git a/src/lib/edje/edje_part_external.c b/src/lib/edje/edje_part_external.c index cee7fc0efd..bd735e0092 100644 --- a/src/lib/edje/edje_part_external.c +++ b/src/lib/edje/edje_part_external.c @@ -3,9 +3,18 @@ #define MY_CLASS EFL_CANVAS_LAYOUT_EXTERNAL_CLASS -PROXY_IMPLEMENTATION(external, EXTERNAL) +static void _external_compose(Eo *obj, Edje *ed, const char *part); + +PROXY_IMPLEMENTATION(external, EXTERNAL, EINA_TRUE, _external_compose(proxy, ed, rp->part->name)) #undef PROXY_IMPLEMENTATION +static void +_external_compose(Eo *obj, Edje *ed, const char *part) +{ + Eo *ext_obj = _edje_object_part_external_object_get(ed, part); + efl_composite_attach(obj, ext_obj); +} + EOLIAN static Eina_Bool _efl_canvas_layout_external_external_param_set(Eo *obj, void *_pd EINA_UNUSED, const char *name, const Eina_Value *value) diff --git a/src/lib/edje/edje_part_helper.h b/src/lib/edje/edje_part_helper.h index 136e09244b..6e1b4db6df 100644 --- a/src/lib/edje/edje_part_helper.h +++ b/src/lib/edje/edje_part_helper.h @@ -25,6 +25,10 @@ struct _Part_Item_Iterator #define RETURN_VOID do { PROXY_UNREF(obj, pd); return; } while(0) #define PROXY_CALL(a) ({ PROXY_REF(obj, pd); a; }) +#ifndef PROXY_ADD_EXTRA_OP +# define PROXY_ADD_EXTRA_OP +#endif + void _edje_real_part_set(Eo *obj, void *ed, void *rp, const char *part); /* ugly macros to avoid code duplication */ @@ -44,7 +48,7 @@ _ ## type ## _shutdown(void); \ #define PROXY_DATA_GET(obj, pd) \ Efl_Canvas_Layout_Internal_Data *pd = efl_data_scope_get(obj, EFL_CANVAS_LAYOUT_INTERNAL_CLASS) -#define PROXY_IMPLEMENTATION(type, TYPE) \ +#define PROXY_IMPLEMENTATION(type, TYPE, no_del_cb, ...) \ static Eo * _ ## type ## _proxy = NULL; \ \ static void \ @@ -87,7 +91,8 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed } \ proxy = efl_add(MY_CLASS, ed->obj, \ _edje_real_part_set(efl_added, ed, rp, rp->part->name)); \ - efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ + __VA_ARGS__; \ + if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ return proxy; \ } \ \ @@ -102,7 +107,8 @@ _edje_ ## type ## _internal_proxy_get(Edje_Object *obj EINA_UNUSED, Edje *ed, Ed proxy = _ ## type ## _proxy; \ _ ## type ## _proxy = NULL; \ _edje_real_part_set(proxy, ed, rp, rp->part->name); \ - efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ + __VA_ARGS__; \ + if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ return proxy; \ } diff --git a/src/lib/edje/edje_part_swallow.c b/src/lib/edje/edje_part_swallow.c index db24d49f70..6a94ca7982 100644 --- a/src/lib/edje/edje_part_swallow.c +++ b/src/lib/edje/edje_part_swallow.c @@ -3,7 +3,7 @@ #include "efl_canvas_layout_internal_swallow.eo.h" #define MY_CLASS EFL_CANVAS_LAYOUT_INTERNAL_SWALLOW_CLASS -PROXY_IMPLEMENTATION(swallow, SWALLOW) +PROXY_IMPLEMENTATION(swallow, SWALLOW, EINA_FALSE) #undef PROXY_IMPLEMENTATION /* Swallow parts */ diff --git a/src/lib/edje/edje_part_table.c b/src/lib/edje/edje_part_table.c index 58305bfbd0..30cf56e6e8 100644 --- a/src/lib/edje/edje_part_table.c +++ b/src/lib/edje/edje_part_table.c @@ -5,7 +5,7 @@ #include "../evas/canvas/evas_table.eo.h" -PROXY_IMPLEMENTATION(table, TABLE) +PROXY_IMPLEMENTATION(table, TABLE, EINA_FALSE) #undef PROXY_IMPLEMENTATION typedef struct _Part_Item_Iterator Part_Item_Iterator; diff --git a/src/lib/edje/efl_canvas_layout_external.eo b/src/lib/edje/efl_canvas_layout_external.eo index 0946a87799..738c291fcc 100644 --- a/src/lib/edje/efl_canvas_layout_external.eo +++ b/src/lib/edje/efl_canvas_layout_external.eo @@ -1,9 +1,19 @@ import edje_types; -class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal) +class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Canvas.Object) { [[Class representing an external part in Edje layouts. + An object of this type is an Efl.Part object, which means its lifecycle + is limited to one and only one function call. This being said, since + this special part represents exactly one standard @Efl.Canvas.Object all + the functions of that object can be called on this proxy object. + + Thus, it is possible to do the following, in pseudo-C++: + dynamic_cast<efl::Text>(layout.part("title")).text_set("hello"); + Or in pseudo-C: + efl_text_set(efl_part(layout, "title"), "hello"); + @since 1.20 ]] data: null; |