forked from enlightenment/efl
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.
This commit is contained in:
parent
18eaa22d01
commit
7108ca283c
|
@ -41,7 +41,7 @@ set_api_state(api_data *api)
|
|||
break;
|
||||
|
||||
case GRID_UNPACK: /* 1 */
|
||||
elm_grid_unpack(dt->grid, dt->child);
|
||||
efl_pack_unpack(dt->grid, dt->child);
|
||||
eo_del(dt->child);
|
||||
break;
|
||||
|
||||
|
@ -113,8 +113,18 @@ test_grid_static(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
|
|||
efl_ui_win_autodel_set(eo_self, EINA_TRUE),
|
||||
eo_event_callback_add(eo_self, EO_EVENT_DEL, _win_del, api));
|
||||
|
||||
gd = eo_add(EFL_UI_GRID_STATIC_CLASS, win,
|
||||
efl_gfx_size_hint_weight_set(eo_self, 1, 1));
|
||||
static int run_count = 0;
|
||||
if (((run_count++) % 2) == 0)
|
||||
{
|
||||
gd = eo_add(EFL_UI_GRID_STATIC_CLASS, win,
|
||||
efl_gfx_size_hint_weight_set(eo_self, 1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
gd = eo_add(EFL_UI_GRID_CLASS, win,
|
||||
efl_gfx_size_hint_weight_set(eo_self, 1, 1),
|
||||
efl_pack_layout_engine_set(eo_self, EFL_UI_GRID_STATIC_CLASS, NULL));
|
||||
}
|
||||
efl_pack(win, gd);
|
||||
api->data.grid = gd;
|
||||
efl_gfx_visible_set(gd, 1);
|
||||
|
|
|
@ -45,6 +45,12 @@ _efl_ui_grid_static_efl_pack_layout_layout_do(Eo_Class *klass EINA_UNUSED,
|
|||
wl = w;
|
||||
hl = h;
|
||||
mirror = elm_widget_mirrored_get(obj);
|
||||
|
||||
if (!gd->req_cols || !gd->req_rows)
|
||||
{
|
||||
WRN("Grid.Static size must be set before using! Default to 100x100.");
|
||||
efl_pack_grid_size_set(obj, 100, 100);
|
||||
}
|
||||
vwl = gd->req_cols;
|
||||
vhl = gd->req_rows;
|
||||
|
||||
|
|
Loading…
Reference in New Issue