jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7108ca283c602c3b0133fc84ce3374b160086871

commit 7108ca283c602c3b0133fc84ce3374b160086871
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Jun 10 15:01:00 2016 +0900

    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.
---
 src/bin/elementary/test_grid_static.c   | 16 +++++++++++++---
 src/lib/elementary/efl_ui_grid_static.c |  6 ++++++
 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 f171cfc..55b2c5d 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)
          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);
diff --git a/src/lib/elementary/efl_ui_grid_static.c 
b/src/lib/elementary/efl_ui_grid_static.c
index a8209d2..08d29fc 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,
    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;
 

-- 


Reply via email to