jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e36a300d36c918cfd090328170ff8f3704f85204
commit e36a300d36c918cfd090328170ff8f3704f85204 Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Thu Jun 9 15:05:36 2016 +0900 Efl: Add geometry property (combines position and size) It's a helper function that can also in the future be used to implement atomic move+resize operations. --- src/lib/efl/interfaces/efl_gfx.eo | 25 +++++++++++++++++++++++-- src/lib/evas/canvas/efl_vg.eo | 1 + src/lib/evas/canvas/evas_object.eo | 6 ++++-- src/lib/evas/canvas/evas_object_main.c | 22 ++++++++++++++++++---- src/lib/evas/canvas/evas_vg_node.c | 8 ++++++++ 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx.eo b/src/lib/efl/interfaces/efl_gfx.eo index c145c83..44dcb1d 100644 --- a/src/lib/efl/interfaces/efl_gfx.eo +++ b/src/lib/efl/interfaces/efl_gfx.eo @@ -4,8 +4,13 @@ interface Efl.Gfx { eo_prefix: efl_gfx; methods { @property position { + [[The 2D position of a canvas object. + + The position is absolute, in pixels, relative to the top-left corner + of the window, within its border decorations (application space). + ]] set { - [[Move the given Evas object to the given location inside its + [[Moves the given Evas object to the given location inside its canvas' viewport. ]] } @@ -18,8 +23,15 @@ interface Efl.Gfx { } } @property size { + [[The 2D size of a canvas object.]] set { - [[Changes the size of the given Evas object.]] + [[Changes the size of the given object. + + Note that setting the actual size of an object might be the job + of its container, so this function might have no effect. + Look at $Efl.Gfx.Size.Hint instead, when manipulating + widgets. + ]] } get { [[Retrieves the (rectangular) size of the given Evas object.]] @@ -29,6 +41,15 @@ interface Efl.Gfx { h: int; } } + @property geometry { + [[Rectangular geometry that combines both position and size.]] + values { + x: int; + y: int; + w: int; + h: int; + } + } @property color { set { [[Sets the general/main color of the given Evas object to the given diff --git a/src/lib/evas/canvas/efl_vg.eo b/src/lib/evas/canvas/efl_vg.eo index 122c0a7..647f86a 100644 --- a/src/lib/evas/canvas/efl_vg.eo +++ b/src/lib/evas/canvas/efl_vg.eo @@ -118,6 +118,7 @@ abstract Efl.VG (Eo.Base, Efl.Gfx, Efl.Gfx.Stack) Efl.Gfx.size.get; Efl.Gfx.position.set; Efl.Gfx.position.get; + Efl.Gfx.geometry.get; Efl.Gfx.Stack.below.get; Efl.Gfx.Stack.above.get; Efl.Gfx.Stack.stack_below; diff --git a/src/lib/evas/canvas/evas_object.eo b/src/lib/evas/canvas/evas_object.eo index 2acf42e..0c53fd3 100644 --- a/src/lib/evas/canvas/evas_object.eo +++ b/src/lib/evas/canvas/evas_object.eo @@ -882,12 +882,14 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack, Evas.Common_Interface.evas.get; Efl.Gfx.visible.set; Efl.Gfx.visible.get; - Efl.Gfx.position.set; - Efl.Gfx.position.get; Efl.Gfx.color.set; Efl.Gfx.color.get; Efl.Gfx.color_part.set; Efl.Gfx.color_part.get; + Efl.Gfx.geometry.set; + Efl.Gfx.geometry.get; + Efl.Gfx.position.set; + Efl.Gfx.position.get; Efl.Gfx.size.set; Efl.Gfx.size.get; Efl.Gfx.Stack.layer.set; diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 74073a8..da01354 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -833,14 +833,21 @@ end: eo_destructor(eo_super(eo_obj, MY_CLASS)); } +EOLIAN static void +_evas_object_efl_gfx_geometry_set(Eo *obj, Evas_Object_Protected_Data *pd EINA_UNUSED, + int x, int y, int w, int h) +{ + efl_gfx_position_set(obj, x, y); + efl_gfx_size_set(obj, w, h); +} + EAPI void evas_object_geometry_set(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); - efl_gfx_position_set(eo_obj, x, y); - efl_gfx_size_set(eo_obj, w, h); + efl_gfx_geometry_set(eo_obj, x, y, w, h); } EAPI void @@ -1020,6 +1027,14 @@ _evas_object_efl_gfx_size_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, evas_object_inform_call_resize(eo_obj); } +EOLIAN void +_evas_object_efl_gfx_geometry_get(Eo *obj, Evas_Object_Protected_Data *pd EINA_UNUSED, + int *x, int *y, int *w, int *h) +{ + efl_gfx_position_get(obj, x, y); + efl_gfx_size_get(obj, w, h); +} + EAPI void evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) { @@ -1030,8 +1045,7 @@ evas_object_geometry_get(const Evas_Object *eo_obj, Evas_Coord *x, Evas_Coord *y if (h) *h = 0; return; MAGIC_CHECK_END(); - efl_gfx_position_get((Eo *)eo_obj, x, y); - efl_gfx_size_get((Eo *)eo_obj, w, h); + efl_gfx_geometry_get(eo_obj, x, y, w, h); } EOLIAN static void diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index 5f17c8b..82e2c7b 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c @@ -224,6 +224,14 @@ _efl_vg_efl_gfx_size_get(Eo *obj, if (h) *h = r.h; } +EOLIAN static void +_efl_vg_efl_gfx_geometry_get(Eo *obj, Efl_VG_Data *pd EINA_UNUSED, + int *x, int *y, int *w, int *h) +{ + efl_gfx_position_get(obj, x, y); + efl_gfx_size_get(obj, w, h); +} + // Parent should be a container otherwise dismissing the stacking operation static Eina_Bool _efl_vg_parent_checked_get(Eo *obj, --