From dde62f1882c7e602dfc7cef648a68b18886cd116 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 17 Apr 2008 10:22:57 +0000 Subject: [PATCH] add another constraint-aware min calc SVN revision: 34297 --- legacy/edje/src/lib/Edje.h | 1 + legacy/edje/src/lib/edje_util.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h index e21e55a64b..deba12c63f 100644 --- a/legacy/edje/src/lib/Edje.h +++ b/legacy/edje/src/lib/Edje.h @@ -221,6 +221,7 @@ extern "C" { EAPI void edje_object_size_max_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); EAPI void edje_object_calc_force (Evas_Object *obj); EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); EAPI int edje_object_part_exists (Evas_Object *obj, const char *part); EAPI Evas_Object *edje_object_part_object_get (Evas_Object *obj, const char *part); EAPI void edje_object_part_geometry_get (Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 2f29c736b0..3a715a3172 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -1140,6 +1140,21 @@ edje_object_calc_force(Evas_Object *obj) */ EAPI void edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) +{ + edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0); +} + +/** Calculate minimum size + * @param obj A valid Evas_Object handle + * @param minw Minimum width pointer + * @param minh Minimum height pointer + * @param restrictedw Do not allow object min width calc to be less than this + * @param restrictedh Do not allow object min height calc to be less than this + * + * Calculates the object's minimum size ?! + */ +EAPI void +edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh) { Edje *ed; Evas_Coord pw, ph; @@ -1151,8 +1166,8 @@ edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) ed = _edje_fetch(obj); if ((!ed) || (!ed->collection)) { - if (minw) *minw = 0; - if (minh) *minh = 0; + if (minw) *minw = restrictedw; + if (minh) *minh = restrictedh; return; } reset_maxwh = 1; @@ -1161,8 +1176,8 @@ edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) ph = ed->h; again: - ed->w = 0; - ed->h = 0; + ed->w = restrictedw; + ed->h = restrictedh; maxw = 0; maxh = 0; @@ -1226,6 +1241,8 @@ edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh) { ed->w += maxw; ed->h += maxh; + if (ed->w < restrictedw) ed->w = restrictedw; + if (ed->h < restrictedh) ed->h = restrictedh; } if ((ed->w > 4000) || (ed->h > 4000)) {