edje: Use Eina_Rectangle for parts_extends_calc (EO)

This commit is contained in:
Jean-Philippe Andre 2017-09-13 17:11:06 +09:00
parent 21c72948db
commit 83ea35541c
4 changed files with 17 additions and 27 deletions

View File

@ -1101,7 +1101,16 @@ edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int
EAPI Eina_Bool
edje_object_parts_extends_calc(Edje_Object *obj, int *x, int *y, int *w, int *h)
{
return efl_canvas_layout_calc_parts_extends(obj, x, y, w, h);
Eina_Rectangle r = { 0, };
Edje *ed;
ed = _edje_fetch(obj);
if (ed) r = efl_canvas_layout_calc_parts_extends(obj);
if (x) *x = r.x;
if (y) *y = r.y;
if (w) *w = r.w;
if (h) *h = r.h;
return (ed != NULL);
}
EAPI int

View File

@ -3171,22 +3171,13 @@ _edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED
edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
}
EOLIAN Eina_Bool
_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
EOLIAN Eina_Rectangle
_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed)
{
Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX;
Evas_Coord xx2 = 0, yy2 = 0;
unsigned short i;
if (!ed)
{
if (x) *x = 0;
if (y) *y = 0;
if (w) *w = 0;
if (h) *h = 0;
return EINA_FALSE;
}
ed->calc_only = EINA_TRUE;
/* Need to recalc before providing the object. */
@ -3214,12 +3205,7 @@ _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
ed->calc_only = EINA_FALSE;
if (x) *x = xx1;
if (y) *y = yy1;
if (w) *w = xx2 - xx1;
if (h) *h = yy2 - yy1;
return EINA_TRUE;
return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 };
}
EOLIAN void

View File

@ -1,3 +1,5 @@
import eina_types;
interface Efl.Canvas.Layout_Calc
{
[[This interface defines a common set of APIs used to trigger calculations
@ -86,14 +88,7 @@ interface Efl.Canvas.Layout_Calc
Note: On failure, this function will make all non-$null geometry
pointers' pointed variables be set to zero.
]]
return: bool; [[$true on success, $false otherwise]]
/* FIXME: Return a 2D size type (no @out values) */
params {
@out x: int; [[The parts region's X coordinate]]
@out y: int; [[The parts region's Y coordinate]]
@out w: int; [[The parts region's width]]
@out h: int; [[The parts region's height]]
}
return: Eina.Rectangle; [[The calculated region.]]
}
calc_freeze {
[[Freezes the layout object.

View File

@ -6,7 +6,7 @@ class Efl.Canvas.Layout.Part (Efl.Object, Efl.Gfx, Efl.Ui.Drag)
As an @Efl.Part implementation class, all objects of this class are meant
to be used for one and only one function call. In pseudo-code, the use
of object of this type looks like the following:
layout.part("somepart").geometry_get(&x, &y, &w, &h);
rect = layout.part("somepart").geometry_get();
@since 1.20
]]