summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorTiago Rezende Campos Falcao <developer@tiagofalcao.com>2010-03-04 20:40:54 +0000
committerTiago Rezende Campos Falcao <developer@tiagofalcao.com>2010-03-04 20:40:54 +0000
commit16b4338a5da9615a4c8915c1e875db73b018b370 (patch)
tree5376db30d2b4f291e19a35ae3b4d1762173fd6be /legacy
parentabd231ccf0bd1d09d175f9e2ca37377b0851bcd2 (diff)
Adding edje_object_parts_extends_calc, to calc the geometry used by parts
SVN revision: 46876
Diffstat (limited to 'legacy')
-rw-r--r--legacy/edje/src/lib/Edje.h1
-rw-r--r--legacy/edje/src/lib/edje_util.c62
2 files changed, 63 insertions, 0 deletions
diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h
index 5bafd4a55a..9c688f78a6 100644
--- a/legacy/edje/src/lib/Edje.h
+++ b/legacy/edje/src/lib/Edje.h
@@ -449,6 +449,7 @@ extern "C" {
449 EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); 449 EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
450 EAPI void edje_object_calc_force (Evas_Object *obj); 450 EAPI void edje_object_calc_force (Evas_Object *obj);
451 EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); 451 EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
452 EAPI Eina_Bool edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
452 EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); 453 EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh);
453 EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); 454 EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part);
454 EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); 455 EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part);
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c
index 0f0d182d9e..f6528e9d2a 100644
--- a/legacy/edje/src/lib/edje_util.c
+++ b/legacy/edje/src/lib/edje_util.c
@@ -2567,6 +2567,68 @@ edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
2567 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0); 2567 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
2568} 2568}
2569 2569
2570/** Calculate the geometry used by all parts
2571 * @param obj A valid Evas_Object handle
2572 * @param x The x coordinate pointer
2573 * @param y The y coordinate pointer
2574 * @param w The width pointer
2575 * @param h The height pointer
2576 *
2577 * Calculates the geometry used by all object parts. Including out of bounds parts.
2578 */
2579EAPI Eina_Bool
2580edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
2581{
2582 Edje *ed;
2583 Evas_Coord x1 = INT_MAX, y1 = INT_MAX;
2584 Evas_Coord x2 = 0, y2 = 0;
2585 int i;
2586
2587 ed = _edje_fetch(obj);
2588 if (!ed)
2589 {
2590 if (x) *x = 0;
2591 if (y) *y = 0;
2592 if (w) *w = 0;
2593 if (h) *h = 0;
2594 return EINA_FALSE;
2595 }
2596
2597 ed->calc_only = 1;
2598
2599 /* Need to recalc before providing the object. */
2600 ed->dirty = 1;
2601 _edje_recalc_do(ed);
2602
2603 for (i = 0; i < ed->table_parts_size; i++)
2604 {
2605 Edje_Real_Part *rp;
2606 Evas_Coord rpx1, rpy1;
2607 Evas_Coord rpx2, rpy2;
2608
2609 rp = ed->table_parts[i];
2610
2611 rpx1 = rp->x;
2612 rpy1 = rp->y;
2613 rpx2 = rpx1 + rp->w;
2614 rpy2 = rpy1 + rp->h;
2615
2616 if (x1 > rpx1) x1 = rpx1;
2617 if (y1 > rpy1) y1 = rpy1;
2618 if (x2 < rpx2) x2 = rpx2;
2619 if (y2 < rpy2) y2 = rpy2;
2620 }
2621
2622 ed->calc_only = 0;
2623
2624 *x = x1;
2625 *y = y1;
2626 *w = x2 - x1;
2627 *h = y2 - y1;
2628
2629 return EINA_TRUE;
2630}
2631
2570/** Calculate minimum size 2632/** Calculate minimum size
2571 * @param obj A valid Evas_Object handle 2633 * @param obj A valid Evas_Object handle
2572 * @param minw Minimum width pointer 2634 * @param minw Minimum width pointer