From bac435a49e35908c1ffb6e184fbeb43ff6842731 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 29 May 2017 23:08:54 +0900 Subject: [PATCH] edje: Also implement content_get on external part This implements edje_object_part_external_object_get() using efl_content_get() on the part object. Note that there are now two ways to call APIs on the external part: - direct call to the efl_part() as if it was the object itself (implemented by composition), - get a handle with efl_content_get(efl_part()) and manipulate it directly (it is the real object). Do we need this? Do we need the composition trick? Should we have only one of those solutions implemented? --- src/lib/edje/edje_legacy.c | 3 +-- src/lib/edje/edje_part_external.c | 7 +++++++ src/lib/edje/efl_canvas_layout_external.eo | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c index 5773b58..c2608ae 100644 --- a/src/lib/edje/edje_legacy.c +++ b/src/lib/edje/edje_legacy.c @@ -122,8 +122,7 @@ edje_object_part_external_param_type_get(const Eo *obj, const char *part, const EAPI Evas_Object * edje_object_part_external_object_get(const Edje_Object *obj, const char *part) { - Edje *ed = _edje_fetch(obj); - return _edje_object_part_external_object_get(ed, part); + return efl_content_get(efl_part(obj, part)); } /* Legacy only. Shall we deprecate this API? */ diff --git a/src/lib/edje/edje_part_external.c b/src/lib/edje/edje_part_external.c index bd735e0..bcd9037 100644 --- a/src/lib/edje/edje_part_external.c +++ b/src/lib/edje/edje_part_external.c @@ -132,4 +132,11 @@ _efl_canvas_layout_external_external_param_type_get(Eo *obj, void *_pd EINA_UNUS RETURN_VAL(_edje_object_part_external_param_type_get(pd->ed, pd->part, name)); } +EOLIAN static Efl_Gfx * +_efl_canvas_layout_external_efl_container_content_get(Eo *obj, void *_pd EINA_UNUSED) +{ + PROXY_DATA_GET(obj, pd); + RETURN_VAL(_edje_object_part_external_object_get(pd->ed, pd->part)); +} + #include "efl_canvas_layout_external.eo.c" diff --git a/src/lib/edje/efl_canvas_layout_external.eo b/src/lib/edje/efl_canvas_layout_external.eo index 738c291..50f0c63 100644 --- a/src/lib/edje/efl_canvas_layout_external.eo +++ b/src/lib/edje/efl_canvas_layout_external.eo @@ -1,6 +1,7 @@ import edje_types; -class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Canvas.Object) +class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Container, + Efl.Canvas.Object) { [[Class representing an external part in Edje layouts. @@ -14,6 +15,9 @@ class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Canvas.Object) Or in pseudo-C: efl_text_set(efl_part(layout, "title"), "hello"); + The real widget represented by this part can be retrieved by calling + @Efl.Container.content.get. + @since 1.20 ]] data: null; @@ -85,4 +89,7 @@ class Efl.Canvas.Layout.External (Efl.Canvas.Layout_Internal, Efl.Canvas.Object) } */ } + implements { + Efl.Container.content { get; } + } } -- 2.7.4