summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-16 13:53:03 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-17 09:38:10 +0100
commit654b05b76fefa0706ee6d5439d0dfbf638bfee8a (patch)
treea3b4a237ef9e9dd60c96d400c5637182ac60104d
parent1e91674acd92640108765bfd734bbfe46596d1bb (diff)
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 <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11516
-rw-r--r--src/lib/edje/Edje_Eo.h1
-rw-r--r--src/lib/edje/Efl_Layout.h1
-rw-r--r--src/lib/edje/edje_part.c3
-rw-r--r--src/lib/edje/edje_part_invalid.c2
-rw-r--r--src/lib/edje/efl_canvas_layout_part.eo12
-rw-r--r--src/lib/edje/efl_canvas_layout_part_invalid.eo2
-rw-r--r--src/lib/edje/efl_canvas_layout_part_type_provider.eo20
-rw-r--r--src/lib/edje/efl_layout_group.eo2
-rw-r--r--src/lib/edje/meson.build1
-rw-r--r--src/lib/elementary/efl_ui_widget.c5
-rw-r--r--src/lib/elementary/efl_ui_widget_part.eo3
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 @@
8 8
9#include <efl_canvas_layout_types.eot.h> 9#include <efl_canvas_layout_types.eot.h>
10 10
11#include "efl_canvas_layout_part_type_provider.eo.h"
11#include "efl_canvas_layout_part.eo.h" 12#include "efl_canvas_layout_part.eo.h"
12#include "efl_canvas_layout_part_box.eo.h" 13#include "efl_canvas_layout_part_box.eo.h"
13#include "efl_canvas_layout_part_table.eo.h" 14#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" {
48 48
49#include <efl_canvas_layout_types.eot.h> 49#include <efl_canvas_layout_types.eot.h>
50 50
51#include <efl_canvas_layout_part_type_provider.eo.h>
51#include <efl_canvas_layout_part.eo.h> 52#include <efl_canvas_layout_part.eo.h>
52#include <efl_canvas_layout_part_box.eo.h> 53#include <efl_canvas_layout_part_box.eo.h>
53#include <efl_canvas_layout_part_table.eo.h> 54#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
121} 121}
122 122
123EOLIAN static Efl_Canvas_Layout_Part_Type 123EOLIAN static Efl_Canvas_Layout_Part_Type
124_efl_canvas_layout_part_part_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Layout_Part_Data *pd) 124_efl_canvas_layout_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Layout_Part_Data *pd)
125{ 125{
126 Edje_Real_Part *rp; 126 Edje_Real_Part *rp;
127 127
@@ -204,4 +204,5 @@ _efl_canvas_layout_part_efl_object_debug_name_override(Eo *obj, Efl_Canvas_Layou
204 eina_strbuf_append_printf(sb, "%s : %s : %s", pd->part, _part_type_to_string(pd->rp->type), pd->ed->group); 204 eina_strbuf_append_printf(sb, "%s : %s : %s", pd->part, _part_type_to_string(pd->rp->type), pd->ed->group);
205} 205}
206 206
207#include "efl_canvas_layout_part_type_provider.eo.c"
207#include "efl_canvas_layout_part.eo.c" 208#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
38} 38}
39 39
40EOLIAN static Efl_Canvas_Layout_Part_Type 40EOLIAN static Efl_Canvas_Layout_Part_Type
41_efl_canvas_layout_part_invalid_efl_canvas_layout_part_part_type_get(const Eo *proxy EINA_UNUSED, void *_pd EINA_UNUSED) 41_efl_canvas_layout_part_invalid_efl_canvas_layout_part_type_provider_part_type_get(const Eo *proxy EINA_UNUSED, void *_pd EINA_UNUSED)
42{ 42{
43 return EFL_CANVAS_LAYOUT_PART_TYPE_NONE; 43 return EFL_CANVAS_LAYOUT_PART_TYPE_NONE;
44} 44}
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 @@
1import efl_canvas_layout_types; 1import efl_canvas_layout_types;
2 2
3class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, Efl.Ui.Drag 3class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity, Efl.Ui.Drag, Efl.Canvas.Layout_Part_Type_Provider
4{ 4{
5 [[Common class for part proxy objects for @Efl.Canvas.Layout. 5 [[Common class for part proxy objects for @Efl.Canvas.Layout.
6 6
@@ -24,15 +24,6 @@ class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity,
24 val: double(0.0); [[The value of the state.]] 24 val: double(0.0); [[The value of the state.]]
25 } 25 }
26 } 26 }
27 @property part_type {
28 [[Type of this part in the layout.]]
29 get {
30 }
31 values {
32 type: Efl.Canvas.Layout_Part_Type(Efl.Canvas.Layout_Part_Type.none);
33 [[One of the types or $none if not an existing part.]]
34 }
35 }
36 } 27 }
37 implements { 28 implements {
38 Efl.Object.finalize; 29 Efl.Object.finalize;
@@ -45,5 +36,6 @@ class @beta Efl.Canvas.Layout_Part extends Efl.Object implements Efl.Gfx.Entity,
45 Efl.Ui.Drag.drag_step_move; 36 Efl.Ui.Drag.drag_step_move;
46 Efl.Ui.Drag.drag_page { set; get; } 37 Efl.Ui.Drag.drag_page { set; get; }
47 Efl.Ui.Drag.drag_page_move; 38 Efl.Ui.Drag.drag_page_move;
39 Efl.Canvas.Layout_Part_Type_Provider.part_type { get; }
48 } 40 }
49} 41}
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
14 implements { 14 implements {
15 // Efl.Canvas.Layout.Part 15 // Efl.Canvas.Layout.Part
16 Efl.Canvas.Layout_Part.state { get; } 16 Efl.Canvas.Layout_Part.state { get; }
17 Efl.Canvas.Layout_Part.part_type { get; } 17 Efl.Canvas.Layout_Part_Type_Provider.part_type { get; }
18 Efl.Gfx.Entity.geometry { get; } 18 Efl.Gfx.Entity.geometry { get; }
19 Efl.Ui.Drag.drag_value { set; get; } 19 Efl.Ui.Drag.drag_value { set; get; }
20 Efl.Ui.Drag.drag_size { set; get; } 20 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 @@
1import efl_canvas_layout_types;
2
3interface @beta Efl.Canvas.Layout_Part_Type_Provider
4{
5 [[Common Interface for the Part Type
6
7 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.
8 ]]
9 c_prefix: efl_canvas_layout;
10 methods {
11 @property part_type {
12 [[Type of this part in the layout.]]
13 get {
14 }
15 values {
16 type: Efl.Canvas.Layout_Part_Type(Efl.Canvas.Layout_Part_Type.none); [[One of the types or $none if not an existing part.]]
17 }
18 }
19 }
20}
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
109 does not exist, and this will return $true if the part is of type 109 does not exist, and this will return $true if the part is of type
110 $SPACER in the EDC file ($SPACER parts have type $NONE). 110 $SPACER in the EDC file ($SPACER parts have type $NONE).
111 111
112 See also @Efl.Canvas.Layout_Part.part_type. 112 See also @Efl.Canvas.Layout_Part_Type_Provider.part_type.
113 ]] 113 ]]
114 get {} 114 get {}
115 keys { 115 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 = [
32 'efl_canvas_layout_part_swallow.eo', 32 'efl_canvas_layout_part_swallow.eo',
33 'efl_canvas_layout_part_table.eo', 33 'efl_canvas_layout_part_table.eo',
34 'efl_canvas_layout_part_text.eo', 34 'efl_canvas_layout_part_text.eo',
35 'efl_canvas_layout_part_type_provider.eo',
35] 36]
36 37
37pub_eo_files = pub_legacy_eo_files 38pub_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)
5644} 5644}
5645 5645
5646static Efl_Canvas_Layout_Part_Type 5646static Efl_Canvas_Layout_Part_Type
5647_efl_ui_widget_part_efl_canvas_layout_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) 5647_efl_ui_widget_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd)
5648{ 5648{
5649 Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS); 5649 Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS);
5650 EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EFL_CANVAS_LAYOUT_PART_TYPE_NONE); 5650 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
5672 return _efl_ui_property_bind(widget, obj, pd, ppd->part, key, property); 5672 return _efl_ui_property_bind(widget, obj, pd, ppd->part, key, property);
5673} 5673}
5674 5674
5675#define EFL_UI_WIDGET_PART_EXTRA_OPS \
5676 EFL_OBJECT_OP_FUNC(efl_canvas_layout_part_type_get, _efl_ui_widget_part_efl_canvas_layout_part_type_get)
5677
5678#include "efl_ui_widget_part.eo.c" 5675#include "efl_ui_widget_part.eo.c"
5679 5676
5680/* Efl.Part end */ 5677/* 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 @@
1class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl.Gfx.Entity 1class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl.Gfx.Entity, Efl.Canvas.Layout_Part_Type_Provider
2{ 2{
3 [[This is the base class for all "Part" handles in Efl.Ui widgets. 3 [[This is the base class for all "Part" handles in Efl.Ui widgets.
4 4
@@ -17,5 +17,6 @@ class Efl.Ui.Widget_Part extends Efl.Object implements Efl.Ui.Property_Bind, Efl
17 @empty Efl.Gfx.Entity.position { get; set; } 17 @empty Efl.Gfx.Entity.position { get; set; }
18 @empty Efl.Gfx.Entity.size { get; set; } 18 @empty Efl.Gfx.Entity.size { get; set; }
19 @empty Efl.Gfx.Entity.scale { set; get; } 19 @empty Efl.Gfx.Entity.scale { set; get; }
20 Efl.Canvas.Layout_Part_Type_Provider.part_type { get; }
20 } 21 }
21} 22}