bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=654b05b76fefa0706ee6d5439d0dfbf638bfee8a
commit 654b05b76fefa0706ee6d5439d0dfbf638bfee8a Author: Marcel Hollerbach <[email protected]> Date: Mon Mar 16 13:53:03 2020 +0100 edje_part: move part_type to common interface In EFL we have multiple hirachies of parts. One in Efl.Layout namespace (alias edje) and one in Efl.Ui namespace. The seperation of these two makes sense from the perspective of hiding functionality. However, a functionality that we want to have on both is: we want to be able to check which type of part this is. In order to do so, this commit introduces a common interface, which allows that. This is required because eo is currently undergoing some works, where only APIs on a object are allowed, that are also inheriting its type, which is normal in OOP, but sometimes, due to the lack of limitation, we did that. This commit resolves one more case of that. Reviewed-by: Mike Blumenkrantz <[email protected]> Differential Revision: https://phab.enlightenment.org/D11516 --- src/lib/edje/Edje_Eo.h | 1 + src/lib/edje/Efl_Layout.h | 1 + src/lib/edje/edje_part.c | 3 ++- src/lib/edje/edje_part_invalid.c | 2 +- src/lib/edje/efl_canvas_layout_part.eo | 12 ++---------- src/lib/edje/efl_canvas_layout_part_invalid.eo | 2 +- src/lib/edje/efl_canvas_layout_part_type_provider.eo | 20 ++++++++++++++++++++ src/lib/edje/efl_layout_group.eo | 2 +- src/lib/edje/meson.build | 1 + src/lib/elementary/efl_ui_widget.c | 5 +---- src/lib/elementary/efl_ui_widget_part.eo | 3 ++- 11 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/lib/edje/Edje_Eo.h b/src/lib/edje/Edje_Eo.h index d302b44998..78a41abe83 100644 --- a/src/lib/edje/Edje_Eo.h +++ b/src/lib/edje/Edje_Eo.h @@ -8,6 +8,7 @@ #include <efl_canvas_layout_types.eot.h> +#include "efl_canvas_layout_part_type_provider.eo.h" #include "efl_canvas_layout_part.eo.h" #include "efl_canvas_layout_part_box.eo.h" #include "efl_canvas_layout_part_table.eo.h" diff --git a/src/lib/edje/Efl_Layout.h b/src/lib/edje/Efl_Layout.h index 8387984485..3fed1f381f 100644 --- a/src/lib/edje/Efl_Layout.h +++ b/src/lib/edje/Efl_Layout.h @@ -48,6 +48,7 @@ extern "C" { #include <efl_canvas_layout_types.eot.h> +#include <efl_canvas_layout_part_type_provider.eo.h> #include <efl_canvas_layout_part.eo.h> #include <efl_canvas_layout_part_box.eo.h> #include <efl_canvas_layout_part_table.eo.h> diff --git a/src/lib/edje/edje_part.c b/src/lib/edje/edje_part.c index a9014559b6..cf1aa197b4 100644 --- a/src/lib/edje/edje_part.c +++ b/src/lib/edje/edje_part.c @@ -121,7 +121,7 @@ _efl_canvas_layout_part_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Layout_P } EOLIAN static Efl_Canvas_Layout_Part_Type -_efl_canvas_layout_part_part_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Layout_Part_Data *pd) +_efl_canvas_layout_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Layout_Part_Data *pd) { Edje_Real_Part *rp; @@ -204,4 +204,5 @@ _efl_canvas_layout_part_efl_object_debug_name_override(Eo *obj, Efl_Canvas_Layou eina_strbuf_append_printf(sb, "%s : %s : %s", pd->part, _part_type_to_string(pd->rp->type), pd->ed->group); } +#include "efl_canvas_layout_part_type_provider.eo.c" #include "efl_canvas_layout_part.eo.c" diff --git a/src/lib/edje/edje_part_invalid.c b/src/lib/edje/edje_part_invalid.c index 9b939d9f72..1774d297a5 100644 --- a/src/lib/edje/edje_part_invalid.c +++ b/src/lib/edje/edje_part_invalid.c @@ -38,7 +38,7 @@ _efl_canvas_layout_part_invalid_efl_canvas_layout_part_state_get(const Eo *proxy } EOLIAN static Efl_Canvas_Layout_Part_Type -_efl_canvas_layout_part_invalid_efl_canvas_layout_part_part_type_get(const Eo *proxy EINA_UNUSED, void *_pd EINA_UNUSED) +_efl_canvas_layout_part_invalid_efl_canvas_layout_part_type_provider_part_type_get(const Eo *proxy EINA_UNUSED, void *_pd EINA_UNUSED) { return EFL_CANVAS_LAYOUT_PART_TYPE_NONE; } diff --git a/src/lib/edje/efl_canvas_layout_part.eo b/src/lib/edje/efl_canvas_layout_part.eo index 1224c49cbc..102f180b41 100644 --- a/src/lib/edje/efl_canvas_layout_part.eo +++ b/src/lib/edje/efl_canvas_layout_part.eo @@ -1,6 +1,6 @@ import efl_canvas_layout_types; -class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, Efl.Ui.Drag +class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, Efl.Ui.Drag, Efl.Canvas.Layout_Part_Type_Provider { [[Common class for part proxy objects for @Efl.Canvas.Layout. @@ -24,15 +24,6 @@ class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, val: double(0.0); [[The value of the state.]] } } - @property part_type { - [[Type of this part in the layout.]] - get { - } - values { - type: Efl.Canvas.Layout_Part_Type(Efl.Canvas.Layout_Part_Type.none); - [[One of the types or $none if not an existing part.]] - } - } } implements { Efl.Object.finalize; @@ -45,5 +36,6 @@ class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, Efl.Ui.Drag.drag_step_move; Efl.Ui.Drag.drag_page { set; get; } Efl.Ui.Drag.drag_page_move; + Efl.Canvas.Layout_Part_Type_Provider.part_type { get; } } } diff --git a/src/lib/edje/efl_canvas_layout_part_invalid.eo b/src/lib/edje/efl_canvas_layout_part_invalid.eo index 306b585b7b..ef1741dd47 100644 --- a/src/lib/edje/efl_canvas_layout_part_invalid.eo +++ b/src/lib/edje/efl_canvas_layout_part_invalid.eo @@ -14,7 +14,7 @@ class @beta Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implem implements { // Efl.Canvas.Layout.Part Efl.Canvas.Layout_Part.state { get; } - Efl.Canvas.Layout_Part.part_type { get; } + Efl.Canvas.Layout_Part_Type_Provider.part_type { get; } Efl.Gfx.Entity.geometry { get; } Efl.Ui.Drag.drag_value { set; get; } Efl.Ui.Drag.drag_size { set; get; } diff --git a/src/lib/edje/efl_canvas_layout_part_type_provider.eo b/src/lib/edje/efl_canvas_layout_part_type_provider.eo new file mode 100644 index 0000000000..ee43e045b8 --- /dev/null +++ b/src/lib/edje/efl_canvas_layout_part_type_provider.eo @@ -0,0 +1,20 @@ +import efl_canvas_layout_types; + +interface @beta Efl.Canvas.Layout_Part_Type_Provider +{ + [[Common Interface for the Part Type + + The getter for the part type is usefull for different types of part hirachies. This interface can be used to support all the different kinds of part types that are available in EFL. + ]] + c_prefix: efl_canvas_layout; + methods { + @property part_type { + [[Type of this part in the layout.]] + get { + } + values { + type: Efl.Canvas.Layout_Part_Type(Efl.Canvas.Layout_Part_Type.none); [[One of the types or $none if not an existing part.]] + } + } + } +} diff --git a/src/lib/edje/efl_layout_group.eo b/src/lib/edje/efl_layout_group.eo index 77113abc81..c50a966396 100644 --- a/src/lib/edje/efl_layout_group.eo +++ b/src/lib/edje/efl_layout_group.eo @@ -109,7 +109,7 @@ interface Efl.Layout.Group does not exist, and this will return $true if the part is of type $SPACER in the EDC file ($SPACER parts have type $NONE). - See also @Efl.Canvas.Layout_Part.part_type. + See also @Efl.Canvas.Layout_Part_Type_Provider.part_type. ]] get {} keys { diff --git a/src/lib/edje/meson.build b/src/lib/edje/meson.build index 1ab13e314c..84b8ac7318 100644 --- a/src/lib/edje/meson.build +++ b/src/lib/edje/meson.build @@ -32,6 +32,7 @@ pub_legacy_eo_files = [ 'efl_canvas_layout_part_swallow.eo', 'efl_canvas_layout_part_table.eo', 'efl_canvas_layout_part_text.eo', + 'efl_canvas_layout_part_type_provider.eo', ] pub_eo_files = pub_legacy_eo_files diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 3277ea40b9..bc6574f05a 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -5644,7 +5644,7 @@ _efl_ui_widget_part_efl_object_destructor(Eo *obj, Elm_Part_Data *pd) } static Efl_Canvas_Layout_Part_Type -_efl_ui_widget_part_efl_canvas_layout_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) +_efl_ui_widget_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) { Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS); EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EFL_CANVAS_LAYOUT_PART_TYPE_NONE); @@ -5672,9 +5672,6 @@ _efl_ui_widget_part_efl_ui_property_bind_property_bind(Eo *obj, Elm_Part_Data *p return _efl_ui_property_bind(widget, obj, pd, ppd->part, key, property); } -#define EFL_UI_WIDGET_PART_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_canvas_layout_part_type_get, _efl_ui_widget_part_efl_canvas_layout_part_type_get) - #include "efl_ui_widget_part.eo.c" /* Efl.Part end */ diff --git a/src/lib/elementary/efl_ui_widget_part.eo b/src/lib/elementary/efl_ui_widget_part.eo index 38dc129972..5329f7c6c0 100644 --- a/src/lib/elementary/efl_ui_widget_part.eo +++ b/src/lib/elementary/efl_ui_widget_part.eo @@ -1,4 +1,4 @@ -class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl.Gfx.Entity +class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl.Gfx.Entity, Efl.Canvas.Layout_Part_Type_Provider { [[This is the base class for all "Part" handles in Efl.Ui widgets. @@ -17,5 +17,6 @@ class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl @empty Efl.Gfx.Entity.position { get; set; } @empty Efl.Gfx.Entity.size { get; set; } @empty Efl.Gfx.Entity.scale { set; get; } + Efl.Canvas.Layout_Part_Type_Provider.part_type { get; } } } --
