Efl: Introduce app-side min size hint

Now called "hint_min", not sure if it's the proper name for it.
At first I wanted to reuse the request size hint instead of
adding a new hint, but doing that would break Terminology
or any app that already used size_hint_request.

One problem with hint_request is that the legacy function
already exists but its support is practically not implemented.

@feature
This commit is contained in:
Jean-Philippe Andre 2016-06-09 16:24:13 +09:00
parent 1f943f29e4
commit 44f445fe76
4 changed files with 57 additions and 8 deletions

View File

@ -84,6 +84,26 @@ interface Efl.Gfx.Size.Hint
h: int; [[Integer to use as the maximum height hint.]]
}
}
@property hint_min {
[[Hints on the object's minimum size.
This is not a size enforcement in any way, it's just a hint
that should be used whenever appropriate. The object container
is in charge of fetching this property and placing the object
accordingly.
Value 0 will be treated as unset hint components, when queried
by managers.
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).
]]
values {
w: int; [[Integer to use as the maximum width hint.]]
h: int; [[Integer to use as the maximum height hint.]]
}
}
@property hint_request {
[[Hints for the object's optimum size.
@ -94,8 +114,8 @@ interface Efl.Gfx.Size.Hint
queried by managers.
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).
EFL itself. Very few containers actually implement support for
this requested size, see @.hint_min instead.
]]
values {
w: int; [[Integer to use as the preferred width hint.]]
@ -114,7 +134,7 @@ interface Efl.Gfx.Size.Hint
Note: This property is internal and meant for widget developers to
define the absolute minimum size of the object. EFL itself sets
this size internally, so any change to it from an application
might be ignored. Use @.hint_request instead.
might be ignored. Use @.hint_min instead.
]]
values {
w: int; [[Integer to use as the minimum width hint.]]
@ -123,10 +143,10 @@ interface Efl.Gfx.Size.Hint
}
@property hint_combined_min {
[[Read-only minimum size combining both @.hint_restricted_min and
@.hint_request size hints.
@.hint_min size hints.
@.hint_restricted_min is intended for mostly internal usage
and widget developers, and @.hint_request is intended to be
and widget developers, and @.hint_min is intended to be
set from application side. @.hint_combined_min combines both values
by taking their repective maximum (in both width and height), and
is used internally to get an object's minimum size.

View File

@ -907,6 +907,8 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
Efl.Gfx.Size.Hint.hint_combined_min.get;
Efl.Gfx.Size.Hint.hint_restricted_min.set;
Efl.Gfx.Size.Hint.hint_restricted_min.get;
Efl.Gfx.Size.Hint.hint_min.set;
Efl.Gfx.Size.Hint.hint_min.get;
Efl.Gfx.Size.Hint.hint_max.set;
Efl.Gfx.Size.Hint.hint_max.get;
Efl.Gfx.Size.Hint.hint_margin.set;

View File

@ -1154,8 +1154,8 @@ _evas_object_efl_gfx_size_hint_hint_combined_min_get(Eo *eo_obj EINA_UNUSED, Eva
if (h) *h = 0;
return;
}
if (w) *w = MAX(obj->size_hints->min.w, obj->size_hints->request.w);
if (h) *h = MAX(obj->size_hints->min.h, obj->size_hints->request.h);
if (w) *w = MAX(obj->size_hints->min.w, obj->size_hints->user_min.w);
if (h) *h = MAX(obj->size_hints->min.h, obj->size_hints->user_min.h);
}
EOLIAN static void
@ -1212,6 +1212,33 @@ _evas_object_efl_gfx_size_hint_hint_request_set(Eo *eo_obj, Evas_Object_Protecte
evas_object_inform_call_changed_size_hints(eo_obj);
}
EOLIAN static void
_evas_object_efl_gfx_size_hint_hint_min_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas_Coord *w, Evas_Coord *h)
{
if ((!obj->size_hints) || obj->delete_me)
{
if (w) *w = 0;
if (h) *h = 0;
return;
}
if (w) *w = obj->size_hints->user_min.w;
if (h) *h = obj->size_hints->user_min.h;
}
EOLIAN static void
_evas_object_efl_gfx_size_hint_hint_min_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Coord w, Evas_Coord h)
{
if (obj->delete_me)
return;
evas_object_async_block(obj);
_evas_object_size_hint_alloc(eo_obj, obj);
if ((obj->size_hints->user_min.w == w) && (obj->size_hints->user_min.h == h)) return;
obj->size_hints->user_min.w = w;
obj->size_hints->user_min.h = h;
evas_object_inform_call_changed_size_hints(eo_obj);
}
EOLIAN static void
_evas_object_efl_gfx_size_hint_hint_aspect_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Efl_Gfx_Size_Hint_Aspect *aspect, Evas_Coord *w, Evas_Coord *h)
{

View File

@ -940,7 +940,7 @@ struct _Evas_Double_Pair
struct _Evas_Size_Hints
{
Evas_Size min, max, request;
Evas_Size min, max, user_min, request;
Evas_Aspect aspect;
Evas_Double_Pair align, weight;
Evas_Border padding;