edje: Merge calc_size_min_restricted & calc_size_min

calc_size_min was just a helper passing 0,0 to the restricted form.
Let's not duplicate APIs in EO and use an optional argument instead.
Bindings should be nicer and C could use a macro if it's too cumbersome
to pass in 0,0.
This commit is contained in:
Jean-Philippe Andre 2017-09-18 17:31:54 +09:00
parent 641a58f735
commit f53fe993a6
5 changed files with 13 additions and 30 deletions

View File

@ -1089,17 +1089,14 @@ edje_object_update_hints_get(const Edje_Object *obj)
EAPI void EAPI void
edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh) edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh)
{ {
Eina_Size2D sz; edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
sz = efl_canvas_layout_calc_size_min(obj);
if (minw) *minw = sz.w;
if (minh) *minh = sz.h;
} }
EAPI void EAPI void
edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh) edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh)
{ {
Eina_Size2D sz; Eina_Size2D sz;
sz = efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(restrictedw, restrictedh)); sz = efl_canvas_layout_calc_size_min(obj, EINA_SIZE2D(restrictedw, restrictedh));
if (minw) *minw = sz.w; if (minw) *minw = sz.w;
if (minh) *minh = sz.h; if (minh) *minh = sz.h;
} }

View File

@ -770,7 +770,6 @@ class Edje.Object (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part,
Efl.Canvas.Group.group_calculate; Efl.Canvas.Group.group_calculate;
Efl.Canvas.Layout_Calc.calc_auto_update_hints { get; set; } Efl.Canvas.Layout_Calc.calc_auto_update_hints { get; set; }
Efl.Canvas.Layout_Calc.calc_size_min; Efl.Canvas.Layout_Calc.calc_size_min;
Efl.Canvas.Layout_Calc.calc_size_min_restricted;
Efl.Canvas.Layout_Calc.calc_parts_extends; Efl.Canvas.Layout_Calc.calc_parts_extends;
Efl.Canvas.Layout_Calc.calc_freeze; Efl.Canvas.Layout_Calc.calc_freeze;
Efl.Canvas.Layout_Calc.calc_thaw; Efl.Canvas.Layout_Calc.calc_thaw;

View File

@ -3147,12 +3147,6 @@ _edje_object_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
_edje_util_freeze_val = pf2; _edje_util_freeze_val = pf2;
} }
EOLIAN Eina_Size2D
_edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED)
{
return efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(0, 0));
}
EOLIAN Eina_Rectangle EOLIAN Eina_Rectangle
_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed) _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed)
{ {
@ -3191,7 +3185,7 @@ _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
} }
EOLIAN Eina_Size2D EOLIAN Eina_Size2D
_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Eina_Size2D restricted) _edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Edje *ed, Eina_Size2D restricted)
{ {
const int CALC_COUNT_LIMIT = 255; const int CALC_COUNT_LIMIT = 255;

View File

@ -21,8 +21,8 @@ interface Efl.Canvas.Layout_Calc
will be notified of the size hints changes. will be notified of the size hints changes.
A layout recalculation can be triggered by @.calc_size_min(), A layout recalculation can be triggered by @.calc_size_min(),
@.calc_size_min_restricted(), @.calc_parts_extends() or even any @.calc_size_min(), @.calc_parts_extends() or even any other internal
other internal event. event.
]] ]]
set { set {
[[Enable or disable auto-update of size hints.]] [[Enable or disable auto-update of size hints.]]
@ -35,23 +35,13 @@ interface Efl.Canvas.Layout_Calc
} }
} }
calc_size_min { calc_size_min {
[[Calculates the minimum required size for a given Edje object.
This call works exactly as edje_object_size_min_restricted_calc(),
with the last two arguments set to 0. Please refer to its
documentation, then.
]]
return: Eina.Size2D; [[The minimum required size.]]
}
calc_size_min_restricted {
[[Calculates the minimum required size for a given layout object. [[Calculates the minimum required size for a given layout object.
This call will trigger an internal recalculation of all parts of This call will trigger an internal recalculation of all parts of
the object, in order to return its minimum required dimensions for the object, in order to return its minimum required dimensions for
width and height. The user might choose to impose those minimum width and height. The user might choose to impose those minimum
sizes, making the resulting calculation to get to values equal or sizes, making the resulting calculation to get to values greater or
larger than $restrictedw and $restrictedh, for width and height, equal than $restricted in both directions.
respectively.
Note: At the end of this call, the object won't be automatically Note: At the end of this call, the object won't be automatically
resized to the new dimensions, but just return the calculated sizes. resized to the new dimensions, but just return the calculated sizes.

View File

@ -1191,13 +1191,16 @@ _efl_ui_image_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Imag
} }
EOLIAN static Eina_Size2D EOLIAN static Eina_Size2D
_efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd) _efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, Eina_Size2D restricted)
{ {
if (sd->edje) if (sd->edje)
return efl_gfx_size_hint_min_get(sd->img); return efl_canvas_layout_calc_size_min(sd->img, restricted);
else else
{
// Ignore restricted here? Combine with min? Hmm...
return efl_gfx_size_hint_combined_min_get(sd->img); return efl_gfx_size_hint_combined_min_get(sd->img);
} }
}
EOLIAN static void EOLIAN static void
_efl_ui_image_efl_file_file_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char **file, const char **key) _efl_ui_image_efl_file_file_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char **file, const char **key)