efl_ui : change efl_ui_view_list to efl_ui_list_view.
Summary:
View is not a namespace, but an interface,
So, View_List cannot be under the view namespace for now.
it looks more suite to be end as View than List on this widget name.
Firstly, it follows our common naming rules of class.
Also, List_View is commonly presentable name on most UI frameworks,
so it is very easy to understand what this widget can do for the user.
Test Plan:
Make works.
Example is not works for now til stable model interface.
Reviewers: felipealmeida, woohyun, cedric, Hermet
Reviewed By: Hermet
Subscribers: larryolj, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7234
2018-11-04 21:27:05 -08:00
|
|
|
// gcc -o efl_ui_list_view_example_1 efl_ui_list_view_example_1.c `pkg-config --cflags --libs elementary`
|
2017-12-12 16:59:48 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#else
|
|
|
|
# define EFL_BETA_API_SUPPORT 1
|
|
|
|
# define EFL_EO_API_SUPPORT 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
#include <Efl.h>
|
|
|
|
#include <Eio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define NUM_ITEMS 400
|
|
|
|
|
|
|
|
const char *styles[] = {
|
|
|
|
"odd",
|
|
|
|
"even"
|
|
|
|
};
|
|
|
|
|
|
|
|
char edj_path[PATH_MAX];
|
|
|
|
|
|
|
|
static void
|
2018-11-29 09:11:51 -08:00
|
|
|
_realized_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
2017-12-12 16:59:48 -08:00
|
|
|
{
|
efl_ui : change efl_ui_view_list to efl_ui_list_view.
Summary:
View is not a namespace, but an interface,
So, View_List cannot be under the view namespace for now.
it looks more suite to be end as View than List on this widget name.
Firstly, it follows our common naming rules of class.
Also, List_View is commonly presentable name on most UI frameworks,
so it is very easy to understand what this widget can do for the user.
Test Plan:
Make works.
Example is not works for now til stable model interface.
Reviewers: felipealmeida, woohyun, cedric, Hermet
Reviewed By: Hermet
Subscribers: larryolj, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7234
2018-11-04 21:27:05 -08:00
|
|
|
Efl_Ui_List_View_Item_Event *ie = event->info;
|
2017-12-12 16:59:48 -08:00
|
|
|
if (!ie->layout) return;
|
|
|
|
|
2018-11-16 01:45:05 -08:00
|
|
|
Efl_Ui_Layout *layout = ie->layout;
|
2017-12-12 16:59:48 -08:00
|
|
|
elm_object_focus_allow_set(layout, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
static void
|
|
|
|
_unrealized_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|
|
|
{
|
efl_ui : change efl_ui_view_list to efl_ui_list_view.
Summary:
View is not a namespace, but an interface,
So, View_List cannot be under the view namespace for now.
it looks more suite to be end as View than List on this widget name.
Firstly, it follows our common naming rules of class.
Also, List_View is commonly presentable name on most UI frameworks,
so it is very easy to understand what this widget can do for the user.
Test Plan:
Make works.
Example is not works for now til stable model interface.
Reviewers: felipealmeida, woohyun, cedric, Hermet
Reviewed By: Hermet
Subscribers: larryolj, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7234
2018-11-04 21:27:05 -08:00
|
|
|
Efl_Ui_List_View_Item_Event *ie = event->info;
|
2017-12-12 16:59:48 -08:00
|
|
|
|
|
|
|
efl_ui_view_model_set(ie->layout, NULL);
|
|
|
|
efl_del(ie->layout);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
static Efl_Model*
|
2018-06-07 14:50:48 -07:00
|
|
|
_make_model(Evas_Object *win)
|
2017-12-12 16:59:48 -08:00
|
|
|
{
|
2018-01-15 01:41:58 -08:00
|
|
|
Eina_Value vtext;
|
2017-12-12 16:59:48 -08:00
|
|
|
Efl_Model_Item *model, *child;
|
|
|
|
unsigned int i, s;
|
|
|
|
char buf[256];
|
|
|
|
|
2018-06-07 14:50:48 -07:00
|
|
|
model = efl_add(EFL_MODEL_ITEM_CLASS, win);
|
2017-12-12 16:59:48 -08:00
|
|
|
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
|
|
|
|
|
|
|
for (i = 0; i < (NUM_ITEMS); i++)
|
|
|
|
{
|
|
|
|
s = i%2;
|
|
|
|
child = efl_model_child_add(model);
|
|
|
|
eina_value_set(&vtext, styles[s]);
|
|
|
|
efl_model_property_set(child, "odd_style", &vtext);
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "Item # %i", i);
|
|
|
|
eina_value_set(&vtext, buf);
|
|
|
|
efl_model_property_set(child, "name", &vtext);
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_value_flush(&vtext);
|
|
|
|
return model;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI_MAIN int
|
2018-11-29 09:11:51 -08:00
|
|
|
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
2017-12-12 16:59:48 -08:00
|
|
|
{
|
2018-11-06 05:23:21 -08:00
|
|
|
Efl_Ui_Factory *factory;
|
2018-07-20 07:36:38 -07:00
|
|
|
Evas_Object *win, *li;
|
2017-12-12 16:59:48 -08:00
|
|
|
Eo *model;
|
2018-11-06 05:23:21 -08:00
|
|
|
Efl_Model_Composite_Selection *selmodel;
|
2017-12-12 16:59:48 -08:00
|
|
|
|
efl_ui : change efl_ui_view_list to efl_ui_list_view.
Summary:
View is not a namespace, but an interface,
So, View_List cannot be under the view namespace for now.
it looks more suite to be end as View than List on this widget name.
Firstly, it follows our common naming rules of class.
Also, List_View is commonly presentable name on most UI frameworks,
so it is very easy to understand what this widget can do for the user.
Test Plan:
Make works.
Example is not works for now til stable model interface.
Reviewers: felipealmeida, woohyun, cedric, Hermet
Reviewed By: Hermet
Subscribers: larryolj, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7234
2018-11-04 21:27:05 -08:00
|
|
|
win = elm_win_util_standard_add("list_view", "List_View");
|
2017-12-12 16:59:48 -08:00
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
|
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
|
|
|
|
2018-06-07 14:50:48 -07:00
|
|
|
model = _make_model(win);
|
2018-11-06 05:23:21 -08:00
|
|
|
selmodel = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get()
|
|
|
|
, efl_ui_view_model_set(efl_added, model)
|
|
|
|
);
|
2017-12-12 16:59:48 -08:00
|
|
|
|
|
|
|
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
|
2019-01-10 23:24:14 -08:00
|
|
|
efl_ui_model_connect(factory, "signal/efl,state,%v", "odd_style");
|
2018-11-06 05:23:21 -08:00
|
|
|
efl_ui_model_connect(factory, "signal/efl,state,%{selected;unselected}", "selected");
|
2018-04-30 02:54:32 -07:00
|
|
|
efl_ui_model_connect(factory, "efl.text", "name");
|
2018-04-22 23:13:59 -07:00
|
|
|
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
|
2017-12-12 16:59:48 -08:00
|
|
|
|
2018-11-06 05:23:21 -08:00
|
|
|
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)
|
|
|
|
);
|
2017-12-12 16:59:48 -08:00
|
|
|
|
efl_ui : change efl_ui_view_list to efl_ui_list_view.
Summary:
View is not a namespace, but an interface,
So, View_List cannot be under the view namespace for now.
it looks more suite to be end as View than List on this widget name.
Firstly, it follows our common naming rules of class.
Also, List_View is commonly presentable name on most UI frameworks,
so it is very easy to understand what this widget can do for the user.
Test Plan:
Make works.
Example is not works for now til stable model interface.
Reviewers: felipealmeida, woohyun, cedric, Hermet
Reviewed By: Hermet
Subscribers: larryolj, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7234
2018-11-04 21:27:05 -08:00
|
|
|
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);
|
2017-12-12 16:59:48 -08:00
|
|
|
|
|
|
|
elm_win_resize_object_add(win, li);
|
|
|
|
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
|
|
|
|
//showall
|
|
|
|
evas_object_show(li);
|
|
|
|
evas_object_resize(win, 320, 320);
|
|
|
|
evas_object_show(win);
|
|
|
|
|
|
|
|
elm_run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ELM_MAIN()
|