diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-08-16 13:24:10 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-08-20 10:09:56 +0200 |
commit | 2748dd8f40d9b2d733f946ce8e599f3e1e759baf (patch) | |
tree | 0c1a3e19d8c3e3133b7419bad1f3c6cee93aa93e /src | |
parent | f53596f5a61b0a1aa66238f97ee030b666a19337 (diff) | |
download | efl-2748dd8f40d9b2d733f946ce8e599f3e1e759baf.tar.gz |
elm_test: add group items
this is just to showcase them for now, for now they are positioned
wrong. later revisions will handle the correct positioning
Differential Revision: https://phab.enlightenment.org/D9585
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/elementary/test_ui_collection.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/bin/elementary/test_ui_collection.c b/src/bin/elementary/test_ui_collection.c index f049fb0dc4..b60cf35f75 100644 --- a/src/bin/elementary/test_ui_collection.c +++ b/src/bin/elementary/test_ui_collection.c @@ -86,7 +86,7 @@ _widget_del_cb(void *data, const Efl_Event *ev EINA_UNUSED) } static void -_add_item(Efl_Ui_Collection *c) +_add_item(Efl_Ui_Collection *c, Eo *cont) { Efl_Class *itc = efl_key_data_get(c, "__item_class"); char buf[PATH_MAX]; @@ -126,7 +126,7 @@ _add_item(Efl_Ui_Collection *c) efl_gfx_hint_size_min_set(il, EINA_SIZE2D(100, 180)); else efl_gfx_hint_size_min_set(il, EINA_SIZE2D(40, 40+(i%2)*40)); - efl_pack_end(c, il); + efl_pack_end(cont, il); } static void @@ -138,7 +138,7 @@ _remove_all_cb(void *data, const Efl_Event *ev EINA_UNUSED) static void _add_one_item(void *data, const Efl_Event *ev EINA_UNUSED) { - _add_item(data); + _add_item(data, data); } static void @@ -146,7 +146,7 @@ _add_thousend_items(void *data, const Efl_Event *ev EINA_UNUSED) { for (int i = 0; i < 1000; ++i) { - _add_item(data); + _add_item(data, data); } } @@ -160,7 +160,7 @@ _select_value_cb(void *data, const Efl_Event *ev) void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class *item, const char *name) { - Efl_Ui_Win *win, *o, *tbl, *item_container, *bx; + Efl_Ui_Win *win, *o, *tbl, *item_container, *bx, *git; Match_Content_Ctx *ctx = calloc(1, sizeof(*ctx)); win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), @@ -173,10 +173,25 @@ void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class item_container = o = efl_add(collection_class, win); efl_key_data_set(o, "__item_class", item); efl_event_callback_add(o, EFL_EVENT_DEL, _widget_del_cb, ctx); - for (int i = 0; i < 2000; ++i) + for (int i = 0; i < 200; ++i) { - _add_item(o); + _add_item(o, o); } + for (int j = 0; j < 5; ++j) + { + Eina_Strbuf *buf = eina_strbuf_new(); + + eina_strbuf_append_printf(buf, "Group #%d", j); + git = efl_add(EFL_UI_GROUP_ITEM_CLASS, o); + efl_text_set(git, eina_strbuf_release(buf)); + efl_pack_end(o, git); + efl_gfx_hint_size_min_set(git, EINA_SIZE2D(40, 40+40)); + for (int i = 0; i < 200; ++i) + { + _add_item(o, git); + } + } + efl_pack_table(tbl, o, 1, 0, 1, 12); ctx->c = o; |