summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_collection.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-16 13:24:10 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-21 07:50:49 +0200
commitf0b24631c0b50476628a932925781bfae4773d7b (patch)
treed3bcb82808395592fa27764c0a2a690eb361f29a /src/bin/elementary/test_ui_collection.c
parentc36d374c69cb630d892e2c249717398dcfb29cec (diff)
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 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9585
Diffstat (limited to '')
-rw-r--r--src/bin/elementary/test_ui_collection.c29
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 f049fb0..b60cf35 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)
86} 86}
87 87
88static void 88static void
89_add_item(Efl_Ui_Collection *c) 89_add_item(Efl_Ui_Collection *c, Eo *cont)
90{ 90{
91 Efl_Class *itc = efl_key_data_get(c, "__item_class"); 91 Efl_Class *itc = efl_key_data_get(c, "__item_class");
92 char buf[PATH_MAX]; 92 char buf[PATH_MAX];
@@ -126,7 +126,7 @@ _add_item(Efl_Ui_Collection *c)
126 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(100, 180)); 126 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(100, 180));
127 else 127 else
128 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(40, 40+(i%2)*40)); 128 efl_gfx_hint_size_min_set(il, EINA_SIZE2D(40, 40+(i%2)*40));
129 efl_pack_end(c, il); 129 efl_pack_end(cont, il);
130} 130}
131 131
132static void 132static void
@@ -138,7 +138,7 @@ _remove_all_cb(void *data, const Efl_Event *ev EINA_UNUSED)
138static void 138static void
139_add_one_item(void *data, const Efl_Event *ev EINA_UNUSED) 139_add_one_item(void *data, const Efl_Event *ev EINA_UNUSED)
140{ 140{
141 _add_item(data); 141 _add_item(data, data);
142} 142}
143 143
144static void 144static void
@@ -146,7 +146,7 @@ _add_thousend_items(void *data, const Efl_Event *ev EINA_UNUSED)
146{ 146{
147 for (int i = 0; i < 1000; ++i) 147 for (int i = 0; i < 1000; ++i)
148 { 148 {
149 _add_item(data); 149 _add_item(data, data);
150 } 150 }
151} 151}
152 152
@@ -160,7 +160,7 @@ _select_value_cb(void *data, const Efl_Event *ev)
160 160
161void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class *item, const char *name) 161void create_item_container_ui(const Efl_Class *collection_class, const Efl_Class *item, const char *name)
162{ 162{
163 Efl_Ui_Win *win, *o, *tbl, *item_container, *bx; 163 Efl_Ui_Win *win, *o, *tbl, *item_container, *bx, *git;
164 Match_Content_Ctx *ctx = calloc(1, sizeof(*ctx)); 164 Match_Content_Ctx *ctx = calloc(1, sizeof(*ctx));
165 165
166 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), 166 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
173 item_container = o = efl_add(collection_class, win); 173 item_container = o = efl_add(collection_class, win);
174 efl_key_data_set(o, "__item_class", item); 174 efl_key_data_set(o, "__item_class", item);
175 efl_event_callback_add(o, EFL_EVENT_DEL, _widget_del_cb, ctx); 175 efl_event_callback_add(o, EFL_EVENT_DEL, _widget_del_cb, ctx);
176 for (int i = 0; i < 2000; ++i) 176 for (int i = 0; i < 200; ++i)
177 { 177 {
178 _add_item(o); 178 _add_item(o, o);
179 } 179 }
180 for (int j = 0; j < 5; ++j)
181 {
182 Eina_Strbuf *buf = eina_strbuf_new();
183
184 eina_strbuf_append_printf(buf, "Group #%d", j);
185 git = efl_add(EFL_UI_GROUP_ITEM_CLASS, o);
186 efl_text_set(git, eina_strbuf_release(buf));
187 efl_pack_end(o, git);
188 efl_gfx_hint_size_min_set(git, EINA_SIZE2D(40, 40+40));
189 for (int i = 0; i < 200; ++i)
190 {
191 _add_item(o, git);
192 }
193 }
194
180 efl_pack_table(tbl, o, 1, 0, 1, 12); 195 efl_pack_table(tbl, o, 1, 0, 1, 12);
181 ctx->c = o; 196 ctx->c = o;
182 197