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?
This commit is contained in:
Jean-Philippe Andre 2017-05-29 23:08:54 +09:00
parent 8bf347b228
commit bac435a49e
3 changed files with 16 additions and 3 deletions

View File

@ -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? */

View File

@ -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"

View File

@ -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; }
}
}