summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-03 10:11:28 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-10 10:08:09 +0200
commit69da89139045beed4695c6d6e64bd894592decfb (patch)
tree9ad2ac489b1e81a5331c188decf3079b430d7879
parent449424d85a2247ce9959c26651256ad61e252e70 (diff)
collection view example fixes
-rw-r--r--src/examples/elementary/efl_ui_collection_view_example_1.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/examples/elementary/efl_ui_collection_view_example_1.c b/src/examples/elementary/efl_ui_collection_view_example_1.c
index f4e91279c8..5e856c3fef 100644
--- a/src/examples/elementary/efl_ui_collection_view_example_1.c
+++ b/src/examples/elementary/efl_ui_collection_view_example_1.c
@@ -45,6 +45,7 @@ static Efl_Model*
45_make_model(Evas_Object *win) 45_make_model(Evas_Object *win)
46{ 46{
47 Eina_Value vtext; 47 Eina_Value vtext;
48 Eina_Value w, h;
48 Efl_Generic_Model *model, *child; 49 Efl_Generic_Model *model, *child;
49 unsigned int i, s; 50 unsigned int i, s;
50 char buf[256]; 51 char buf[256];
@@ -52,13 +53,17 @@ _make_model(Evas_Object *win)
52 model = efl_add(EFL_GENERIC_MODEL_CLASS, win); 53 model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
53 eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING); 54 eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
54 55
56 w = eina_value_int_init(91);
57 h = eina_value_int_init(18);
58 efl_model_property_set(model, "item.width", &w);
59 efl_model_property_set(model, "item.height", &h);
60
55 for (i = 0; i < (NUM_ITEMS); i++) 61 for (i = 0; i < (NUM_ITEMS); i++)
56 { 62 {
57 s = i%2; 63 s = i%2;
58 child = efl_model_child_add(model); 64 child = efl_model_child_add(model);
59 eina_value_set(&vtext, styles[s]); 65 eina_value_set(&vtext, styles[s]);
60 efl_model_property_set(child, "odd_style", &vtext); 66 efl_model_property_set(child, "odd_style", &vtext);
61
62 snprintf(buf, sizeof(buf), "Item # %i", i); 67 snprintf(buf, sizeof(buf), "Item # %i", i);
63 eina_value_set(&vtext, buf); 68 eina_value_set(&vtext, buf);
64 efl_model_property_set(child, "title", &vtext); 69 efl_model_property_set(child, "title", &vtext);
@@ -76,7 +81,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
76 Eo *model; 81 Eo *model;
77 Efl_Select_Model *selmodel; 82 Efl_Select_Model *selmodel;
78 83
79 win = elm_win_util_standard_add("list_view", "List_View"); 84 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
80 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 85 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
81 86
82 elm_win_autodel_set(win, EINA_TRUE); 87 elm_win_autodel_set(win, EINA_TRUE);
@@ -90,23 +95,21 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
90 efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); 95 efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
91 efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style"); 96 efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style");
92 efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected"); 97 efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected");
93 efl_ui_property_bind(factory, "efl.text", "title"); 98 efl_ui_property_bind(factory, "text", "title");
94 99
100 Eo *lst = efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS);
95 li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win, 101 li = efl_add(EFL_UI_COLLECTION_VIEW_CLASS, win,
96 efl_ui_view_model_set(efl_added, selmodel)); 102 efl_ui_collection_view_position_manager_set(efl_added, lst),
97 efl_ui_collection_view_position_manager_set(li, efl_new(EFL_UI_POSITION_MANAGER_LIST_CLASS)); 103 efl_ui_view_model_set(efl_added, selmodel),
104 efl_ui_collection_view_factory_set(efl_added, factory));
98 105
99 // efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL); 106 // efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL);
100 // efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL); 107 // efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);
101 108
102 elm_win_resize_object_add(win, li); 109 efl_content_set(win, li);
103 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
104 evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
105 110
106 //showall 111 //showall
107 evas_object_show(li);
108 evas_object_resize(win, 320, 320); 112 evas_object_resize(win, 320, 320);
109 evas_object_show(win);
110 113
111 elm_run(); 114 elm_run();
112 115