summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-10 15:01:00 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-10 15:07:49 +0900
commit7108ca283c602c3b0133fc84ce3374b160086871 (patch)
treed565adab53e00a673ae02129148e304187b52231
parent18eaa22d0126fd4f0ce3c384e626078b63918420 (diff)
Grid: Fix static grid when size was not set
Since we can change a standard grid into a static grid by changing the engine, it is necessary to fix the virtual size first.
-rw-r--r--src/bin/elementary/test_grid_static.c16
-rw-r--r--src/lib/elementary/efl_ui_grid_static.c6
2 files changed, 19 insertions, 3 deletions
diff --git a/src/bin/elementary/test_grid_static.c b/src/bin/elementary/test_grid_static.c
index f171cfc0af..55b2c5d9bf 100644
--- a/src/bin/elementary/test_grid_static.c
+++ b/src/bin/elementary/test_grid_static.c
@@ -41,7 +41,7 @@ set_api_state(api_data *api)
41 break; 41 break;
42 42
43 case GRID_UNPACK: /* 1 */ 43 case GRID_UNPACK: /* 1 */
44 elm_grid_unpack(dt->grid, dt->child); 44 efl_pack_unpack(dt->grid, dt->child);
45 eo_del(dt->child); 45 eo_del(dt->child);
46 break; 46 break;
47 47
@@ -113,8 +113,18 @@ test_grid_static(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
113 efl_ui_win_autodel_set(eo_self, EINA_TRUE), 113 efl_ui_win_autodel_set(eo_self, EINA_TRUE),
114 eo_event_callback_add(eo_self, EO_EVENT_DEL, _win_del, api)); 114 eo_event_callback_add(eo_self, EO_EVENT_DEL, _win_del, api));
115 115
116 gd = eo_add(EFL_UI_GRID_STATIC_CLASS, win, 116 static int run_count = 0;
117 efl_gfx_size_hint_weight_set(eo_self, 1, 1)); 117 if (((run_count++) % 2) == 0)
118 {
119 gd = eo_add(EFL_UI_GRID_STATIC_CLASS, win,
120 efl_gfx_size_hint_weight_set(eo_self, 1, 1));
121 }
122 else
123 {
124 gd = eo_add(EFL_UI_GRID_CLASS, win,
125 efl_gfx_size_hint_weight_set(eo_self, 1, 1),
126 efl_pack_layout_engine_set(eo_self, EFL_UI_GRID_STATIC_CLASS, NULL));
127 }
118 efl_pack(win, gd); 128 efl_pack(win, gd);
119 api->data.grid = gd; 129 api->data.grid = gd;
120 efl_gfx_visible_set(gd, 1); 130 efl_gfx_visible_set(gd, 1);
diff --git a/src/lib/elementary/efl_ui_grid_static.c b/src/lib/elementary/efl_ui_grid_static.c
index a8209d26b1..08d29fc4fb 100644
--- a/src/lib/elementary/efl_ui_grid_static.c
+++ b/src/lib/elementary/efl_ui_grid_static.c
@@ -45,6 +45,12 @@ _efl_ui_grid_static_efl_pack_layout_layout_do(Eo_Class *klass EINA_UNUSED,
45 wl = w; 45 wl = w;
46 hl = h; 46 hl = h;
47 mirror = elm_widget_mirrored_get(obj); 47 mirror = elm_widget_mirrored_get(obj);
48
49 if (!gd->req_cols || !gd->req_rows)
50 {
51 WRN("Grid.Static size must be set before using! Default to 100x100.");
52 efl_pack_grid_size_set(obj, 100, 100);
53 }
48 vwl = gd->req_cols; 54 vwl = gd->req_cols;
49 vhl = gd->req_rows; 55 vhl = gd->req_rows;
50 56