aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-11-06 11:23:21 -0200
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2018-11-30 16:56:47 -0200
commit0398b8f19c2adcf206ec298ded8ce4dd1681a501 (patch)
tree5c075a6f0875b67a97a214db65f69aa98638b7cf /src/examples
parentRevert "eina: add locale-independent eina_convert_strtod_c function" (diff)
downloadefl-0398b8f19c2adcf206ec298ded8ce4dd1681a501.tar.gz
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 'src/examples')
-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)
EAPI_MAIN int
elm_main(int argc, char **argv)
{
- Efl_Ui_Layout_Factory *factory;
+ Efl_Ui_Factory *factory;
Evas_Object *win, *li;
Eo *model;
+ Efl_Model_Composite_Selection *selmodel;
win = elm_win_util_standard_add("list_view", "List_View");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
@@ -81,15 +82,20 @@ elm_main(int argc, char **argv)
elm_win_autodel_set(win, EINA_TRUE);
model = _make_model(win);
+ selmodel = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get()
+ , efl_ui_view_model_set(efl_added, model)
+ );
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style");
+ efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected");
efl_ui_model_connect(factory, "efl.text", "name");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
- li = efl_add(EFL_UI_LIST_VIEW_CLASS, win);
- efl_ui_list_view_layout_factory_set(li, factory);
- efl_ui_view_model_set(li, model);
+ li = efl_add(EFL_UI_LIST_VIEW_CLASS, win
+ , efl_ui_list_view_layout_factory_set(efl_added, factory)
+ , efl_ui_view_model_set(efl_added, selmodel)
+ );
efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_cb, NULL);
// efl_event_callback_add(li, EFL_UI_LIST_VIEW_EVENT_ITEM_UNREALIZED, _unrealized_cb, NULL);