summaryrefslogtreecommitdiff
path: root/src/examples/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-24 15:06:09 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-07-24 12:05:08 -0700
commit59d684284b80f6ee56d39ceff34b7ad360877902 (patch)
treedc5c611aa7664fa71b85a91a59483044821898c1 /src/examples/elementary
parenta6543fb68f411f98eb841ed922124d411e7e2a48 (diff)
efl_ui_list: make it work with item_container
This also refactors the example a little bit. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9385
Diffstat (limited to 'src/examples/elementary')
-rw-r--r--src/examples/elementary/efl_ui_list_example_1.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c
index 7c3b1e5..dcb434f 100644
--- a/src/examples/elementary/efl_ui_list_example_1.c
+++ b/src/examples/elementary/efl_ui_list_example_1.c
@@ -30,7 +30,7 @@ _list_selected(void *data EINA_UNUSED, const Efl_Event *ev)
30 Eo *item = ev->info, *tmp; 30 Eo *item = ev->info, *tmp;
31 printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_item_selected_get(item)? "selected" : "unselected")); 31 printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_item_selected_get(item)? "selected" : "unselected"));
32 32
33 Eina_Iterator *selects = efl_ui_list_selected_items_get(list); 33 Eina_Iterator *selects = efl_ui_item_container_selected_items_get(list);
34 34
35 EINA_ITERATOR_FOREACH(selects, tmp) 35 EINA_ITERATOR_FOREACH(selects, tmp)
36 printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp)); 36 printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp));
@@ -82,18 +82,18 @@ _anim_radio_changed(void *data, const Efl_Event *ev EINA_UNUSED)
82static void 82static void
83_scrl_btn_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) 83_scrl_btn_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
84{ 84{
85 Efl_Ui_List_Item *item = efl_ui_list_last_selected_item_get(priv_d.list); 85 Efl_Ui_List_Item *item = efl_ui_item_container_last_selected_item_get(priv_d.list);
86 printf("show [%d:%p] [%d]\n", efl_ui_item_index_get(item), item, priv_d.anim); 86 printf("show [%d:%p] [%d]\n", efl_ui_item_index_get(item), item, priv_d.anim);
87 efl_ui_list_item_scroll(priv_d.list, item, priv_d.anim); 87 efl_ui_item_container_item_scroll(priv_d.list, item, priv_d.anim);
88} 88}
89 89
90static void 90static void
91_scrl_align_btn_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) 91_scrl_align_btn_clicked(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
92{ 92{
93 Efl_Ui_List_Item *item = efl_ui_list_last_selected_item_get(priv_d.list); 93 Efl_Ui_List_Item *item = efl_ui_item_container_last_selected_item_get(priv_d.list);
94 double align = efl_ui_range_value_get(priv_d.slider); 94 double align = efl_ui_range_value_get(priv_d.slider);
95 printf("show [%d:%p] [%.2lf], [%d]\n", efl_ui_item_index_get(item), item, align, priv_d.anim); 95 printf("show [%d:%p] [%.2lf], [%d]\n", efl_ui_item_index_get(item), item, align, priv_d.anim);
96 efl_ui_list_item_scroll_align(priv_d.list, item, align, priv_d.anim); 96 efl_ui_item_container_item_scroll_align(priv_d.list, item, align, priv_d.anim);
97} 97}
98 98
99EAPI_MAIN int 99EAPI_MAIN int
@@ -108,10 +108,12 @@ elm_main(int argc EINA_UNUSED, char **argv)
108 char buf[256]; 108 char buf[256];
109 Eina_Bool placeholder = EINA_FALSE; 109 Eina_Bool placeholder = EINA_FALSE;
110 110
111 win = elm_win_util_standard_add("list", "list"); 111
112 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 112 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
113 elm_win_autodel_set(win, EINA_TRUE); 113 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
114 efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 800)); 114 efl_text_set(efl_added, "Efl.Ui.List"),
115 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
116
115 117
116 wbox = efl_add(EFL_UI_BOX_CLASS, win); 118 wbox = efl_add(EFL_UI_BOX_CLASS, win);
117 efl_ui_layout_orientation_set(wbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL); 119 efl_ui_layout_orientation_set(wbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
@@ -286,8 +288,10 @@ elm_main(int argc EINA_UNUSED, char **argv)
286 efl_ui_radio_state_value_set(radio, 1); 288 efl_ui_radio_state_value_set(radio, 1);
287 efl_pack_end(rbox, radio); 289 efl_pack_end(rbox, radio);
288 efl_pack_end(bbox, rbox); 290 efl_pack_end(bbox, rbox);
291 efl_ui_radio_group_selected_value_set(rbox, 0);
289 efl_event_callback_add(rbox, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _anim_radio_changed, rbox); 292 efl_event_callback_add(rbox, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _anim_radio_changed, rbox);
290 293
294
291 rbox = efl_add(EFL_UI_BOX_CLASS, bbox); 295 rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
292 efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL); 296 efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
293 297