summaryrefslogtreecommitdiff
path: root/src/examples/elementary/efl_ui_list_view_example_1.c
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-11-06 11:23:21 -0200
committerChristopher Michael <cp.michael@samsung.com>2018-12-06 12:06:16 -0500
commit50ce1338b165a9e733d02748371e4c28dcb781ce (patch)
treea817f34781d3baf4f11ea12e287a7e46dcfb3a50 /src/examples/elementary/efl_ui_list_view_example_1.c
parent5d04985888e4bf3b55dcbc0afb79cf0e7c8b7c31 (diff)
elementary: rework Efl.Ui.Layout boolean signal-connection to Models
Add new feature to specify signal connection to boolean properties of Models. This also fix some '%v' substitution problems. Parsing EINA_VALUE_TYPE_BOOL as boolean in Efl.Ui.Layout signal updates from Models (instead of EINA_VALUE_TYPE_UCHAR). UCHAR no longer has special handling and falls to the general result of eina_value_to_string() as other types do. Use EINA_VALUE_TYPE_BOOL instead of EINA_VALUE_TYPE_UCHAR to signal selection on click events to the Model. Update examples to make usage of the new property connection feature in order to model selection of items on Views.
Diffstat (limited to '')
-rw-r--r--src/examples/elementary/efl_ui_list_view_example_1.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/examples/elementary/efl_ui_list_view_example_1.c b/src/examples/elementary/efl_ui_list_view_example_1.c
index f509af12d6..f0a6adcfb8 100644
--- a/src/examples/elementary/efl_ui_list_view_example_1.c
+++ b/src/examples/elementary/efl_ui_list_view_example_1.c
@@ -71,9 +71,10 @@ _make_model(Evas_Object *win)
71EAPI_MAIN int 71EAPI_MAIN int
72elm_main(int argc, char **argv) 72elm_main(int argc, char **argv)
73{ 73{
74 Efl_Ui_Layout_Factory *factory; 74 Efl_Ui_Factory *factory;
75 Evas_Object *win, *li; 75 Evas_Object *win, *li;
76 Eo *model; 76 Eo *model;
77 Efl_Model_Composite_Selection *selmodel;
77 78
78 win = elm_win_util_standard_add("list_view", "List_View"); 79 win = elm_win_util_standard_add("list_view", "List_View");
79 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 80 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -81,15 +82,20 @@ elm_main(int argc, char **argv)
81 elm_win_autodel_set(win, EINA_TRUE); 82 elm_win_autodel_set(win, EINA_TRUE);
82 83
83 model = _make_model(win); 84 model = _make_model(win);
85 selmodel = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get()
86 , efl_ui_view_model_set(efl_added, model)
87 );
84 88
85 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 89 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
86 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style"); 90 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style");
91 efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected");
87 efl_ui_model_connect(factory, "efl.text", "name"); 92 efl_ui_model_connect(factory, "efl.text", "name");
88 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default"); 93 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
89 94
90 li = efl_add(EFL_UI_LIST_VIEW_CLASS, win); 95 li = efl_add(EFL_UI_LIST_VIEW_CLASS, win
91 efl_ui_list_view_layout_factory_set(li, factory); 96 , efl_ui_list_view_layout_factory_set(efl_added, factory)
92 efl_ui_view_model_set(li, model); 97 , efl_ui_view_model_set(efl_added, selmodel)
98 );
93 99
94 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_REALIZED, _realized_cb, NULL);
95// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL); 101// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);