summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Jr <larry.olj@gmail.com>2014-07-21 23:38:02 -0300
committerLarry Jr <larry.olj@gmail.com>2015-03-19 15:34:51 -0300
commite1f04888591449a278ec1af8e7ec8c27c2a9b0df (patch)
treea0e1ebac4bde2a5bccca1e651bcf77851b5ae2fb
parent0754f4da4db90fc21fee7dada31c50e02137648d (diff)
Created Views for Emodel MVC.
Summary: Elm_View_List: Use Genlist to show children and his properties Elm_View_Form: Make a connection between a Widget and a property
-rw-r--r--configure.ac7
-rw-r--r--src/examples/.gitignore2
-rw-r--r--src/examples/Makefile.am4
-rw-r--r--src/examples/filemvc.c212
-rw-r--r--src/examples/fileviewlist.c77
-rw-r--r--src/lib/Elementary.h.in2
-rw-r--r--src/lib/Makefile.am6
-rw-r--r--src/lib/elm_view_form.c259
-rw-r--r--src/lib/elm_view_form.eo38
-rw-r--r--src/lib/elm_view_form.h5
-rw-r--r--src/lib/elm_view_list.c433
-rw-r--r--src/lib/elm_view_list.eo77
-rw-r--r--src/lib/elm_view_list.h9
13 files changed, 1130 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 96d20efc3..1e36c628a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,11 +228,12 @@ requirement_elm_pc_only="\
228 ecore-imf >= efl_version \ 228 ecore-imf >= efl_version \
229 ecore-con >= efl_version \ 229 ecore-con >= efl_version \
230 eio >= efl_version \ 230 eio >= efl_version \
231 emodel >= efl_version \
231 eldbus >= efl_version \ 232 eldbus >= efl_version \
232 efreet >= efl_version \ 233 efreet >= efl_version \
233 efreet-mime >= efl_version \ 234 efreet-mime >= efl_version \
234 efreet-trash >= efl_version \ 235 efreet-trash >= efl_version \
235 eio >= efl_version \ 236 emodel >= efl_version \
236 " 237 "
237 238
238requirement_elm_pc="\ 239requirement_elm_pc="\
@@ -269,6 +270,8 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
269 eo-cxx >= efl_version 270 eo-cxx >= efl_version
270 eina-cxx >= efl_version 271 eina-cxx >= efl_version
271 evas-cxx >= efl_version 272 evas-cxx >= efl_version
273 emodel-cxx >= efl_version
274 eio-cxx >= efl_version
272 ], 275 ],
273 [ 276 [
274 requirement_elm_pc="${requirement_elm_pc} \ 277 requirement_elm_pc="${requirement_elm_pc} \
@@ -276,6 +279,8 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
276 eo-cxx >= efl_version \ 279 eo-cxx >= efl_version \
277 eina-cxx >= efl_version \ 280 eina-cxx >= efl_version \
278 evas-cxx >= efl_version \ 281 evas-cxx >= efl_version \
282 emodel-cxx >= efl_version \
283 eio-cxx >= efl_version \
279 " 284 "
280 have_cxx11="yes" 285 have_cxx11="yes"
281 LDFLAGS="${LDFLAGS} -fPIC -DPIC" 286 LDFLAGS="${LDFLAGS} -fPIC -DPIC"
diff --git a/src/examples/.gitignore b/src/examples/.gitignore
index fd9fc399b..98a343b64 100644
--- a/src/examples/.gitignore
+++ b/src/examples/.gitignore
@@ -32,6 +32,8 @@
32/fileselector_button_example 32/fileselector_button_example
33/fileselector_entry_example 33/fileselector_entry_example
34/fileselector_example 34/fileselector_example
35/fileviewlist
36/filemvc
35/flip_example_01 37/flip_example_01
36/flipselector_example 38/flipselector_example
37/frame_example_01 39/frame_example_01
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 23d09bee8..31494a745 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -72,6 +72,8 @@ entry_example.c \
72fileselector_button_example.c \ 72fileselector_button_example.c \
73fileselector_entry_example.c \ 73fileselector_entry_example.c \
74fileselector_example.c \ 74fileselector_example.c \
75fileviewlist.c \
76filemvc.c \
75flip_example_01.c \ 77flip_example_01.c \
76flipselector_example.c \ 78flipselector_example.c \
77frame_example_01.c \ 79frame_example_01.c \
@@ -225,6 +227,8 @@ entry_example \
225fileselector_button_example \ 227fileselector_button_example \
226fileselector_entry_example \ 228fileselector_entry_example \
227fileselector_example \ 229fileselector_example \
230fileviewlist \
231filemvc \
228flip_example_01 \ 232flip_example_01 \
229flipselector_example \ 233flipselector_example \
230frame_example_01 \ 234frame_example_01 \
diff --git a/src/examples/filemvc.c b/src/examples/filemvc.c
new file mode 100644
index 000000000..47e969db5
--- /dev/null
+++ b/src/examples/filemvc.c
@@ -0,0 +1,212 @@
1//#ifdef HAVE_CONFIG_H
2# include "../../elementary_config.h"
3//#endif
4
5#include <Elementary.h>
6#include <Emodel.h>
7#include <Eio.h>
8#include <eio_model.eo.h>
9#include <stdio.h>
10#include <Eio.h>
11#include <elm_view_form.h>
12
13#define EMODEL_TEST_FILENAME_PATH "/tmp"
14
15struct _Emodel_Test_Filemvc_Data
16{
17 Eo *fileview;
18 Eo *treeview;
19 Eo *formview;
20 Eo *treemodel;
21 Evas_Object *thumb;
22 char imagedefault_path[256];
23};
24typedef struct _Emodel_Test_Filemvc_Data Emodel_Test_Filemvc_Data;
25
26static void
27_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
28{
29 Emodel_Test_Filemvc_Data *priv = (Emodel_Test_Filemvc_Data *)data;
30 eo_unref(priv->fileview);
31 eo_unref(priv->treeview);
32 eo_unref(priv->formview);
33 eo_unref(priv->treemodel);
34}
35
36static Eina_Bool
37_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info)
38{
39 if (info->type == EINA_FILE_DIR && info->path[info->name_start] != '.') return EINA_TRUE;
40
41 return EINA_FALSE;
42}
43
44static Eina_Bool
45_list_selected_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
46{
47 Emodel_Test_Filemvc_Data *priv = data;
48 Eo *child = event_info;
49 ethumb_client_file_free(elm_thumb_ethumb_client_get());
50
51 printf("LIST selected model\n");
52 eo_do(priv->formview, elm_view_form_model_set(child));
53 return EINA_TRUE;
54}
55
56static Eina_Bool
57_tree_selected_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
58{
59 printf("TREE selected model\n");
60 Emodel_Test_Filemvc_Data *priv = data;
61 Eo *child = event_info;
62 Eina_Value vpath;
63 Eo *model;
64 char *path;
65
66 eo_do(child, emodel_property_get("path", &vpath));
67 eina_value_get(&vpath, &path);
68 model = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(path));
69 eo_do(model, emodel_load());
70 eo_do(priv->fileview, elm_view_list_model_set(model));
71 eina_value_flush(&vpath);
72// eo_unref(model);
73 return EINA_TRUE;
74}
75
76static void
77_widget_init(Evas_Object *widget)
78{
79 evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
80 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
81 evas_object_show(widget);
82}
83
84Evas_Object *
85_label_init(Evas_Object *win, Evas_Object *box, const char *text)
86{
87 Evas_Object *widget = elm_label_add(win);
88 elm_label_line_wrap_set(widget, ELM_WRAP_CHAR);
89 elm_object_text_set(widget, text);
90 elm_box_pack_end(box, widget);
91 evas_object_size_hint_weight_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
92 evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
93 evas_object_show(widget);
94
95 return widget;
96}
97
98
99static void
100_thumb_error_cb(void *data, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
101{
102 Emodel_Test_Filemvc_Data *priv = data;
103 printf("thumbnail generation error.\n");
104 elm_thumb_file_set(priv->thumb, priv->imagedefault_path, NULL);
105 elm_thumb_reload(priv->thumb);
106}
107
108EAPI_MAIN int
109elm_main(int argc, char **argv)
110{
111 Emodel_Test_Filemvc_Data priv;
112 Evas_Object *win, *panes, *bxr, *genlist, *vpanes;
113 Evas_Object *entry;
114 char *dirname;
115
116 memset(&priv, 0, sizeof(Emodel_Test_Filemvc_Data));
117 elm_app_info_set(elm_main, "elementary", "images/logo.png");
118 sprintf(priv.imagedefault_path, "%s/images/logo.png", elm_app_data_dir_get());
119
120 //win
121 win = elm_win_util_standard_add("viewlist", "Viewlist");
122 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
123 elm_win_autodel_set(win, EINA_TRUE);
124
125 panes = elm_panes_add(win);
126// elm_box_horizontal_set(box, EINA_TRUE);
127 evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
128 elm_win_resize_object_add(win, panes);
129
130 ecore_init();
131 eio_init();
132
133 if(argv[1] != NULL) dirname = argv[1];
134 else dirname = EMODEL_TEST_FILENAME_PATH;
135
136 //treemodel
137 priv.treemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(dirname));
138 eo_do(priv.treemodel, eio_model_children_filter_set(_filter_cb, NULL));
139 eo_do(priv.treemodel, emodel_load());
140
141 //treeview
142 genlist = elm_genlist_add(win);
143 priv.treeview = eo_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_constructor(genlist, ELM_GENLIST_ITEM_TREE, NULL));
144 eo_do(priv.treeview, elm_view_list_property_connect("filename", "elm.text"),
145 elm_view_list_property_connect("icon", "elm.swallow.icon"),
146 elm_view_list_model_set(priv.treemodel));
147 _widget_init(genlist);
148 elm_object_part_content_set(panes, "left", genlist);
149 eo_do(panes, elm_obj_panes_content_left_size_set(0.3));
150
151 vpanes = elm_panes_add(win);
152 _widget_init(vpanes);
153 elm_object_part_content_set(panes, "right", vpanes);
154 eo_do(priv.treeview, eo_event_callback_add(ELM_VIEW_LIST_EVENT_MODEL_SELECTED, _tree_selected_cb, &priv));
155 //listview
156 genlist = elm_genlist_add(win);
157 priv.fileview = eo_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_constructor(genlist, ELM_GENLIST_ITEM_NONE, "double_label"));
158 eo_do(priv.fileview, elm_view_list_property_connect("filename", "elm.text"),
159 elm_view_list_property_connect("mtime", "elm.text.sub"));
160
161 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
162 _widget_init(genlist);
163 elm_object_part_content_set(vpanes, "left", genlist);
164
165 eo_do(priv.fileview, eo_event_callback_add(ELM_VIEW_LIST_EVENT_MODEL_SELECTED, _list_selected_cb, &priv));
166
167 //formview
168 bxr = elm_box_add(win);
169 _widget_init(bxr);
170 elm_object_part_content_set(vpanes, "right", bxr);
171 priv.formview = eo_add(ELM_VIEW_FORM_CLASS, NULL, elm_view_form_constructor(NULL));
172
173 /*Label widget */
174 eo_do(priv.formview, elm_view_form_widget_add("filename", _label_init(win, bxr, "File Name")));
175
176 _label_init(win, bxr, "Size:");
177 eo_do(priv.formview, elm_view_form_widget_add("size", _label_init(win, bxr, "")));
178
179 _label_init(win, bxr, "Modified:");
180 eo_do(priv.formview, elm_view_form_widget_add("mtime", _label_init(win, bxr, "")));
181
182 /* Entry widget */
183 entry = elm_entry_add(win);
184 elm_entry_single_line_set(entry, EINA_TRUE);
185 evas_object_size_hint_weight_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
186 elm_box_pack_end(bxr, entry);
187 evas_object_show(entry);
188 eo_do(priv.formview, elm_view_form_widget_add("path", entry));
189
190 /* Thumb widget */
191 elm_need_ethumb();
192 priv.thumb = elm_thumb_add(win);
193 _widget_init(priv.thumb);
194 elm_box_pack_end(bxr, priv.thumb);
195 elm_thumb_editable_set(priv.thumb, EINA_FALSE);
196 eo_do(priv.formview, elm_view_form_widget_add("path", priv.thumb));
197 evas_object_smart_callback_add(priv.thumb, "generate,error", _thumb_error_cb, &priv);
198 evas_object_smart_callback_add(priv.thumb, "load,error", _thumb_error_cb, &priv);
199
200 //showall
201 evas_object_resize(win, 800, 400);
202 evas_object_show(panes);
203 evas_object_show(win);
204
205 elm_run();
206 elm_shutdown();
207 ecore_shutdown();
208
209 return 0;
210}
211ELM_MAIN()
212
diff --git a/src/examples/fileviewlist.c b/src/examples/fileviewlist.c
new file mode 100644
index 000000000..d3a6ab93c
--- /dev/null
+++ b/src/examples/fileviewlist.c
@@ -0,0 +1,77 @@
1//Compile with:
2// gcc -o fileviewlist fileviewlist.c `pkg-config --cflags --libs emodel`
3
4//#ifdef HAVE_CONFIG_H
5# include "../../elementary_config.h"
6//#endif
7
8#include <Elementary.h>
9#include <Emodel.h>
10#include <Eio.h>
11#include <eio_model.eo.h>
12#include <stdio.h>
13
14#define EMODEL_TEST_FILENAME_PATH "/tmp"
15
16struct _Emodel_Test_Fileview_Data
17{
18 Eo *filemodel;
19 Eo *fileview;
20};
21typedef struct _Emodel_Test_Fileview_Data Emodel_Test_Fileview_Data;
22
23static void
24_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
25{
26 Emodel_Test_Fileview_Data *priv = (Emodel_Test_Fileview_Data *)data;
27 eo_unref(priv->fileview);
28 eo_unref(priv->filemodel);
29}
30
31EAPI_MAIN int
32elm_main(int argc, char **argv)
33{
34 Emodel_Test_Fileview_Data priv;
35 Evas_Object *win = NULL;
36 Evas_Object *genlist = NULL;
37 char *dirname;
38
39 memset(&priv, 0, sizeof(Emodel_Test_Fileview_Data));
40
41 ecore_init();
42 eio_init();
43
44 if(argv[1] != NULL) dirname = argv[1];
45 else dirname = EMODEL_TEST_FILENAME_PATH;
46
47 win = elm_win_util_standard_add("viewlist", "Viewlist");
48 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
49 elm_win_autodel_set(win, EINA_TRUE);
50
51 genlist = elm_genlist_add(win);
52 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 evas_object_show(genlist);
54
55 priv.filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(dirname));
56 priv.fileview = eo_add(ELM_VIEW_LIST_CLASS, NULL,
57 elm_view_list_constructor(genlist, ELM_GENLIST_ITEM_TREE, "double_label"));
58 eo_do(priv.fileview, elm_view_list_model_set(priv.filemodel));
59 eo_do(priv.filemodel, emodel_load());
60 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
61
62 eo_do(priv.fileview, elm_view_list_property_connect("filename", "elm.text"),
63 elm_view_list_property_connect("mtime", "elm.text.sub"));
64
65 evas_object_resize(win, 320, 520);
66 elm_win_resize_object_add(win, genlist);
67 evas_object_show(win);
68
69 elm_run();
70
71 elm_shutdown();
72 ecore_shutdown();
73
74 return 0;
75}
76ELM_MAIN()
77
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 6e87bf0bb..5c5753bf0 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -258,6 +258,8 @@ EAPI extern Elm_Version *elm_version;
258#include <elm_toolbar.h> 258#include <elm_toolbar.h>
259#include <elm_transit.h> 259#include <elm_transit.h>
260#include <elm_video.h> 260#include <elm_video.h>
261#include <elm_view_list.h>
262#include <elm_view_form.h>
261#include <elm_web.h> 263#include <elm_web.h>
262#include <elm_win.h> 264#include <elm_win.h>
263 265
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index cd283800e..d032ff93c 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -376,6 +376,8 @@ elm_transit.h \
376elm_video.h \ 376elm_video.h \
377elm_video_eo.h \ 377elm_video_eo.h \
378elm_video_legacy.h \ 378elm_video_legacy.h \
379elm_view_list.h \
380elm_view_form.h \
379elm_web.h \ 381elm_web.h \
380elm_web_common.h \ 382elm_web_common.h \
381elm_web_eo.h \ 383elm_web_eo.h \
@@ -492,6 +494,8 @@ elm_transit.c \
492elm_util.c \ 494elm_util.c \
493elm_url.c \ 495elm_url.c \
494elm_video.c \ 496elm_video.c \
497elm_view_list.c \
498elm_view_form.c \
495elm_web2.c \ 499elm_web2.c \
496elm_widget.c \ 500elm_widget.c \
497elm_win.c \ 501elm_win.c \
@@ -601,6 +605,8 @@ elm_table.eo \
601elm_thumb.eo \ 605elm_thumb.eo \
602elm_toolbar.eo \ 606elm_toolbar.eo \
603elm_video.eo \ 607elm_video.eo \
608elm_view_list.eo \
609elm_view_form.eo \
604elm_web.eo \ 610elm_web.eo \
605elm_widget.eo \ 611elm_widget.eo \
606elm_win.eo \ 612elm_win.eo \
diff --git a/src/lib/elm_view_form.c b/src/lib/elm_view_form.c
new file mode 100644
index 000000000..24a33cebf
--- /dev/null
+++ b/src/lib/elm_view_form.c
@@ -0,0 +1,259 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Eo.h>
5#include <Emodel.h>
6#include <Elementary.h>
7
8#include "elm_view_form.h"
9#include "elm_view_list.h"
10
11#include "elm_priv.h"
12#include <assert.h>
13
14#define MY_CLASS ELM_VIEW_FORM_CLASS
15#define MY_CLASS_NAME "View_Form"
16
17typedef struct _Elm_View_Form_Data Elm_View_Form_Data;
18typedef struct _Elm_View_Form_Widget Elm_View_Form_Widget;
19
20/**
21 * @brief Local-use callbacks
22 */
23typedef void (*Elm_View_Form_Event_Cb)(Elm_View_Form_Widget *, Elm_View_Form_Data *, Evas_Object *);
24typedef void (*Elm_View_Form_Widget_Object_Set_Cb)(Eo *, Evas_Object *, Eina_Value *, const char *);
25
26struct _Elm_View_Form_Widget
27{
28 Eina_Stringshare *widget_propname;
29 Evas_Object *widget_obj;
30 Elm_View_Form_Event_Cb widget_obj_value_update_cb;
31 Elm_View_Form_Widget_Object_Set_Cb widget_obj_set_cb;
32};
33
34struct _Elm_View_Form_Data
35{
36 Eo *model_obj;
37 Eina_Value *properties;
38 Eina_List *l;
39};
40
41static Eina_Bool
42_emodel_properties_change_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
43{
44 const Emodel_Property_Event *evt = event_info;
45 Elm_View_Form_Data *priv = data;
46 Emodel_Property_Pair *pair = NULL;
47 Eina_List *l, *fe = NULL;
48 Elm_View_Form_Widget *w = NULL;
49
50 EINA_SAFETY_ON_NULL_RETURN_VAL(priv, EINA_TRUE);
51 EINA_SAFETY_ON_NULL_RETURN_VAL(evt, EINA_TRUE);
52
53 //update all widgets with this property
54 EINA_LIST_FOREACH(priv->l, l, w)
55 {
56 EINA_LIST_FOREACH(evt->changed_properties, fe, pair)
57 {
58 if(w->widget_propname == pair->property)
59 {
60 w->widget_obj_set_cb(priv->model_obj, w->widget_obj, &pair->value, pair->property);
61 break;
62 }
63 }
64 }
65
66 return EINA_TRUE;
67}
68
69static void
70_update_model_properties(Elm_View_Form_Data *priv)
71{
72 Eina_Value value;
73 Eina_List *l;
74 Elm_View_Form_Widget *w;
75 //update all widgets property
76 EINA_LIST_FOREACH(priv->l, l, w)
77 {
78 eo_do(priv->model_obj, emodel_property_get(w->widget_propname, &value));
79 w->widget_obj_set_cb(priv->model_obj, w->widget_obj, &value, w->widget_propname);
80 eina_value_flush(&value);
81 }
82}
83
84/**
85 * @brief Set widget.
86 * Works, so far, for widget(s): Entry, Label
87 */
88static void
89_elm_evas_object_text_set_cb(Eo *obj EINA_UNUSED, Evas_Object *widget, Eina_Value *value, const char *propname EINA_UNUSED)
90{
91 char *text = eina_value_to_string(value);
92 const char *c_text = elm_object_text_get(widget);
93 EINA_SAFETY_ON_NULL_RETURN(text);
94
95 if (strcmp(text, c_text) != 0)
96 {
97 elm_object_text_set(widget, text);
98 }
99 free(text);
100}
101
102static void
103_elm_evas_object_thumb_set_cb(Eo *obj EINA_UNUSED, Evas_Object *thumb, Eina_Value *value, const char *propname EINA_UNUSED)
104{
105 char *filename = eina_value_to_string(value);
106 EINA_SAFETY_ON_NULL_RETURN(filename);
107 EINA_SAFETY_ON_TRUE_RETURN(strlen(filename) >= PATH_MAX);
108
109 elm_thumb_file_set(thumb, filename, NULL);
110 elm_thumb_reload(thumb);
111 free(filename);
112}
113
114/**
115 * @brief Evas object callback implementation.
116 * Updates Widget's value if not the same object
117 * and the widget itself.
118 */
119static void
120_elm_evas_object_text_changed_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
121{
122 Eina_Value value;
123 Eina_List *l;
124 Elm_View_Form_Data *priv = (Elm_View_Form_Data *)data;
125 Elm_View_Form_Widget *w = NULL;
126
127 EINA_LIST_FOREACH(priv->l, l, w)
128 {
129 if (w->widget_obj == obj)
130 break;
131 }
132
133 EINA_SAFETY_ON_NULL_RETURN(w);
134 eina_value_setup(&value, EINA_VALUE_TYPE_STRING);
135 eina_value_set(&value, elm_object_text_get(obj));
136 eo_do(priv->model_obj, emodel_property_set(w->widget_propname, value));
137 eina_value_flush(&value);
138}
139/**
140 * @brief Add new widget object.
141 * Adds new widget object on the list
142 * and perform initial setup.
143 */
144static Eina_Bool
145_elm_view_widget_add(Elm_View_Form_Data *priv, const char *propname, Evas_Object *widget_obj)
146{
147 Eina_Value value;
148 Elm_View_Form_Widget *w = calloc(1, sizeof(Elm_View_Form_Widget));
149 EINA_SAFETY_ON_NULL_RETURN_VAL(w, EINA_FALSE);
150
151 w->widget_propname = eina_stringshare_add(propname);
152 w->widget_obj = widget_obj;
153 priv->l = eina_list_append(priv->l, w);
154
155 if(eo_isa(widget_obj, ELM_ENTRY_CLASS))
156 {
157 w->widget_obj_set_cb = _elm_evas_object_text_set_cb;
158 evas_object_event_callback_add(w->widget_obj, EVAS_CALLBACK_KEY_DOWN, _elm_evas_object_text_changed_cb, priv);
159 }
160 else if(eo_isa(widget_obj, ELM_LABEL_CLASS))
161 {
162 w->widget_obj_set_cb = _elm_evas_object_text_set_cb;
163 }
164 else if(eo_isa(widget_obj, ELM_THUMB_CLASS))
165 {
166 w->widget_obj_set_cb = _elm_evas_object_thumb_set_cb;
167 }
168 else
169 {
170 // Widget yet not supported
171 EINA_SAFETY_ON_NULL_RETURN_VAL(NULL, EINA_FALSE);
172 }
173
174 if (eo_do(priv->model_obj, emodel_property_get(propname, &value)) == EINA_TRUE)
175 {
176 w->widget_obj_set_cb(priv->model_obj, w->widget_obj, &value, w->widget_propname);
177 eina_value_flush(&value);
178 }
179
180 return EINA_TRUE;
181}
182/**
183 * Helper functions - End
184 */
185
186
187/**
188 * @brief constructor
189 */
190static void
191_elm_view_form_constructor(Eo *obj, Elm_View_Form_Data *_pd, Eo *model)
192{
193 Elm_View_Form_Data *priv = (Elm_View_Form_Data *)_pd;
194 eo_do_super(obj, MY_CLASS, eo_constructor());
195 priv->model_obj = model;
196 if (priv->model_obj != NULL)
197 {
198 eo_ref(priv->model_obj);
199 eo_do(priv->model_obj, eo_event_callback_add(EMODEL_EVENT_PROPERTIES_CHANGED, _emodel_properties_change_cb, priv));
200 }
201}
202
203static void
204_elm_view_form_eo_base_constructor(Eo *obj, Elm_View_Form_Data *_pd EINA_UNUSED)
205{
206 eo_error_set(obj);
207 fprintf(stderr, "only custom constructor can be used with '%s' class", MY_CLASS_NAME);
208}
209
210
211/**
212 * @brief destructor
213 */
214static void
215_elm_view_form_eo_base_destructor(Eo *obj, Elm_View_Form_Data *priv)
216{
217 Elm_View_Form_Widget *w = NULL;
218 EINA_LIST_FREE(priv->l, w)
219 {
220 eina_stringshare_del(w->widget_propname);
221 free(w);
222 }
223
224 eo_do_super(obj, MY_CLASS, eo_destructor());
225}
226
227
228static void
229_elm_view_form_model_set(Eo *obj EINA_UNUSED, Elm_View_Form_Data *priv, Eo *model)
230{
231 if (priv->model_obj != NULL)
232 {
233 eo_do(priv->model_obj, eo_event_callback_del(EMODEL_EVENT_PROPERTIES_CHANGED, _emodel_properties_change_cb, priv));
234 eo_unref(priv->model_obj);
235 }
236
237 priv->model_obj = model;
238
239 if (priv->model_obj != NULL)
240 {
241 eo_ref(priv->model_obj);
242 eo_do(priv->model_obj, eo_event_callback_add(EMODEL_EVENT_PROPERTIES_CHANGED, _emodel_properties_change_cb, priv));
243 _update_model_properties(priv);
244 }
245}
246
247static void
248_elm_view_form_widget_add(Eo *obj EINA_UNUSED, Elm_View_Form_Data *priv, const char *propname, Evas_Object *evas)
249{
250 Eina_Bool status;
251
252 EINA_SAFETY_ON_NULL_RETURN(evas);
253 EINA_SAFETY_ON_NULL_RETURN(propname);
254
255 status = _elm_view_widget_add(priv, propname, evas);
256 EINA_SAFETY_ON_FALSE_RETURN(status);
257}
258
259#include "elm_view_form.eo.c"
diff --git a/src/lib/elm_view_form.eo b/src/lib/elm_view_form.eo
new file mode 100644
index 000000000..aa6528d85
--- /dev/null
+++ b/src/lib/elm_view_form.eo
@@ -0,0 +1,38 @@
1class Elm_View_Form (Eo.Base)
2{
3 legacy_prefix: null;
4 methods {
5 constructor {
6 /*@ Constructor wrapper
7 @def elm_view_form_constructor
8 @since 1.11 */
9 params {
10 @in Eo *model; /*@ Emodel object */
11 }
12 }
13 model_set {
14 /*@ Set model
15 @def elm_view_form_model_set
16 @since 1.11 */
17 params {
18 @in Eo *model; /*@ Emodel object */
19 }
20 }
21 widget_add {
22 /*@ Add new widget
23 @def elm_view_form_widget_add
24 @since 1.11 */
25 params {
26 @in const(char)* propname; /*@ Property name */
27 @in Evas_Object *evas; /*@ Evas widget */
28 }
29 }
30 }
31 implements {
32 Eo.Base.destructor;
33 Eo.Base.constructor;
34 }
35 constructors {
36 .constructor;
37 }
38}
diff --git a/src/lib/elm_view_form.h b/src/lib/elm_view_form.h
new file mode 100644
index 000000000..08764682e
--- /dev/null
+++ b/src/lib/elm_view_form.h
@@ -0,0 +1,5 @@
1#ifndef ELM_VIEW_FORM_H
2#define ELM_VIEW_FORM_H
3
4#include <elm_view_form.eo.h>
5#endif
diff --git a/src/lib/elm_view_list.c b/src/lib/elm_view_list.c
new file mode 100644
index 000000000..aeb6c4c5f
--- /dev/null
+++ b/src/lib/elm_view_list.c
@@ -0,0 +1,433 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Eo.h>
5#include <Emodel.h>
6#include <Elementary.h>
7
8#include "elm_priv.h"
9#include <assert.h>
10
11#define MY_CLASS ELM_VIEW_LIST_CLASS
12#define MY_CLASS_NAME "View List"
13
14struct _Elm_View_List_Data;
15typedef struct _Elm_View_List_Data Elm_View_List_Data;
16
17struct _View_List_ItemData;
18typedef struct _View_List_ItemData View_List_ItemData;
19
20struct _Elm_View_List_Data
21{
22 Eo *view;
23 Evas_Object *genlist;
24 View_List_ItemData *rootdata;
25 Elm_Genlist_Item_Class *itc;
26 Elm_Genlist_Item_Type itype;
27 Eina_Hash *prop_con;
28 Eo *model;
29};
30
31struct _View_List_ItemData
32{
33 Elm_View_List_Data *priv;
34 Elm_Object_Item *item;
35 Eo *model;
36 View_List_ItemData *parent;
37 Emodel_Load_Status status;
38};
39
40static void _emodel_load_children(View_List_ItemData *);
41static Eina_Bool _emodel_load_status_change_cb(void *, Eo *, const Eo_Event_Description *, void *);
42static Eina_Bool _emodel_children_count_change_cb(void *, Eo *, const Eo_Event_Description *, void *);
43static Eina_Bool _emodel_properties_change_cb(void *, Eo *, const Eo_Event_Description *, void *);
44
45/* --- Genlist Callbacks --- */
46static void
47_item_sel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
48{
49 View_List_ItemData *idata = data;
50
51 EINA_SAFETY_ON_NULL_RETURN(data);
52
53 eo_do(idata->priv->view, eo_event_callback_call(ELM_VIEW_LIST_EVENT_MODEL_SELECTED, idata->model));
54}
55
56static void
57_item_del(void *data, Evas_Object *obj EINA_UNUSED)
58{
59 View_List_ItemData *idata = data;
60 if (idata) {
61 eo_do(idata->model, eo_event_callback_del(EMODEL_EVENT_PROPERTIES_CHANGED, _emodel_properties_change_cb, idata));
62 eo_do(idata->model, eo_event_callback_del(EMODEL_EVENT_LOAD_STATUS, _emodel_load_status_change_cb, idata));
63 eo_do(idata->model, eo_event_callback_del(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _emodel_children_count_change_cb, idata));
64 eo_unref(idata->model);
65 idata->model = NULL;
66 idata->item = NULL;
67 idata->parent = NULL;
68 idata->priv = NULL;
69 }
70 free(idata);
71}
72
73static Evas_Object *
74_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part)
75{
76 //XXX: Add a Custon content function??
77 Eina_Value value;
78 const Eina_Value_Type *vtype;
79 Evas_Object *content = NULL;
80 View_List_ItemData *idata = data;
81 EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
82 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
83 Elm_View_List_Data *priv = idata->priv;
84
85 const char *prop = eina_hash_find(priv->prop_con, part);
86 if (prop == NULL) prop = part;
87
88 eina_value_setup(&value, EINA_VALUE_TYPE_STRING);
89 eo_do(idata->model, emodel_property_get(prop, &value));
90 vtype = eina_value_type_get(&value);
91 if (vtype == EINA_VALUE_TYPE_STRING || vtype == EINA_VALUE_TYPE_STRINGSHARE)
92 {
93 char *content_s;
94 eina_value_get(&value, &content_s);
95 content = elm_icon_add(obj);
96 if (elm_icon_standard_set(content, content_s))
97 {
98 evas_object_size_hint_aspect_set(content, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
99 }
100 else
101 {
102 evas_object_del(content);
103 content = NULL;
104 }
105 } else
106 if (vtype == EINA_VALUE_TYPE_BLOB)
107 {
108 Eina_Value_Blob out;
109 eina_value_get(&value, &out);
110 if (out.memory != NULL)
111 {
112 content = elm_image_add(obj);
113
114 elm_image_memfile_set(content, out.memory, out.size, NULL, NULL);
115 }
116 }
117 eina_value_flush(&value);
118
119 return content;
120}
121
122static char *
123_item_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part)
124{
125 Eina_Value value;
126 char *text = NULL;
127 View_List_ItemData *idata = data;
128
129 EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
130 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
131 Elm_View_List_Data *priv = idata->priv;
132 EINA_SAFETY_ON_NULL_RETURN_VAL(idata->model, NULL);
133
134 const char *prop = eina_hash_find(priv->prop_con, part);
135 if (prop == NULL) prop = part;
136
137 eina_value_setup(&value, EINA_VALUE_TYPE_STRING);
138 eo_do(idata->model, emodel_property_get(prop, &value));
139 if (eina_value_type_get(&value) == EINA_VALUE_TYPE_STRING)
140 {
141 text = eina_value_to_string(&value);
142 }
143 eina_value_flush(&value);
144
145 return text;
146}
147
148static void
149_expand_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
150{
151 Elm_Object_Item *item = event_info;
152 View_List_ItemData *idata = elm_object_item_data_get(item);
153 Emodel_Load_Status st;
154
155 eo_do(idata->model, st = emodel_load_status_get());
156 eo_do(idata->model, eo_event_callback_add(EMODEL_EVENT_LOAD_STATUS, _emodel_load_status_change_cb, idata));
157 eo_do(idata->model, eo_event_callback_add(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _emodel_children_count_change_cb, idata));
158 if (st & EMODEL_LOAD_STATUS_LOADED_CHILDREN)
159 {
160 _emodel_load_children(idata);
161 }
162 else
163 {
164 eo_do(idata->model, emodel_children_load());
165 }
166}
167
168static void
169_contract_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
170{
171 Elm_Object_Item *item = event_info;
172 View_List_ItemData *idata = elm_object_item_data_get(item);
173
174 eo_do(idata->model, eo_event_callback_del(EMODEL_EVENT_LOAD_STATUS, _emodel_load_status_change_cb, idata));
175 eo_do(idata->model, eo_event_callback_del(EMODEL_EVENT_CHILDREN_COUNT_CHANGED, _emodel_children_count_change_cb, idata));
176 elm_genlist_item_expanded_set(item, EINA_FALSE);
177}
178
179static void
180_contracted_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info)
181{
182 Elm_Object_Item *glit = event_info;
183 elm_genlist_item_subitems_clear(glit);
184}
185
186static void
187_genlist_deleted(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
188{
189 Elm_View_List_Data *priv = data;
190
191 if (priv && priv->genlist && priv->genlist == obj)
192 {
193 evas_object_smart_callback_del(priv->genlist, "expand,request", _expand_request_cb);
194 evas_object_smart_callback_del(priv->genlist, "contract,request", _contract_request_cb);
195 evas_object_smart_callback_del(priv->genlist, "contracted", _contracted_cb);
196 eo_unref(priv->genlist);
197 priv->genlist = NULL;
198 }
199}
200
201
202/* --- Emodel Callbacks --- */
203static Eina_Bool
204_emodel_properties_change_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
205{
206 View_List_ItemData *idata = data;
207 Emodel_Property_Event *evt = event_info;
208
209 EINA_SAFETY_ON_NULL_RETURN_VAL(idata, EINA_TRUE);
210 EINA_SAFETY_ON_NULL_RETURN_VAL(evt, EINA_TRUE);
211
212 if (idata->item)
213 elm_genlist_item_update(idata->item);
214
215 return EINA_TRUE;
216}
217
218static void
219_emodel_load_children(View_List_ItemData *pdata)
220{
221 Eo *child;
222 Eina_Accessor *accessor;
223 Elm_View_List_Data *priv = pdata->priv;
224 unsigned int total, i;
225
226 eo_do(pdata->model, emodel_children_count_get(&total));
227 if (total == 0)
228 return;
229
230 eo_do(pdata->model, emodel_children_slice_get(0 ,0 ,(Eina_Accessor **)&accessor));
231
232 EINA_SAFETY_ON_NULL_RETURN(accessor);
233
234 EINA_ACCESSOR_FOREACH(accessor, i, child)
235 {
236 View_List_ItemData *idata = malloc(sizeof(View_List_ItemData));
237 memset(idata, 0, sizeof(View_List_ItemData));
238 EINA_SAFETY_ON_NULL_RETURN(idata);
239 idata->priv = priv;
240 idata->parent = pdata;
241 idata->model = child;
242 eo_ref(child);
243 eo_do(child, eo_event_callback_add(EMODEL_EVENT_PROPERTIES_CHANGED, _emodel_properties_change_cb, idata));
244 eo_do(child, emodel_properties_load());
245 idata->item = elm_genlist_item_append(priv->genlist, priv->itc, idata, pdata->item,
246 priv->itype, _item_sel_cb, idata);
247 }
248
249 if (pdata->item)
250 {
251 elm_genlist_item_expanded_set(pdata->item, EINA_TRUE);
252 }
253}
254
255static Eina_Bool
256_emodel_children_count_change_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
257{
258 View_List_ItemData *idata = data;
259 EINA_SAFETY_ON_NULL_RETURN_VAL(idata, EINA_FALSE);
260 EINA_SAFETY_ON_NULL_RETURN_VAL(idata->priv, EINA_FALSE);
261 EINA_SAFETY_ON_NULL_RETURN_VAL(idata->priv->genlist, EINA_FALSE);
262
263 eo_do(idata->priv->genlist, elm_obj_genlist_clear());
264
265 _emodel_load_children(idata);
266
267 return EINA_TRUE;
268}
269
270static Eina_Bool
271_emodel_load_status_change_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
272{
273 View_List_ItemData *idata = data;
274 Emodel_Load *load = event_info;
275
276/* if ((load->status & EMODEL_LOAD_STATUS_LOADED_CHILDREN)
277 && !(data->status & EMODEL_LOAD_STATUS_LOADED_CHILDREN))
278 {
279 _emodel_load_children(idata);
280 }
281 else
282*/
283 if (load->status & EMODEL_LOAD_STATUS_UNLOADED)
284 {
285 if (idata->item)
286 elm_genlist_item_expanded_set(idata->item, EINA_FALSE);
287 }
288
289 idata->status = load->status;
290 return EINA_TRUE;
291}
292
293static void
294_priv_model_set(Elm_View_List_Data *priv, Eo *model)
295{
296 Emodel_Load_Status load_st;
297
298 if (priv->model != NULL)
299 {
300 eo_do(priv->model, eo_event_callback_del(EMODEL_EVENT_LOAD_STATUS,
301 _emodel_load_status_change_cb, priv->rootdata));
302 eo_do(priv->model, eo_event_callback_del(EMODEL_EVENT_CHILDREN_COUNT_CHANGED,
303 _emodel_children_count_change_cb, priv->rootdata));
304 eo_do(priv->genlist, elm_obj_genlist_clear());
305 eo_unref(priv->model);
306 priv->model = NULL;
307 }
308
309 if (model == NULL)
310 return;
311
312 priv->model = model;
313 priv->rootdata->model = priv->model;
314 eo_ref(priv->model);
315
316 eo_do(priv->model, eo_event_callback_add(EMODEL_EVENT_LOAD_STATUS,
317 _emodel_load_status_change_cb, priv->rootdata));
318 eo_do(priv->model, eo_event_callback_add(EMODEL_EVENT_CHILDREN_COUNT_CHANGED,
319 _emodel_children_count_change_cb, priv->rootdata));
320 eo_do(priv->model, load_st = emodel_load_status_get());
321 if (load_st & EMODEL_LOAD_STATUS_LOADED_CHILDREN)
322 {
323 _emodel_load_children(priv->rootdata);
324 }
325}
326
327/**
328 * @brief Elm View List Class impl.
329 */
330static void
331_elm_view_list_constructor(Eo *obj, Elm_View_List_Data *priv, Evas_Object *genlist, Elm_Genlist_Item_Type itype, const char *istyle)
332{
333 eo_do_super(obj, MY_CLASS, eo_constructor());
334
335 priv->view = obj;
336 priv->genlist = genlist;
337 priv->itype = itype;
338 EINA_SAFETY_ON_NULL_RETURN(priv->genlist);
339 eo_ref(priv->genlist);
340
341 priv->rootdata = calloc(1, sizeof(View_List_ItemData));
342 priv->rootdata->priv = priv;
343
344 priv->itc = elm_genlist_item_class_new();
345 priv->itc->item_style = strdup(istyle);
346 priv->itc->func.text_get = _item_text_get;
347 priv->itc->func.content_get = _item_content_get;
348 priv->itc->func.state_get = NULL;
349 priv->itc->func.del = _item_del;
350 priv->prop_con = eina_hash_string_superfast_new(free);
351
352 evas_object_smart_callback_add(priv->genlist, "expand,request", _expand_request_cb, priv);
353 evas_object_smart_callback_add(priv->genlist, "contract,request", _contract_request_cb, priv);
354 evas_object_smart_callback_add(priv->genlist, "contracted", _contracted_cb, priv);
355 evas_object_event_callback_add(priv->genlist, EVAS_CALLBACK_DEL, _genlist_deleted, priv);
356}
357
358
359static void
360_elm_view_list_eo_base_destructor(Eo *obj, Elm_View_List_Data *priv)
361{
362 EINA_SAFETY_ON_NULL_RETURN(priv);
363 EINA_SAFETY_ON_NULL_RETURN(obj);
364
365 eo_do(priv->model, eo_event_callback_del(EMODEL_EVENT_LOAD_STATUS,
366 _emodel_load_status_change_cb, priv->rootdata));
367 eo_do(priv->model, eo_event_callback_del(EMODEL_EVENT_CHILDREN_COUNT_CHANGED,
368 _emodel_children_count_change_cb, priv->rootdata));
369
370 eo_do(priv->genlist, elm_obj_genlist_clear());
371 elm_genlist_item_class_free(priv->itc);
372
373 eina_hash_free(priv->prop_con);
374 free(priv->rootdata);
375 priv->rootdata = NULL;
376 if (priv->genlist) {
377 evas_object_event_callback_del(priv->genlist, EVAS_CALLBACK_DEL, _genlist_deleted);
378 evas_object_smart_callback_del(priv->genlist, "expand,request", _expand_request_cb);
379 evas_object_smart_callback_del(priv->genlist, "contract,request", _contract_request_cb);
380 evas_object_smart_callback_del(priv->genlist, "contracted", _contracted_cb);
381 eo_unref(priv->genlist);
382 }
383
384 eo_unref(priv->model);
385
386 eo_do_super(obj, MY_CLASS, eo_destructor());
387}
388
389static void
390_elm_view_list_evas_object_get(Eo *obj, Elm_View_List_Data *priv, Evas_Object **widget)
391{
392 EINA_SAFETY_ON_NULL_RETURN(priv);
393 EINA_SAFETY_ON_NULL_RETURN(obj);
394 EINA_SAFETY_ON_NULL_RETURN(widget);
395
396 *widget = priv->genlist;
397}
398
399static void
400_elm_view_list_property_connect(Eo *obj EINA_UNUSED, Elm_View_List_Data *priv, const char *property, const char *part)
401{
402 EINA_SAFETY_ON_NULL_RETURN(priv);
403
404 EINA_SAFETY_ON_NULL_RETURN(priv->prop_con);
405 EINA_SAFETY_ON_NULL_RETURN(property);
406 EINA_SAFETY_ON_NULL_RETURN(part);
407
408 free(eina_hash_set(priv->prop_con, part, strdup(property)));
409}
410
411static void
412_elm_view_list_model_set(Eo *obj EINA_UNUSED, Elm_View_List_Data *priv, Emodel *model)
413{
414 EINA_SAFETY_ON_NULL_RETURN(priv);
415 EINA_SAFETY_ON_NULL_RETURN(model);
416 _priv_model_set(priv, model);
417}
418
419static void
420_elm_view_list_model_unset(Eo *obj EINA_UNUSED, Elm_View_List_Data *priv)
421{
422 EINA_SAFETY_ON_NULL_RETURN(priv);
423 _priv_model_set(priv, NULL);
424}
425
426static void
427_elm_view_list_model_get(Eo *obj EINA_UNUSED, Elm_View_List_Data *priv, Eo **model)
428{
429 EINA_SAFETY_ON_NULL_RETURN(priv);
430 EINA_SAFETY_ON_NULL_RETURN(model);
431 *model = priv->model;
432}
433#include "elm_view_list.eo.c"
diff --git a/src/lib/elm_view_list.eo b/src/lib/elm_view_list.eo
new file mode 100644
index 000000000..8516ce4d3
--- /dev/null
+++ b/src/lib/elm_view_list.eo
@@ -0,0 +1,77 @@
1class Elm_View_List (Eo.Base)
2{
3 legacy_prefix: null;
4 methods {
5 constructor {
6 /*@ Constructor wrapper
7 *
8 * @def elm_view_list_constructor
9 * @since 1.11
10 */
11 params {
12 Evas_Object * genlist; /*@ Genlist object */
13 @in Elm_Genlist_Item_Type item_type; /*@ Item type */
14 @in const(char)*item_style; /*@ The current item style name. @c NULL would be default. */
15 }
16 }
17 evas_object_get {
18 /*@ Return evas object
19 *
20 * @def elm_view_list_evas_object_get
21 * @since 1.11
22 */
23 params {
24 @out Evas_Object *widget; /*@ Returned widget */
25 }
26 }
27 property_connect {
28 /*@ Connect property
29 *
30 * @def elm_view_list_property_connect
31 * @since 1.11
32 */
33 params {
34 @in const(char)* property; /*@ Property name */
35 @in const(char)* part; /*@ Edje's theme part */
36 }
37 }
38 model_set {
39 /*@ Set model
40 *
41 * @def elm_view_list_model_set
42 * @since 1.11
43 */
44 params {
45 @in Emodel *model; /*@ New Emodel to set */
46 }
47 }
48 model_unset {
49 /*@ Unset model
50 *
51 * @def elm_view_list_model_unset
52 * @since 1.11
53 */
54 }
55 model_get {
56 /*@ Get model
57 *
58 * @def elm_view_list_model_get
59 * @since 1.11
60 */
61 params {
62 @out Eo *model; /*@ Returned Emodel */
63 }
64 }
65 }
66
67 events {
68 model,selected; /*@ Event dispatch when a model is selected */
69 }
70
71 implements {
72 Eo.Base.destructor;
73 }
74 constructors {
75 .constructor;
76 }
77}
diff --git a/src/lib/elm_view_list.h b/src/lib/elm_view_list.h
new file mode 100644
index 000000000..f1542defa
--- /dev/null
+++ b/src/lib/elm_view_list.h
@@ -0,0 +1,9 @@
1
2#ifdef EFL_EO_API_SUPPORT
3#ifndef ELM_VIEW_LIST_H
4#define ELM_VIEW_LIST_H
5
6#include <Emodel.h>
7#include <elm_view_list.eo.h>
8#endif
9#endif // ELM_VIEW_LIST_H