forked from enlightenment/efl
edje: Use Eina.Size2D for min calc
This commit is contained in:
parent
942cbbed73
commit
641a58f735
|
@ -1089,13 +1089,19 @@ edje_object_update_hints_get(const Edje_Object *obj)
|
|||
EAPI void
|
||||
edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh)
|
||||
{
|
||||
efl_canvas_layout_calc_size_min(obj, minw, minh);
|
||||
Eina_Size2D sz;
|
||||
sz = efl_canvas_layout_calc_size_min(obj);
|
||||
if (minw) *minw = sz.w;
|
||||
if (minh) *minh = sz.h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh)
|
||||
{
|
||||
efl_canvas_layout_calc_size_min_restricted(obj, minw, minh, restrictedw, restrictedh);
|
||||
Eina_Size2D sz;
|
||||
sz = efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(restrictedw, restrictedh));
|
||||
if (minw) *minw = sz.w;
|
||||
if (minh) *minh = sz.h;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
|
|
@ -3147,10 +3147,10 @@ _edje_object_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
|
|||
_edje_util_freeze_val = pf2;
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
_edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED, Evas_Coord *minw, Evas_Coord *minh)
|
||||
EOLIAN Eina_Size2D
|
||||
_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);
|
||||
return efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(0, 0));
|
||||
}
|
||||
|
||||
EOLIAN Eina_Rectangle
|
||||
|
@ -3190,8 +3190,8 @@ _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
|
|||
return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 };
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
|
||||
EOLIAN Eina_Size2D
|
||||
_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Eina_Size2D restricted)
|
||||
{
|
||||
const int CALC_COUNT_LIMIT = 255;
|
||||
|
||||
|
@ -3205,13 +3205,10 @@ _edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED
|
|||
Evas_Coord ins_l, ins_r;
|
||||
Eina_Bool has_fixed_tb;
|
||||
Eina_Bool legacy_calc;
|
||||
Eina_Size2D ret;
|
||||
|
||||
if ((!ed) || (!ed->collection))
|
||||
{
|
||||
if (minw) *minw = restrictedw;
|
||||
if (minh) *minh = restrictedh;
|
||||
return;
|
||||
}
|
||||
return restricted;
|
||||
|
||||
/*
|
||||
* It decides a calculation logic according to efl_version of Edje file.
|
||||
|
@ -3235,8 +3232,8 @@ _edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED
|
|||
|
||||
again:
|
||||
//restrict minimum size to
|
||||
ed->w = restrictedw;
|
||||
ed->h = restrictedh;
|
||||
ed->w = restricted.w;
|
||||
ed->h = restricted.h;
|
||||
|
||||
max_over_w = 0;
|
||||
max_over_h = 0;
|
||||
|
@ -3338,14 +3335,14 @@ again:
|
|||
ed->w += max_over_w;
|
||||
|
||||
//exceptional handling.
|
||||
if (ed->w < restrictedw) ed->w = restrictedw;
|
||||
if (ed->w < restricted.w) ed->w = restricted.w;
|
||||
}
|
||||
if (repeat_h)
|
||||
{
|
||||
ed->h += max_over_h;
|
||||
|
||||
//exceptional handling.
|
||||
if (ed->h < restrictedh) ed->h = restrictedh;
|
||||
if (ed->h < restricted.h) ed->h = restricted.h;
|
||||
}
|
||||
|
||||
if (reset_max && (calc_count > CALC_COUNT_LIMIT))
|
||||
|
@ -3385,9 +3382,7 @@ again:
|
|||
|
||||
ed->min.w = ed->w;
|
||||
ed->min.h = ed->h;
|
||||
|
||||
if (minw) *minw = ed->min.w;
|
||||
if (minh) *minh = ed->min.h;
|
||||
ret = EINA_SIZE2D(ed->min.w, ed->min.h);
|
||||
|
||||
ed->w = orig_w;
|
||||
ed->h = orig_h;
|
||||
|
@ -3398,6 +3393,8 @@ again:
|
|||
#endif
|
||||
_edje_recalc(ed);
|
||||
ed->calc_only = EINA_FALSE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* FIXME: Correctly return other states */
|
||||
|
|
|
@ -41,11 +41,7 @@ interface Efl.Canvas.Layout_Calc
|
|||
with the last two arguments set to 0. Please refer to its
|
||||
documentation, then.
|
||||
]]
|
||||
// FIXME: Return a 2D size type (no @out values)
|
||||
params {
|
||||
@out minw: int; [[The minimum required width (return value)]]
|
||||
@out minh: int; [[The minimum required height (return value)]]
|
||||
}
|
||||
return: Eina.Size2D; [[The minimum required size.]]
|
||||
}
|
||||
calc_size_min_restricted {
|
||||
[[Calculates the minimum required size for a given layout object.
|
||||
|
@ -64,14 +60,11 @@ interface Efl.Canvas.Layout_Calc
|
|||
Warning: Be advised that invisible parts in the object will be taken
|
||||
into account in this calculation.
|
||||
]]
|
||||
// FIXME: Return a 2D size type (no @out values)
|
||||
return: Eina.Size2D; [[The minimum required size.]]
|
||||
params {
|
||||
@out minw: int; [[The minimum required width (return value)]]
|
||||
@out minh: int; [[The minimum required height (return value)]]
|
||||
@in restrictedw: int @optional; [[The minimum width constraint as
|
||||
input, $minw can not be lower than this]]
|
||||
@in restrictedh: int @optional; [[The minimum height constraint as
|
||||
input, $minh can not be lower than this]]
|
||||
@in restricted: Eina.Size2D @optional;
|
||||
[[The minimum size constraint as input, the returned size
|
||||
can not be lower than this (in both directions).]]
|
||||
}
|
||||
}
|
||||
calc_parts_extends {
|
||||
|
|
|
@ -1190,13 +1190,13 @@ _efl_ui_image_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Imag
|
|||
edje_object_calc_force(sd->img);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h)
|
||||
EOLIAN static Eina_Size2D
|
||||
_efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
|
||||
{
|
||||
if (sd->edje)
|
||||
edje_object_size_min_calc(sd->img, w, h);
|
||||
return efl_gfx_size_hint_min_get(sd->img);
|
||||
else
|
||||
evas_object_size_hint_combined_min_get(sd->img, w, h);
|
||||
return efl_gfx_size_hint_combined_min_get(sd->img);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
Loading…
Reference in New Issue