summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_grid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/elementary/test_ui_grid.c')
-rw-r--r--src/bin/elementary/test_ui_grid.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/bin/elementary/test_ui_grid.c b/src/bin/elementary/test_ui_grid.c
index b9b7972..7ddcdca 100644
--- a/src/bin/elementary/test_ui_grid.c
+++ b/src/bin/elementary/test_ui_grid.c
@@ -131,15 +131,15 @@ _custom_layout_update(Eo *pack, void *_pd EINA_UNUSED)
131 /* Example custom layout for grid: 131 /* Example custom layout for grid:
132 * divide space into regions of same size, place objects in center of their 132 * divide space into regions of same size, place objects in center of their
133 * cells using their min size 133 * cells using their min size
134 * Note: This is a TERRIBLE layout function (disregards align, weight, ...) 134 * Note: This is a TERRIBLE layout function (disregards align, weig.ht, ...)
135 */ 135 */
136 136
137 int rows, cols, gw, gh, gx, gy, c, r, cs, rs, gmw = 0, gmh = 0; 137 int rows, cols, c, r, cs, rs, gmw = 0, gmh = 0;
138 Eina_Iterator *it; 138 Eina_Iterator *it;
139 Eina_Rect g;
139 Eo *item; 140 Eo *item;
140 141
141 efl_gfx_size_get(pack, &gw, &gh); 142 g = efl_gfx_geometry_get(pack);
142 efl_gfx_position_get(pack, &gx, &gy);
143 143
144 efl_pack_grid_size_get(pack, &cols, &rows); 144 efl_pack_grid_size_get(pack, &cols, &rows);
145 if (!cols || !rows) goto end; 145 if (!cols || !rows) goto end;
@@ -149,16 +149,15 @@ _custom_layout_update(Eo *pack, void *_pd EINA_UNUSED)
149 { 149 {
150 if (efl_pack_grid_position_get(pack, item, &c, &r, &cs, &rs)) 150 if (efl_pack_grid_position_get(pack, item, &c, &r, &cs, &rs))
151 { 151 {
152 int x, y, mw, mh; 152 Eina_Rect m;
153 153
154 efl_gfx_size_hint_combined_min_get(item, &mw, &mh); 154 efl_gfx_size_hint_combined_min_get(item, &m.w, &m.h);
155 x = gx + c * gw / cols + (cs * gw / cols - mw) / 2; 155 m.x = g.x + c * g.w / cols + (cs * g.w / cols - m.w) / 2;
156 y = gy + r * gh / rows + (rs * gh / rows - mh) / 2; 156 m.y = g.y + r * g.h / rows + (rs * g.h / rows - m.h) / 2;
157 efl_gfx_size_set(item, mw, mh); 157 efl_gfx_geometry_set(item, m);
158 efl_gfx_position_set(item, x, y);
159 158
160 gmw = MAX(gmw, mw); 159 gmw = MAX(gmw, m.w);
161 gmh = MAX(gmh, mh); 160 gmh = MAX(gmh, m.h);
162 } 161 }
163 } 162 }
164 eina_iterator_free(it); 163 eina_iterator_free(it);