efl/hint: add doc note about max size hint

ref T8122

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D9551
This commit is contained in:
Mike Blumenkrantz 2019-08-09 15:13:09 -04:00 committed by Cedric BAIL
parent 144d086fd7
commit c375bbcfa7
2 changed files with 26 additions and 3 deletions

View File

@ -65,6 +65,10 @@ interface Efl.Gfx.Hint
Note: Smart objects (such as elementary) can have their own
hint policy. So calling this API may or may not affect
the size of smart objects.
Note: It is an error for the @.hint_size_max to be smaller in either axis
than @.hint_size_min. In this scenario, the max size hint will be
prioritized over the user min size hint.
]]
values {
sz: Eina.Size2D; [[Maximum size (hint) in pixels, (-1, -1) by
@ -85,6 +89,10 @@ interface Efl.Gfx.Hint
Note: This property is meant to be set by applications and not by
EFL itself. Use this to request a specific size (treated as minimum
size).
Note: It is an error for the @.hint_size_max to be smaller in either axis
than @.hint_size_min. In this scenario, the max size hint will be
prioritized over the user min size hint.
]]
values {
sz: Eina.Size2D; [[Minimum size (hint) in pixels.]]

View File

@ -1479,8 +1479,16 @@ _efl_canvas_object_efl_gfx_hint_hint_size_combined_min_get(const Eo *eo_obj EINA
if ((!obj->size_hints) || obj->delete_me)
return sz;
sz.w = MAX(obj->size_hints->min.w, obj->size_hints->user_min.w);
sz.h = MAX(obj->size_hints->min.h, obj->size_hints->user_min.h);
sz.w = obj->size_hints->user_min.w;
if (obj->size_hints->max.w != -1)
sz.w = obj->size_hints->max.w;
sz.h = obj->size_hints->user_min.h;
if (obj->size_hints->max.h != -1)
sz.h = obj->size_hints->max.h;
/* clamp user min to user max here */
sz.w = MAX(obj->size_hints->min.w, MIN(sz.w, obj->size_hints->user_min.w));
sz.h = MAX(obj->size_hints->min.h, MIN(sz.h, obj->size_hints->user_min.h));
return sz;
}
@ -1509,6 +1517,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_max_set(Eo *eo_obj, Evas_Object_Protec
if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return;
obj->size_hints->max.w = sz.w;
obj->size_hints->max.h = sz.h;
if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w))
ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w);
if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h))
ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h);
evas_object_inform_call_changed_size_hints(eo_obj, obj);
}
@ -1572,7 +1584,10 @@ _efl_canvas_object_efl_gfx_hint_hint_size_min_set(Eo *eo_obj, Evas_Object_Protec
}
if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return;
obj->size_hints->user_min = sz;
if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->user_min.w))
ERR("max width hint is now smaller than user_min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->user_min.w);
if ((obj->size_hints->max.h != -1) && (obj->size_hints->max.h < obj->size_hints->user_min.h))
ERR("max height hint is now smaller than user_min height hint! (%d < %d)", obj->size_hints->max.h, obj->size_hints->user_min.h);
evas_object_inform_call_changed_size_hints(eo_obj, obj);
}