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.
This commit is contained in:
Jean-Philippe Andre 2016-06-09 15:05:36 +09:00
parent f773206769
commit e36a300d36
5 changed files with 54 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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