summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangHyeon Lee <sh10233.lee@samsung.com>2018-04-23 15:13:59 +0900
committerSangHyeon Lee <sh10233.lee@samsung.com>2018-04-28 13:41:41 +0900
commit75f21087f57ac836fa28556239fafe2669696289 (patch)
tree3590304e24214e7c16a27d62911c727b2301f0bb
parentbbbd05148ad6c67450c92e87741f097b49f77352 (diff)
efl_ui_list : introduce new list widget for simple usage
Summary: most usage of simple list, items are very limited and loading performance is not serious. to support those requirement, this efl.ui.list will create scrollable box with efl.pack. user can create list by packing an pre-loaded item object, Efl.Ui.List.Item class. Test Plan: tested in efl_ui_list_example_1.c in examples. Reviewers: cedric, felipealmeida Subscribers: woohyun, Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5861
-rw-r--r--data/elementary/themes/edc/efl/list.edc473
-rw-r--r--src/Makefile_Efl.am1
-rw-r--r--src/Makefile_Elementary.am15
-rw-r--r--src/examples/elementary/.gitignore1
-rw-r--r--src/examples/elementary/Makefile.am2
-rw-r--r--src/examples/elementary/efl_ui_list_example_1.c327
-rw-r--r--src/examples/elementary/efl_ui_view_list_example_1.c2
-rw-r--r--src/examples/elementary/efl_ui_view_list_example_2.c2
-rw-r--r--src/examples/elementary/efl_ui_view_list_example_3.c4
-rw-r--r--src/lib/efl/Efl.h1
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c1
-rw-r--r--src/lib/efl/interfaces/efl_ui_item.eo54
-rw-r--r--src/lib/efl/interfaces/efl_ui_multi_selectable.eo28
-rw-r--r--src/lib/elementary/Elementary.h7
-rw-r--r--src/lib/elementary/efl_ui_item.c260
-rw-r--r--src/lib/elementary/efl_ui_item.eo30
-rw-r--r--src/lib/elementary/efl_ui_item_private.h37
-rw-r--r--src/lib/elementary/efl_ui_list.c1140
-rw-r--r--src/lib/elementary/efl_ui_list.eo93
-rw-r--r--src/lib/elementary/efl_ui_list_default_item.c111
-rw-r--r--src/lib/elementary/efl_ui_list_default_item.eo24
-rw-r--r--src/lib/elementary/efl_ui_list_default_item_part_end.eo9
-rw-r--r--src/lib/elementary/efl_ui_list_default_item_part_icon.eo9
-rw-r--r--src/lib/elementary/efl_ui_list_empty_item.c56
-rw-r--r--src/lib/elementary/efl_ui_list_empty_item.eo16
-rw-r--r--src/lib/elementary/efl_ui_list_item.c83
-rw-r--r--src/lib/elementary/efl_ui_list_item.eo12
-rw-r--r--src/lib/elementary/efl_ui_list_item_private.h31
-rw-r--r--src/lib/elementary/efl_ui_list_private.h63
29 files changed, 2687 insertions, 205 deletions
diff --git a/data/elementary/themes/edc/efl/list.edc b/data/elementary/themes/edc/efl/list.edc
index 4b309c8..1bc55ec 100644
--- a/data/elementary/themes/edc/efl/list.edc
+++ b/data/elementary/themes/edc/efl/list.edc
@@ -1,8 +1,12 @@
1group { "efl/view_list"; 1group { "efl/list";
2 inherit: "efl/scroller"; 2 inherit: "efl/scroller";
3} 3}
4 4
5group { name: "efl/list/item"; 5group { "efl/view_list";
6 inherit: "efl/list";
7}
8
9group { "efl/list_item";
6 data.item: "selectraise" "on"; 10 data.item: "selectraise" "on";
7 data.item: "focusraise" "on"; 11 data.item: "focusraise" "on";
8 images.image: "bevel_curved_horiz_out.png" COMP; 12 images.image: "bevel_curved_horiz_out.png" COMP;
@@ -11,118 +15,91 @@ group { name: "efl/list/item";
11 images.image: "bevel_horiz_out.png" COMP; 15 images.image: "bevel_horiz_out.png" COMP;
12 images.image: "shine.png" COMP; 16 images.image: "shine.png" COMP;
13 parts { 17 parts {
14 part { name: "event"; type: RECT; 18 rect { "event";
15 description { state: "default" 0.0; 19 desc { "default";
16 color: 0 0 0 0; 20 color: 0 0 0 0;
17 } 21 }
18 description { state: "disabled" 0.0; 22 desc { "disabled";
19 inherit: "default" 0.0; 23 inherit: "default";
20 visible: 0; 24 hid;
21 } 25 }
22 } 26 }
23 part { name: "base"; type: RECT; mouse_events: 0; 27 rect { "base"; nomouse;
24 description { state: "default" 0.0; 28 desc { "default";
25 color: 64 64 64 255; 29 color: 64 64 64 255;
26 color_class: "list_item_base"; 30 color_class: "list_item_base";
27 } 31 }
28 description { state: "odd" 0.0; 32 desc { "odd";
29 color: 56 56 56 255; 33 color: 56 56 56 255;
30 color_class: "list_item_base_odd"; 34 color_class: "list_item_base_odd";
31 } 35 }
32 } 36 }
33 program { 37
34 signal: "elm,state,odd"; source: "elm"; 38 image { "bevel"; nomouse;
35 action: STATE_SET "odd" 1.0; 39 desc { "default";
36 target: "base";
37 }
38 program {
39 signal: "elm,state,even"; source: "elm";
40 action: STATE_SET "default" 0.0;
41 target: "base";
42 }
43 part { name: "bevel"; mouse_events: 0;
44 description { state: "default" 0.0;
45 image.normal: "bevel_curved_horiz_out.png"; 40 image.normal: "bevel_curved_horiz_out.png";
46 image.border: 0 0 2 2; 41 image.border: 0 0 2 2;
47 image.middle: 0; 42 image.middle: 0;
48 fill.smooth: 0; 43 fill.smooth: 0;
49 } 44 }
50 } 45 }
51 part { name: "sel_shadow"; mouse_events: 0; 46 swallow { "efl.background";
52 description { state: "default" 0.0; 47 desc { "default";
48 rel.to: "base";
49 vis;
50 }
51 }
52 image { "sel_shadow"; nomouse;
53 desc { "default";
53 image.normal: "shadow_rounded_horiz.png"; 54 image.normal: "shadow_rounded_horiz.png";
54 image.border: 0 0 9 9; 55 image.border: 0 0 9 9;
55 rel1.offset: 0 -4; 56 rel1.offset: 0 -4;
56 rel2.offset: -1 5; 57 rel2.offset: -1 5;
57 fill.smooth: 0; 58 fill.smooth: 0;
58 visible: 0; 59 hid;
59 } 60 }
60 description { state: "selected" 0.0; 61 desc { "selected";
61 inherit: "default" 0.0; 62 inherit: "default";
62 visible: 1; 63 vis;
63 } 64 }
64 } 65 }
65 part { name: "sel_base"; mouse_events: 0; 66 image { "sel_base"; nomouse;
66 description { state: "default" 0.0; 67 desc { "default";
67 image.normal: "vgrad_med_dark.png"; 68 image.normal: "vgrad_med_dark.png";
68 fill.smooth: 0; 69 fill.smooth: 0;
69 visible: 0; 70 hid;
70 TILED_HORIZ(120) 71 TILED_HORIZ(120)
71 } 72 }
72 description { state: "selected" 0.0; 73 desc { "selected";
73 inherit: "default" 0.0; 74 inherit: "default";
74 visible: 1; 75 vis;
75 } 76 }
76 } 77 }
77 part { name: "sel_bevel"; mouse_events: 0; 78 image { "sel_bevel"; nomouse;
78 description { state: "default" 0.0; 79 desc { "default";
79 image.normal: "bevel_horiz_out.png"; 80 image.normal: "bevel_horiz_out.png";
80 image.border: 0 0 2 2; 81 image.border: 0 0 2 2;
81 image.middle: 0; 82 image.middle: 0;
82 fill.smooth: 0; 83 fill.smooth: 0;
83 visible: 0; 84 hid;
84 } 85 }
85 description { state: "selected" 0.0; 86 desc { "selected";
86 inherit: "default" 0.0; 87 inherit: "default";
87 visible: 1; 88 vis;
88 } 89 }
89 } 90 }
90 program {
91 signal: "elm,state,selected"; source: "elm";
92 action: STATE_SET "selected" 0.0;
93 target: "sel_shadow";
94 target: "sel_base";
95 target: "sel_bevel";
96 }
97 program {
98 signal: "elm,state,unselected"; source: "elm";
99 action: STATE_SET "default" 0.0;
100 target: "sel_shadow";
101 target: "sel_base";
102 target: "sel_bevel";
103 }
104 program {
105 signal: "elm,state,disabled"; source: "elm";
106 action: STATE_SET "disabled" 0.0;
107 target: "event";
108 }
109 program {
110 signal: "elm,state,enabled"; source: "elm";
111 action: STATE_SET "default" 0.0;
112 target: "event";
113 }
114 91
115 //##// 92 //##//
116 part { name: "elm.text"; type: TEXT; mouse_events: 0; 93 text { "efl.text"; nomouse;
117 effect: SHADOW BOTTOM; 94 effect: SHADOW BOTTOM;
118 scale: 1; 95 scale: 1;
119 description { state: "default" 0.0; 96 desc { "default";
120 rel1.offset: 2 3; 97 rel1.offset: 2 3;
121 rel1.relative: 1.0 0.0; 98 rel1.relative: 1.0 0.0;
122 rel1.to_x: "elm.swallow.icon"; 99 rel1.to_x: "efl.icon";
123 rel2.offset: -3 -3; 100 rel2.offset: -3 -3;
124 rel2.relative: 0.0 1.0; 101 rel2.relative: 0.0 1.0;
125 rel2.to_x: "elm.swallow.end"; 102 rel2.to_x: "efl.end";
126 color: FN_COL_DEFAULT; 103 color: FN_COL_DEFAULT;
127 color_class: "list_item"; 104 color_class: "list_item";
128 text { font: FN; size: 10; 105 text { font: FN; size: 10;
@@ -132,160 +109,362 @@ group { name: "efl/list/item";
132 text_class: "list_item"; 109 text_class: "list_item";
133 } 110 }
134 } 111 }
135 description { state: "selected" 0.0; 112 desc { "selected";
136 inherit: "default" 0.0; 113 inherit: "default";
137 visible: 0; 114 hid;
138 } 115 }
139 description { state: "disabled" 0.0; 116 desc { "disabled";
140 inherit: "default" 0.0; 117 inherit: "default";
141 visible: 0; 118 hid;
142 } 119 }
143 } 120 }
144 part { name: "label2"; type: TEXT; mouse_events: 0; 121 text { "label2"; nomouse;
145 effect: SHADOW BOTTOM; 122 effect: SHADOW BOTTOM;
146 scale: 1; 123 scale: 1;
147 description { state: "default" 0.0; 124 desc { "default";
148 rel1.to: "elm.text"; 125 rel1.to: "efl.text";
149 rel2.to: "elm.text"; 126 rel2.to: "efl.text";
150 color: FN_COL_DISABLE; 127 color: FN_COL_DISABLE;
151 color_class: "list_item_disabled"; 128 color_class: "list_item_disabled";
152 text { font: FN; size: 10; 129 text { font: FN; size: 10;
153 text_source: "elm.text"; 130 text_source: "efl.text";
154 align: 0.0 0.5; 131 align: 0.0 0.5;
155 text_class: "list_item"; 132 text_class: "list_item";
156 } 133 }
157 visible: 0; 134 hid;
158 } 135 }
159 description { state: "selected" 0.0; 136 desc { "selected";
160 inherit: "default" 0.0; 137 inherit: "default";
161 visible: 0; 138 hid;
162 } 139 }
163 description { state: "disabled" 0.0; 140 desc { "disabled";
164 inherit: "default" 0.0; 141 inherit: "default";
165 visible: 1; 142 vis;
166 } 143 }
167 } 144 }
168 part { name: "label3"; type: TEXT; mouse_events: 0; 145 text { "label3"; nomouse;
169 effect: GLOW; 146 effect: GLOW;
170 scale: 1; 147 scale: 1;
171 description { state: "default" 0.0; 148 desc { "default";
172 rel1.offset: -2 -3; 149 rel1.offset: -2 -3;
173 rel1.to: "elm.text"; 150 rel1.to: "efl.text";
174 rel2.offset: 1 1; 151 rel2.offset: 1 1;
175 rel2.to: "elm.text"; 152 rel2.to: "efl.text";
176 color: FN_COL_HIGHLIGHT; 153 color: FN_COL_HIGHLIGHT;
177 color_class: "list_item_selected"; 154 color_class: "list_item_selected";
178 text { font: FN; size: 10; 155 text { font: FN; size: 10;
179 text_source: "elm.text"; 156 text_source: "efl.text";
180 align: 0.0 0.5; 157 align: 0.0 0.5;
181 text_class: "list_item"; 158 text_class: "list_item";
182 } 159 }
183 visible: 0; 160 hid;
161 }
162 desc { "selected";
163 inherit: "default";
164 vis;
165 }
166 desc { "disabled";
167 inherit: "default";
168 hid;
169 }
170 }
171 //##//
172 swallow { "efl.icon";
173 desc { "default";
174 fixed: 1 0;
175 align: 0.0 0.5;
176 aspect: 1.0 1.0;
177 rel1.offset: 2 2;
178 rel2.relative: 0.0 1.0;
179 rel2.offset: 2 -3;
180 }
181 }
182 swallow { "efl.end";
183 desc { "default";
184 fixed: 1 0;
185 align: 1.0 0.5;
186 aspect: 1.0 1.0;
187 rel1.offset: -3 2;
188 rel1.relative: 1.0 0.0;
189 rel2.offset: -3 -3;
190 }
191 }
192 //##//
193 image { "sel_shine"; nomouse;
194 desc { "default";
195 image.normal: "shine.png";
196 rel1.offset: 0 -2;
197 rel1.to: "sel_base";
198 rel2.relative: 1.0 0.0;
199 rel2.offset: -1 2;
200 rel2.to: "sel_base";
201 hid;
202 FIXED_SIZE(69, 5)
203 }
204 desc { "selected";
205 inherit: "default";
206 vis;
184 } 207 }
185 description { state: "selected" 0.0; 208 }
186 inherit: "default" 0.0; 209 rect { "event_block";
187 visible: 1; 210 desc { "default";
211 color: 0 0 0 0;
212 hid;
188 } 213 }
189 description { state: "disabled" 0.0; 214 desc { "disabled";
190 inherit: "default" 0.0; 215 inherit: "default";
191 visible: 0; 216 vis;
192 } 217 }
193 } 218 }
219 }
220 programs {
221 program {
222 signal: "efl,state,odd"; source: "efl";
223 action: STATE_SET "odd";
224 target: "base";
225 }
194 program { 226 program {
195 signal: "elm,state,selected"; source: "elm"; 227 signal: "efl,state,even"; source: "efl";
196 action: STATE_SET "selected" 0.0; 228 action: STATE_SET "default";
197 target: "elm.text"; 229 target: "base";
230 }
231 program {
232 signal: "efl,state,pressed"; source: "efl";
233 action: STATE_SET "selected";
234 target: "sel_shadow";
235 target: "sel_base";
236 target: "sel_bevel";
237 target: "efl.text";
198 target: "label2"; 238 target: "label2";
199 target: "label3"; 239 target: "label3";
240 target: "sel_shine";
200 } 241 }
201 program { 242 program {
202 signal: "elm,state,unselected"; source: "elm"; 243 signal: "efl,state,unpressed"; source: "efl";
203 action: STATE_SET "default" 0.0; 244 action: STATE_SET "default";
204 target: "elm.text"; 245 target: "sel_shadow";
246 target: "sel_base";
247 target: "sel_bevel";
248 target: "efl.text";
205 target: "label2"; 249 target: "label2";
206 target: "label3"; 250 target: "label3";
251 target: "sel_shine";
207 } 252 }
208 program { 253 program {
209 signal: "elm,state,disabled"; source: "elm"; 254 signal: "efl,state,selected"; source: "efl";
210 action: STATE_SET "disabled" 0.0; 255 action: STATE_SET "selected";
211 target: "elm.text"; 256 target: "sel_shadow";
257 target: "sel_base";
258 target: "sel_bevel";
259 target: "efl.text";
212 target: "label2"; 260 target: "label2";
213 target: "label3"; 261 target: "label3";
262 target: "sel_shine";
214 } 263 }
215 program { 264 program {
216 signal: "elm,state,enabled"; source: "elm"; 265 signal: "efl,state,unselected"; source: "efl";
217 action: STATE_SET "default" 0.0; 266 action: STATE_SET "default";
218 target: "elm.text"; 267 target: "sel_shadow";
268 target: "sel_base";
269 target: "sel_bevel";
270 target: "efl.text";
219 target: "label2"; 271 target: "label2";
220 target: "label3"; 272 target: "label3";
273 target: "sel_shine";
221 } 274 }
222 //##// 275 program {
223 part { name: "elm.swallow.icon"; type: SWALLOW; 276 signal: "efl,state,disabled"; source: "efl";
224 description { state: "default" 0.0; 277 action: STATE_SET "disabled";
225 fixed: 1 0; 278 target: "event";
226 align: 0.0 0.5; 279 target: "efl.text";
227 aspect: 1.0 1.0; 280 target: "label2";
228 rel1.offset: 2 2; 281 target: "label3";
229 rel2.relative: 0.0 1.0; 282 target: "event_block";
230 rel2.offset: 2 -3; 283 }
284 program {
285 signal: "efl,state,enabled"; source: "efl";
286 action: STATE_SET "default";
287 target: "event";
288 target: "efl.text";
289 target: "label2";
290 target: "label3";
291 target: "event_block";
292 }
293 }
294}
295
296group { "efl/list_item:empty";
297 data.item: "selectraise" "on";
298 data.item: "focusraise" "on";
299 images.image: "bevel_curved_horiz_out.png" COMP;
300 images.image: "shadow_rounded_horiz.png" COMP;
301 images.image: "vgrad_med_dark.png" COMP;
302 images.image: "bevel_horiz_out.png" COMP;
303 images.image: "shine.png" COMP;
304 parts {
305 rect { "event";
306 desc { "default";
307 color: 0 0 0 0;
308 }
309 desc { "disabled";
310 inherit: "default";
311 hid;
231 } 312 }
232 } 313 }
233 part { name: "elm.swallow.end"; type: SWALLOW; 314 rect { "base"; nomouse;
234 description { state: "default" 0.0; 315 desc { "default";
235 fixed: 1 0; 316 color: 64 64 64 255;
236 align: 1.0 0.5; 317 color_class: "list_item_base";
237 aspect: 1.0 1.0; 318 }
238 rel1.offset: -3 2; 319 desc { "odd";
239 rel1.relative: 1.0 0.0; 320 color: 56 56 56 255;
321 color_class: "list_item_base_odd";
322 }
323 }
324
325 image { "bevel"; nomouse;
326 desc { "default";
327 image.normal: "bevel_curved_horiz_out.png";
328 image.border: 0 0 2 2;
329 image.middle: 0;
330 fill.smooth: 0;
331 }
332 }
333 swallow { "efl.background";
334 desc { "default";
335 rel.to: "base";
336 vis;
337 }
338 }
339 image { "sel_shadow"; nomouse;
340 desc { "default";
341 image.normal: "shadow_rounded_horiz.png";
342 image.border: 0 0 9 9;
343 rel1.offset: 0 -4;
344 rel2.offset: -1 5;
345 fill.smooth: 0;
346 hid;
347 }
348 desc { "selected";
349 inherit: "default";
350 vis;
351 }
352 }
353 image { "sel_base"; nomouse;
354 desc { "default";
355 image.normal: "vgrad_med_dark.png";
356 fill.smooth: 0;
357 hid;
358 TILED_HORIZ(120)
359 }
360 desc { "selected";
361 inherit: "default";
362 vis;
363 }
364 }
365 image { "sel_bevel"; nomouse;
366 desc { "default";
367 image.normal: "bevel_horiz_out.png";
368 image.border: 0 0 2 2;
369 image.middle: 0;
370 fill.smooth: 0;
371 hid;
372 }
373 desc { "selected";
374 inherit: "default";
375 vis;
376 }
377 }
378 //##//
379 swallow { "efl.content"; mouse;
380 scale;
381 desc { "default";
382 min: 19 19;
383 rel1.offset: -1 2;
240 rel2.offset: -3 -3; 384 rel2.offset: -3 -3;
241 } 385 }
242 } 386 }
243 //##// 387 //##//
244 388 image { "sel_shine";
245 part { name: "sel_shine"; mouse_events: 0; 389 desc { "default";
246 description { state: "default" 0.0;
247 image.normal: "shine.png"; 390 image.normal: "shine.png";
248 rel1.offset: 0 -2; 391 rel1.offset: 0 -2;
249 rel1.to: "sel_base"; 392 rel1.to: "sel_base";
250 rel2.relative: 1.0 0.0; 393 rel2.relative: 1.0 0.0;
251 rel2.offset: -1 2; 394 rel2.offset: -1 2;
252 rel2.to: "sel_base"; 395 rel2.to: "sel_base";
253 visible: 0; 396 hid;
254 FIXED_SIZE(69, 5) 397 FIXED_SIZE(69, 5)
255 } 398 }
256 description { state: "selected" 0.0; 399 desc { "selected";
257 inherit: "default" 0.0; 400 inherit: "default";
258 visible: 1; 401 vis;
259 } 402 }
260 } 403 }
261 part { name: "event_block"; type: RECT; 404 rect { "event_block"; mouse;
262 description { state: "default" 0.0; 405 desc { "default";
263 color: 0 0 0 0; 406 color: 0 0 0 0;
264 visible: 0; 407 hid;
265 } 408 }
266 description { state: "disabled" 0.0; 409 desc { "disabled";
267 inherit: "default" 0.0; 410 inherit: "default";
268 visible: 1; 411 vis;
269 } 412 }
270 } 413 }
414 }
415 programs {
416 program {
417 signal: "efl,state,odd"; source: "efl";
418 action: STATE_SET "odd";
419 target: "base";
420 }
271 program { 421 program {
272 signal: "elm,state,selected"; source: "elm"; 422 signal: "efl,state,even"; source: "efl";
273 action: STATE_SET "selected" 0.0; 423 action: STATE_SET "default";
424 target: "base";
425 }
426 program {
427 signal: "efl,state,pressed"; source: "efl";
428 action: STATE_SET "selected";
429 target: "sel_shadow";
430 target: "sel_base";
431 target: "sel_bevel";
274 target: "sel_shine"; 432 target: "sel_shine";
275 } 433 }
276 program { 434 program {
277 signal: "elm,state,unselected"; source: "elm"; 435 signal: "efl,state,unpressed"; source: "efl";
278 action: STATE_SET "default" 0.0; 436 action: STATE_SET "default";
437 target: "sel_shadow";
438 target: "sel_base";
439 target: "sel_bevel";
279 target: "sel_shine"; 440 target: "sel_shine";
280 } 441 }
281 program { 442 program {
282 signal: "elm,state,disabled"; source: "elm"; 443 signal: "efl,state,selected"; source: "efl";
283 action: STATE_SET "disabled" 0.0; 444 action: STATE_SET "selected";
445 target: "sel_shadow";
446 target: "sel_base";
447 target: "sel_bevel";
448 target: "sel_shine";
449 }
450 program {
451 signal: "efl,state,unselected"; source: "efl";
452 action: STATE_SET "default";
453 target: "sel_shadow";
454 target: "sel_base";
455 target: "sel_bevel";
456 target: "sel_shine";
457 }
458 program {
459 signal: "efl,state,disabled"; source: "efl";
460 action: STATE_SET "disabled";
461 target: "event";
284 target: "event_block"; 462 target: "event_block";
285 } 463 }
286 program { 464 program {
287 signal: "elm,state,enabled"; source: "elm"; 465 signal: "efl,state,enabled"; source: "efl";
288 action: STATE_SET "default" 0.0; 466 action: STATE_SET "default";
467 target: "event";
289 target: "event_block"; 468 target: "event_block";
290 } 469 }
291 } 470 }
diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
index 595b1e6..972eda7 100644
--- a/src/Makefile_Efl.am
+++ b/src/Makefile_Efl.am
@@ -12,6 +12,7 @@ efl_eolian_legacy_files = \
12 lib/efl/interfaces/efl_ui_scrollable_interactive.eo \ 12 lib/efl/interfaces/efl_ui_scrollable_interactive.eo \
13 lib/efl/interfaces/efl_ui_scrollbar.eo \ 13 lib/efl/interfaces/efl_ui_scrollbar.eo \
14 lib/efl/interfaces/efl_ui_selectable.eo \ 14 lib/efl/interfaces/efl_ui_selectable.eo \
15 lib/efl/interfaces/efl_ui_multi_selectable.eo \
15 lib/efl/interfaces/efl_ui_zoom.eo \ 16 lib/efl/interfaces/efl_ui_zoom.eo \
16 $(NULL) 17 $(NULL)
17 18
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index d101d85..ac528db 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -81,6 +81,13 @@ elm_public_eolian_files = \
81 lib/elementary/efl_ui_view_list_pan.eo \ 81 lib/elementary/efl_ui_view_list_pan.eo \
82 lib/elementary/efl_ui_view_list_segarray.eo \ 82 lib/elementary/efl_ui_view_list_segarray.eo \
83 lib/elementary/efl_ui_view_list_relayout.eo \ 83 lib/elementary/efl_ui_view_list_relayout.eo \
84 lib/elementary/efl_ui_item.eo \
85 lib/elementary/efl_ui_list_item.eo \
86 lib/elementary/efl_ui_list_default_item_part_icon.eo \
87 lib/elementary/efl_ui_list_default_item_part_end.eo \
88 lib/elementary/efl_ui_list_default_item.eo \
89 lib/elementary/efl_ui_list_empty_item.eo \
90 lib/elementary/efl_ui_list.eo \
84 lib/elementary/efl_ui_panes_part.eo \ 91 lib/elementary/efl_ui_panes_part.eo \
85 lib/elementary/efl_ui_progressbar_part.eo \ 92 lib/elementary/efl_ui_progressbar_part.eo \
86 lib/elementary/efl_ui_slider_part_indicator.eo \ 93 lib/elementary/efl_ui_slider_part_indicator.eo \
@@ -391,6 +398,9 @@ includesunstable_HEADERS = \
391 lib/elementary/elm_widget_thumb.h \ 398 lib/elementary/elm_widget_thumb.h \
392 lib/elementary/elm_widget_toolbar.h \ 399 lib/elementary/elm_widget_toolbar.h \
393 lib/elementary/efl_ui_video_private.h \ 400 lib/elementary/efl_ui_video_private.h \
401 lib/elementary/efl_ui_item_private.h \
402 lib/elementary/efl_ui_list_item_private.h \
403 lib/elementary/efl_ui_list_private.h \
394 lib/elementary/efl_ui_view_list_private.h \ 404 lib/elementary/efl_ui_view_list_private.h \
395 lib/elementary/efl_ui_view_list_segarray.h \ 405 lib/elementary/efl_ui_view_list_segarray.h \
396 lib/elementary/elm_widget_web.h \ 406 lib/elementary/elm_widget_web.h \
@@ -809,6 +819,11 @@ lib_elementary_libelementary_la_SOURCES = \
809 lib/elementary/efl_ui_focus_parent_provider_gen.c \ 819 lib/elementary/efl_ui_focus_parent_provider_gen.c \
810 lib/elementary/efl_ui_focus_util.c \ 820 lib/elementary/efl_ui_focus_util.c \
811 lib/elementary/elm_widget_item_static_focus.c \ 821 lib/elementary/elm_widget_item_static_focus.c \
822 lib/elementary/efl_ui_item.c \
823 lib/elementary/efl_ui_list_item.c \
824 lib/elementary/efl_ui_list_default_item.c \
825 lib/elementary/efl_ui_list_empty_item.c \
826 lib/elementary/efl_ui_list.c \
812 lib/elementary/efl_ui_view_list.c \ 827 lib/elementary/efl_ui_view_list.c \
813 lib/elementary/efl_ui_view_list_precise_layouter.c \ 828 lib/elementary/efl_ui_view_list_precise_layouter.c \
814 lib/elementary/efl_ui_view_list_segarray.c \ 829 lib/elementary/efl_ui_view_list_segarray.c \
diff --git a/src/examples/elementary/.gitignore b/src/examples/elementary/.gitignore
index 896a690..f59adb3 100644
--- a/src/examples/elementary/.gitignore
+++ b/src/examples/elementary/.gitignore
@@ -60,6 +60,7 @@
60/list_example_01 60/list_example_01
61/list_example_02 61/list_example_02
62/list_example_03 62/list_example_03
63/efl_ui_list_example_1
63/efl_ui_view_list_example_1 64/efl_ui_view_list_example_1
64/efl_ui_view_list_example_2 65/efl_ui_view_list_example_2
65/efl_ui_view_list_example_3 66/efl_ui_view_list_example_3
diff --git a/src/examples/elementary/Makefile.am b/src/examples/elementary/Makefile.am
index 488b48f..51dbd20 100644
--- a/src/examples/elementary/Makefile.am
+++ b/src/examples/elementary/Makefile.am
@@ -177,6 +177,7 @@ efl_thread_3.c \
177efl_thread_4.c \ 177efl_thread_4.c \
178efl_thread_5.c \ 178efl_thread_5.c \
179efl_thread_6.c \ 179efl_thread_6.c \
180efl_ui_list_example_1.c \
180efl_ui_view_list_example_1.c \ 181efl_ui_view_list_example_1.c \
181efl_ui_view_list_example_2.c \ 182efl_ui_view_list_example_2.c \
182efl_ui_view_list_example_3.c 183efl_ui_view_list_example_3.c
@@ -393,6 +394,7 @@ efl_thread_3 \
393efl_thread_4 \ 394efl_thread_4 \
394efl_thread_5 \ 395efl_thread_5 \
395efl_thread_6 \ 396efl_thread_6 \
397efl_ui_list_example_1 \
396efl_ui_view_list_example_1 \ 398efl_ui_view_list_example_1 \
397efl_ui_view_list_example_2 \ 399efl_ui_view_list_example_2 \
398efl_ui_view_list_example_3 400efl_ui_view_list_example_3
diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c
new file mode 100644
index 0000000..432c586
--- /dev/null
+++ b/src/examples/elementary/efl_ui_list_example_1.c
@@ -0,0 +1,327 @@
1// gcc -o efl_ui_list_example_1 efl_ui_list_example_1.c `pkg-config --cflags --libs elementary`
2// ./efl_ui_list_example_1 item_style_name
3
4#ifdef HAVE_CONFIG_H
5# include "elementary_config.h"
6#else
7# define EFL_BETA_API_SUPPORT 1
8# define EFL_EO_API_SUPPORT 1
9#endif
10
11#include <Elementary.h>
12#include <Efl.h>
13#include <Eio.h>
14#include <stdio.h>
15
16#define NUM_ITEMS 400
17
18typedef struct _List_Scroll_Data {
19 Eo *list;
20 Eo *slider;
21 Eina_Bool anim;
22} List_Scroll_Data;
23List_Scroll_Data priv_d;
24
25
26static void
27_list_selected(void *data, const Efl_Event *ev)
28{
29 Eo *list = ev->object;
30 Eo *item = ev->info, *tmp;
31 printf("list item [%p:%d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_item_selected_get(item)? "selected" : "unselected"));
32
33 Eina_Iterator *selects = efl_ui_list_selected_items_get(list);
34
35 EINA_ITERATOR_FOREACH(selects, tmp)
36 printf("selected [%p:%d] ", tmp, efl_ui_item_index_get(tmp));
37 printf("\n");
38 eina_iterator_free(selects);
39}
40
41static void
42_list_unselected(void *data, const Efl_Event *ev)
43{
44 Eo *item = ev->info;
45 printf("list item [%p : %d] is %s\n", item, efl_ui_item_index_get(item), (efl_ui_item_selected_get(item)? "selected" : "unselected"));
46}
47
48static void
49_list_pressed(void *data, const Efl_Event *ev)
50{
51 Eo *item = ev->info;
52 printf("list item [%p : %d] is pressed\n", item, efl_ui_item_index_get(item));
53}
54
55static void
56_list_unpressed(void *data, const Efl_Event *ev)
57{
58 Eo *item = ev->info;
59 printf("list item [%p : %d] is unpressed\n", item, efl_ui_item_index_get(item));
60}
61
62static void
63_list_longpressed(void *data, const Efl_Event *ev)
64{
65 Eo *item = ev->info;
66 printf("list item [%p : %d] is longpressed\n", item, efl_ui_item_index_get(item));
67}
68
69static void
70_select_radio_changed(void *data, const Efl_Event *ev)
71{
72 Eo *list = data;
73 efl_ui_select_mode_set(list, efl_ui_radio_state_value_get(ev->object));
74}
75
76static void
77_anim_radio_changed(void *data, const Efl_Event *ev)
78{
79 priv_d.anim = efl_ui_radio_state_value_get(ev->object);
80}
81
82static void
83_scrl_btn_clicked(void *data, const Efl_Event *ev)
84{
85 Efl_Ui_List_Item *item = efl_ui_list_last_selected_item_get(priv_d.list);
86 printf("show [%d:%p] [%d]\n", efl_ui_item_index_get(item), item, priv_d.anim);
87 efl_ui_list_item_scroll(priv_d.list, item, priv_d.anim);
88}
89
90static void
91_scrl_align_btn_clicked(void *data, const Efl_Event *ev)
92{
93 Efl_Ui_List_Item *item = efl_ui_list_last_selected_item_get(priv_d.list);
94 double align = efl_ui_range_value_get(priv_d.slider);
95 printf("show [%d:%p] [%.2lf], [%d]\n", efl_ui_item_index_get(item), item, align, priv_d.anim);
96 efl_ui_list_item_scroll_align(priv_d.list, item, align, priv_d.anim);
97}
98
99EAPI_MAIN int
100elm_main(int argc, char **argv)
101{
102 Eo *win, *list;
103 Eo *wbox, *ibox, *bbox, *rbox;
104 Eo *item, *check, *txt;
105 Eo *radio, *select_radio, *anim_radio;
106 Eo *slider, *scrl_btn;
107 int i;
108 char buf[256];
109 Eina_Bool emptystyle = EINA_FALSE;
110
111 win = elm_win_util_standard_add("list", "list");
112 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
113 elm_win_autodel_set(win, EINA_TRUE);
114 efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 800));
115
116 wbox = efl_add(EFL_UI_BOX_CLASS, win);
117 efl_ui_direction_set(wbox, EFL_UI_DIR_VERTICAL);
118 efl_gfx_size_hint_weight_set(wbox, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND);
119 efl_gfx_size_hint_align_set(wbox, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL);
120
121 if ((argv[1] != NULL) &&
122 (!strcmp(argv[1], "empty")))
123 emptystyle = EINA_TRUE;
124
125 priv_d.list = list = efl_add(EFL_UI_LIST_CLASS, wbox);
126 efl_gfx_size_hint_weight_set(list, EFL_GFX_SIZE_HINT_EXPAND, 0.9);
127
128 efl_event_callback_add(list, EFL_UI_EVENT_SELECTED, _list_selected, NULL);
129 efl_event_callback_add(list, EFL_UI_EVENT_UNSELECTED, _list_unselected, NULL);
130 efl_event_callback_add(list, EFL_UI_EVENT_PRESSED, _list_pressed, NULL);
131 efl_event_callback_add(list, EFL_UI_EVENT_UNPRESSED, _list_unpressed, NULL);
132 efl_event_callback_add(list, EFL_UI_EVENT_LONGPRESSED, _list_longpressed, NULL);
133
134 for (i = 0; i < NUM_ITEMS; i++)
135 {
136 if (emptystyle) item = efl_add(EFL_UI_LIST_EMPTY_ITEM_CLASS, list);
137 else item = efl_add(EFL_UI_LIST_DEFAULT_ITEM_CLASS, list);
138
139 /* disable case test */
140 if (i == 1) efl_ui_widget_disabled_set(item, EINA_TRUE);
141
142 if (emptystyle)
143 {
144 ibox = efl_add(EFL_UI_BOX_CLASS, item);
145 efl_ui_direction_set(ibox, EFL_UI_DIR_HORIZONTAL);
146
147 txt = efl_add(EFL_UI_TEXT_CLASS, ibox);
148 efl_gfx_size_hint_weight_set(txt, 0.95, EFL_GFX_SIZE_HINT_EXPAND);
149 efl_text_halign_set(txt, 0.2);
150 efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
151 snprintf(buf, sizeof(buf), "empty style item [%d]", i);
152 efl_text_set(txt, buf);
153 efl_pack_end(ibox, txt);
154
155 check = efl_add(EFL_UI_CHECK_CLASS, ibox);
156 efl_gfx_size_hint_weight_set(check, 0.05, EFL_GFX_SIZE_HINT_EXPAND);
157 efl_pack_end(ibox, check);
158
159 if (i % 2)
160 efl_content_set(item, ibox);
161 else
162 efl_content_set(efl_part(item, "content"), ibox);
163 }
164 else
165 {
166 snprintf(buf, sizeof(buf), "default style item [%d]", i);
167 if (i % 2)
168 efl_text_set(efl_part(item, "text"), buf);
169 else
170 efl_text_set(item, buf);
171
172
173 check = efl_add(EFL_UI_CHECK_CLASS, item);
174 if ((i % 3) == 0)
175 efl_content_set(efl_part(item, "end"), check);
176 else if ((i % 3) == 1)
177 efl_content_set(efl_part(item, "icon"), check);
178 else
179 efl_content_set(item, check);
180 }
181 /* Pack APIs test */
182 switch (i)
183 {
184 case 10:
185 efl_gfx_color_set(efl_part(item, "background"), 255, 0, 0, 255);
186 efl_pack_begin(list, item);
187 break;
188
189 case 20:
190 efl_gfx_color_set(efl_part(item, "background"), 0, 255, 0, 255);
191 efl_pack_before(list, item, efl_pack_content_get(list, 19));
192 break;
193
194 case 30:
195 efl_gfx_color_set(efl_part(item, "background"), 0, 0, 255, 255);
196 efl_pack_after(list, item, efl_pack_content_get(list, 29));
197 break;
198
199 case 40:
200 efl_file_set(efl_part(item, "background"), "./sky_01.jpg", NULL);
201 efl_gfx_image_scale_type_set(efl_part(item, "background"), EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE);
202 efl_pack_at(list, item, 39);
203 break;
204
205 case 50:
206 efl_file_set(efl_part(item, "background"), "./sky_01.jpg", NULL);
207 efl_gfx_image_scale_type_set(efl_part(item, "background"), EFL_GFX_IMAGE_SCALE_TYPE_TILE);
208 efl_pack(list, item);
209 break;
210
211 case 60:
212 efl_pack(list, item);
213 efl_pack_unpack(list, item);
214 efl_del(item);
215 break;
216
217 default:
218 efl_pack_end(list, item);
219 }
220 }
221
222 efl_pack_end(wbox, list);
223
224 /*select mode */
225 txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
226 efl_gfx_size_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
227 efl_text_halign_set(txt, 0.02);
228 efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
229 efl_text_set(txt, "Select Mode");
230 efl_pack_end(wbox, txt);
231
232 bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
233 efl_ui_direction_set(bbox, EFL_UI_DIR_HORIZONTAL);
234 efl_gfx_size_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
235
236 select_radio = radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
237 efl_text_set(radio, "SINGLE");
238 efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_SINGLE);
239 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
240 efl_pack_end(bbox, radio);
241 radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
242 efl_text_set(radio, "SINGLE_ALWAYS");
243 efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_SINGLE_ALWAYS);
244 efl_ui_radio_group_add(radio, select_radio);
245 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
246 efl_pack_end(bbox, radio);
247 radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
248 efl_text_set(radio, "MULTI");
249 efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_MULTI);
250 efl_ui_radio_group_add(radio, select_radio);
251 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
252 efl_pack_end(bbox, radio);
253 radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
254 efl_text_set(radio, "NONE");
255 efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_NONE);
256 efl_ui_radio_group_add(radio, select_radio);
257 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
258 efl_pack_end(bbox, radio);
259 efl_pack_end(wbox, bbox);
260
261 /* scroll mode */
262 txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
263 efl_gfx_size_hint_weight_set(txt, EFL_GFX_SIZE_HINT_EXPAND, 0.01);
264 efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
265 efl_text_halign_set(txt, 0.02);
266 efl_text_set(txt, "Item Scroll");
267 efl_pack_end(wbox, txt);
268
269 priv_d.slider = slider = efl_add(EFL_UI_SLIDER_CLASS, wbox);
270 efl_ui_direction_set(slider, EFL_UI_DIR_HORIZONTAL);
271 efl_gfx_size_hint_weight_set(slider, 0.0, 0.05);
272 efl_gfx_size_hint_align_set(slider, 0.5, 0.5);
273 efl_gfx_size_hint_min_set(slider, EINA_SIZE2D(380, 20));
274 efl_ui_range_min_max_set(slider, 0.0, 1.0);
275 efl_pack_end(wbox, slider);
276
277 bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
278 efl_ui_direction_set(bbox, EFL_UI_DIR_HORIZONTAL);
279 efl_gfx_size_hint_weight_set(bbox, EFL_GFX_SIZE_HINT_EXPAND, 0.05);
280
281 rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
282 efl_ui_direction_set(rbox, EFL_UI_DIR_VERTICAL);
283
284 anim_radio = radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
285 efl_gfx_size_hint_align_set(radio, 0.5, 0.5);
286 efl_text_set(radio, "ANIMATION OFF");
287 efl_ui_radio_state_value_set(radio, 0);
288 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
289 efl_pack_end(rbox, radio);
290 radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
291 efl_gfx_size_hint_align_set(radio, 0.5, 0.5);
292 efl_text_set(radio, "ANIMATION ON");
293 efl_ui_radio_state_value_set(radio, 1);
294 efl_ui_radio_group_add(radio, anim_radio);
295 efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
296 efl_pack_end(rbox, radio);
297 efl_pack_end(bbox, rbox);
298
299 rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
300 efl_ui_direction_set(rbox, EFL_UI_DIR_VERTICAL);
301
302 scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
303 efl_text_set(scrl_btn, "Scroll Item");
304 efl_gfx_size_hint_align_set(scrl_btn, 0.5, 0.5);
305 efl_gfx_size_hint_min_set(scrl_btn, EINA_SIZE2D(200, 25));
306 efl_event_callback_add(scrl_btn, EFL_UI_EVENT_CLICKED, _scrl_btn_clicked, NULL);
307 efl_pack_end(rbox, scrl_btn);
308
309 scrl_btn = efl_add(EFL_UI_BUTTON_CLASS, rbox);
310 efl_text_set(scrl_btn, "Scroll Item Align");
311 efl_gfx_size_hint_align_set(scrl_btn, 0.5, 0.5);
312 efl_gfx_size_hint_min_set(scrl_btn, EINA_SIZE2D(200, 25));
313 efl_event_callback_add(scrl_btn, EFL_UI_EVENT_CLICKED, _scrl_align_btn_clicked, NULL);
314 efl_pack_end(rbox, scrl_btn);
315
316 efl_pack_end(bbox, rbox);
317 efl_pack_end(wbox, bbox);
318
319 elm_win_resize_object_add(win, wbox);
320 //window show
321 efl_gfx_entity_visible_set(win, EINA_TRUE);
322
323 elm_run();
324
325 return 0;
326}
327ELM_MAIN() \ No newline at end of file
diff --git a/src/examples/elementary/efl_ui_view_list_example_1.c b/src/examples/elementary/efl_ui_view_list_example_1.c
index 3994fa4..621f81e 100644
--- a/src/examples/elementary/efl_ui_view_list_example_1.c
+++ b/src/examples/elementary/efl_ui_view_list_example_1.c
@@ -85,7 +85,7 @@ elm_main(int argc, char **argv)
85 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 85 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
86 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style"); 86 efl_ui_model_connect(factory, "signal/elm,state,%v", "odd_style");
87 efl_ui_model_connect(factory, "elm.text", "name"); 87 efl_ui_model_connect(factory, "elm.text", "name");
88 efl_ui_layout_factory_theme_config(factory, "list", "item", "default"); 88 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
89 89
90 li = efl_add(EFL_UI_VIEW_LIST_CLASS, win); 90 li = efl_add(EFL_UI_VIEW_LIST_CLASS, win);
91 efl_ui_view_list_layout_factory_set(li, factory); 91 efl_ui_view_list_layout_factory_set(li, factory);
diff --git a/src/examples/elementary/efl_ui_view_list_example_2.c b/src/examples/elementary/efl_ui_view_list_example_2.c
index 6a7c0ee..fac0e5d 100644
--- a/src/examples/elementary/efl_ui_view_list_example_2.c
+++ b/src/examples/elementary/efl_ui_view_list_example_2.c
@@ -46,7 +46,7 @@ elm_main(int argc, char **argv)
46 model = efl_add(EIO_MODEL_CLASS, efl_main_loop_get(), eio_model_path_set(efl_added, dirname)); 46 model = efl_add(EIO_MODEL_CLASS, efl_main_loop_get(), eio_model_path_set(efl_added, dirname));
47 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 47 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
48 efl_ui_model_connect(factory, "elm.text", "filename"); 48 efl_ui_model_connect(factory, "elm.text", "filename");
49 efl_ui_layout_factory_theme_config(factory, "list", "item", "default"); 49 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
50 50
51 li = efl_add(EFL_UI_VIEW_LIST_CLASS, win); 51 li = efl_add(EFL_UI_VIEW_LIST_CLASS, win);
52 efl_ui_view_list_layout_factory_set(li, factory); 52 efl_ui_view_list_layout_factory_set(li, factory);
diff --git a/src/examples/elementary/efl_ui_view_list_example_3.c b/src/examples/elementary/efl_ui_view_list_example_3.c
index 53a816c..c2e8281 100644
--- a/src/examples/elementary/efl_ui_view_list_example_3.c
+++ b/src/examples/elementary/efl_ui_view_list_example_3.c
@@ -223,7 +223,7 @@ elm_main(int argc, char **argv)
223 priv->model = _make_model(); 223 priv->model = _make_model();
224 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 224 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
225 efl_ui_model_connect(factory, "elm.text", "filename"); 225 efl_ui_model_connect(factory, "elm.text", "filename");
226 efl_ui_layout_factory_theme_config(factory, "list", "item", "default"); 226 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
227 227
228 priv->list1 = efl_add(EFL_UI_VIEW_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); 228 priv->list1 = efl_add(EFL_UI_VIEW_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
229 efl_event_callback_add(priv->list1, EFL_UI_VIEW_LIST_EVENT_ITEM_REALIZED, _realized_1_cb, priv); 229 efl_event_callback_add(priv->list1, EFL_UI_VIEW_LIST_EVENT_ITEM_REALIZED, _realized_1_cb, priv);
@@ -235,7 +235,7 @@ elm_main(int argc, char **argv)
235 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); 235 factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
236 efl_ui_model_connect(factory, "elm.text", "filename"); 236 efl_ui_model_connect(factory, "elm.text", "filename");
237 efl_ui_model_connect(factory, "signal/elm,state,%v", "selected"); 237 efl_ui_model_connect(factory, "signal/elm,state,%v", "selected");
238 efl_ui_layout_factory_theme_config(factory, "list", "item", "default"); 238 efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
239 priv->list2 = efl_add(EFL_UI_VIEW_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model)); 239 priv->list2 = efl_add(EFL_UI_VIEW_LIST_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
240 efl_event_callback_add(priv->list2, EFL_UI_VIEW_LIST_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2); 240 efl_event_callback_add(priv->list2, EFL_UI_VIEW_LIST_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2);
241 evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 241 evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
index 22175bf..e9b00b1 100644
--- a/src/lib/efl/Efl.h
+++ b/src/lib/efl/Efl.h
@@ -92,6 +92,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
92#include "interfaces/efl_ui_scrollbar.eo.h" 92#include "interfaces/efl_ui_scrollbar.eo.h"
93#include "interfaces/efl_ui_scrollable_interactive.eo.h" 93#include "interfaces/efl_ui_scrollable_interactive.eo.h"
94#include "interfaces/efl_ui_selectable.eo.h" 94#include "interfaces/efl_ui_selectable.eo.h"
95#include "interfaces/efl_ui_multi_selectable.eo.h"
95#include "interfaces/efl_ui_zoom.eo.h" 96#include "interfaces/efl_ui_zoom.eo.h"
96 97
97#include "interfaces/efl_screen.eo.h" 98#include "interfaces/efl_screen.eo.h"
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index d245e4a..4e02e1e 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -74,6 +74,7 @@
74#include "interfaces/efl_ui_scrollable_interactive.eo.c" 74#include "interfaces/efl_ui_scrollable_interactive.eo.c"
75#include "interfaces/efl_ui_scrollbar.eo.c" 75#include "interfaces/efl_ui_scrollbar.eo.c"
76#include "interfaces/efl_ui_selectable.eo.c" 76#include "interfaces/efl_ui_selectable.eo.c"
77#include "interfaces/efl_ui_multi_selectable.eo.c"
77#include "interfaces/efl_ui_zoom.eo.c" 78#include "interfaces/efl_ui_zoom.eo.c"
78 79
79EAPI void 80EAPI void
diff --git a/src/lib/efl/interfaces/efl_ui_item.eo b/src/lib/efl/interfaces/efl_ui_item.eo
deleted file mode 100644
index 49ef31b..0000000
--- a/src/lib/efl/interfaces/efl_ui_item.eo
+++ /dev/null
@@ -1,54 +0,0 @@
1interface Efl.Ui.Item {
2 [[Efl UI item interface]]
3 legacy_prefix: null;
4 methods {
5 @property prev {
6 get {
7 [[Get the item before this one in the widget's list of items.
8
9 See also @.next.
10 ]]
11 }
12 values {
13 item: Efl.Ui.Item; [[The item before the object in its parent's
14 list. If there is no previous item or in case
15 of error, $null is returned.]]
16 }
17 }
18 @property next {
19 get {
20 [[Get the item after this one in the widget's list of items.
21
22 See also @.prev.
23 ]]
24 }
25 values {
26 item: Efl.Ui.Item; [[The item after the object in its parent's
27 list. If there is no next item or in case
28 of error, $null is returned.]]
29 }
30 }
31 @property selected {
32 [[Indicates whether this item is currently selected.]]
33 get {
34 [[Get the selected state of this item.]]
35 }
36 set {
37 [[Set the selected state of $item.
38
39 This sets the selected state of the given item $it.
40 $true for selected, $false for not selected.
41
42 If a new item is selected the previously selected will
43 be unselected. Previously selected item can be retrieved
44 with @Efl.Ui.Menu.selected_item.get.
45
46 Selected items will be highlighted.
47 ]]
48 }
49 values {
50 selected: bool; [[The selection state.]]
51 }
52 }
53 }
54}
diff --git a/src/lib/efl/interfaces/efl_ui_multi_selectable.eo b/src/lib/efl/interfaces/efl_ui_multi_selectable.eo
new file mode 100644
index 0000000..8e82750
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_ui_multi_selectable.eo
@@ -0,0 +1,28 @@
1enum Efl.Ui.Select_Mode {
2 [[Type of multi selectable object.]]
3 legacy: efl_ui_select;
4 single, [[Only single child is selected. if the child is selected,
5 previous selected child will be unselected.]]
6 single_always, [[Same as single select except, this will be selected
7 in every select calls though child is already been selected.]]
8 multi, [[allow multiple selection of children.]]
9 none [[Last value of select mode. child cannot be selected at all.]]
10}
11
12interface Efl.Ui.Multi_Selectable ()
13{
14 [[Efl UI Multi selectable interface.
15 The container have to control select property of multiple chidren.]]
16 eo_prefix: efl_ui;
17 methods
18 {
19 @property select_mode {
20 [[The mode type for children selection.]]
21 set {}
22 get {}
23 values {
24 mode: Efl.Ui.Select_Mode; [[Type of selection of children]]
25 }
26 }
27 }
28}
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 2853ba2..b59383a 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -324,6 +324,13 @@ typedef Eo Efl_Ui_Focus_Manager;
324# include <efl_ui_image_factory.eo.h> 324# include <efl_ui_image_factory.eo.h>
325# include <efl_ui_slider_interval.eo.h> 325# include <efl_ui_slider_interval.eo.h>
326# include <efl_ui_layout_factory.eo.h> 326# include <efl_ui_layout_factory.eo.h>
327# include <efl_ui_item.eo.h>
328# include <efl_ui_list_item.eo.h>
329# include <efl_ui_list_default_item_part_icon.eo.h>
330# include <efl_ui_list_default_item_part_end.eo.h>
331# include <efl_ui_list_default_item.eo.h>
332# include <efl_ui_list_empty_item.eo.h>
333# include <efl_ui_list.eo.h>
327# include <efl_ui_view_list_types.eot.h> 334# include <efl_ui_view_list_types.eot.h>
328# include <efl_ui_view_list_segarray.h> 335# include <efl_ui_view_list_segarray.h>
329# include <efl_ui_view_list_segarray.eo.h> 336# include <efl_ui_view_list_segarray.eo.h>
diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c
new file mode 100644
index 0000000..5eed4b2
--- /dev/null
+++ b/src/lib/elementary/efl_ui_item.c
@@ -0,0 +1,260 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_ACCESS_PROTECTED
6#define EFL_UI_WIDGET_PART_BG_PROTECTED
7
8#include <Elementary.h>
9
10#include "elm_priv.h"
11#include "efl_ui_item_private.h"
12
13#define MY_CLASS EFL_UI_ITEM_CLASS
14#define MY_CLASS_PFX efl_ui_item
15
16#define MY_CLASS_NAME "Efl.Ui.Item"
17
18static void
19_item_select(Eo *obj, Efl_Ui_Item_Data *pd)
20{
21 if (pd->selected &&
22 (*(pd->select_mode) != EFL_UI_SELECT_SINGLE_ALWAYS))
23 return;
24 if (*(pd->select_mode) == EFL_UI_SELECT_NONE) return;
25
26 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
27
28 pd->selected = EINA_TRUE;
29 edje_object_signal_emit(wd->resize_obj, "efl,state,selected", "efl");
30 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTED, NULL);
31}
32
33static void
34_item_unselect(Eo *obj, Efl_Ui_Item_Data *pd)
35{
36 if (!pd->selected) return;
37 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
38
39 pd->selected = EINA_FALSE;
40 edje_object_signal_emit(wd->resize_obj, "efl,state,unselected", "efl");
41 efl_event_callback_call(obj, EFL_UI_EVENT_UNSELECTED, NULL);
42}
43
44/* Mouse Controls */
45static Eina_Bool
46_item_longpressed(void *data)
47{
48 Efl_Ui_Item *item = data;
49 EFL_UI_ITEM_DATA_GET_OR_RETURN(item, pd, ECORE_CALLBACK_CANCEL);
50
51 pd->longpress_timer = NULL;
52
53 efl_event_callback_call(item, EFL_UI_EVENT_LONGPRESSED, NULL);
54 return ECORE_CALLBACK_CANCEL;
55}
56
57static void
58_item_mouse_down(void *data,
59 Evas *evas EINA_UNUSED,
60 Evas_Object *obj EINA_UNUSED,
61 void *event_info)
62{
63 Evas_Event_Mouse_Down *ev = event_info;
64 Eo *item = data;
65 EFL_UI_ITEM_DATA_GET_OR_RETURN(item, pd);
66 ELM_WIDGET_DATA_GET_OR_RETURN(item, wd);
67 if (wd->disabled) return;
68 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
69
70 edje_object_signal_emit(wd->resize_obj, "efl,state,pressed", "efl");
71
72 pd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _item_longpressed, item);
73 efl_event_callback_call(item, EFL_UI_EVENT_PRESSED, NULL);
74}
75
76static void
77_item_mouse_up(void *data,
78 Evas *evas EINA_UNUSED,
79 Evas_Object *obj EINA_UNUSED,
80 void *event_info)
81{
82 Evas_Event_Mouse_Up *ev = event_info;
83 Eo *item = data;
84 EFL_UI_ITEM_DATA_GET_OR_RETURN(item, pd);
85 ELM_WIDGET_DATA_GET_OR_RETURN(item, wd);
86 if (wd->disabled) return;
87 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
88 {
89 //FIXME: should we send this message to fallback?
90 edje_object_signal_emit(wd->resize_obj, "efl,state,unpressed", "efl");
91 //efl_event_callback_call(item, EFL_UI_EVENT_UNPRESSED, NULL);
92 return;
93 }
94
95 if (pd->longpress_timer)
96 {
97 ecore_timer_del(pd->longpress_timer);
98 pd->longpress_timer = NULL;
99 }
100
101 edje_object_signal_emit(wd->resize_obj, "efl,state,unpressed", "efl");
102 efl_event_callback_call(item, EFL_UI_EVENT_UNPRESSED, NULL);
103
104 if ((*(pd->select_mode) != EFL_UI_SELECT_SINGLE_ALWAYS) && (pd->selected))
105 _item_unselect(item, pd);
106 else if (*(pd->select_mode) != EFL_UI_SELECT_NONE)
107 _item_select(item, pd);
108}
109
110static void
111_item_mouse_move(void *data EINA_UNUSED,
112 Evas *evas EINA_UNUSED,
113 Evas_Object *obj EINA_UNUSED,
114 void *event_info)
115{
116 Evas_Event_Mouse_Move *ev = event_info;
117 Eo *item = data;
118 EFL_UI_ITEM_DATA_GET_OR_RETURN(item, pd);
119 ELM_WIDGET_DATA_GET_OR_RETURN(item, wd);
120 if (wd->disabled) return;
121 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
122 {
123 edje_object_signal_emit(wd->resize_obj, "efl,state,unpressed", "efl");
124 return;
125 }
126}
127
128static void
129_item_mouse_in(void *data EINA_UNUSED,
130 Evas *evas EINA_UNUSED,
131 Evas_Object *obj EINA_UNUSED,
132 void *event_info)
133{
134 Evas_Event_Mouse_In *ev = event_info;
135 Eo *item = data;
136 EFL_UI_ITEM_DATA_GET_OR_RETURN(item, pd);
137 ELM_WIDGET_DATA_GET_OR_RETURN(item, wd);
138 if (wd->disabled) return;
139
140 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
141}
142
143static void
144_item_mouse_callback_add(Eo *obj, void *data)
145{
146 evas_object_event_callback_add
147 (obj, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down, data);
148 evas_object_event_callback_add
149 (obj, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up, data);
150 evas_object_event_callback_add
151 (obj, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move, data);
152 evas_object_event_callback_add
153 (obj, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in, data);
154}
155
156static void
157_item_mouse_callback_del(Eo *obj, void *data)
158{
159 evas_object_event_callback_del_full
160 (obj, EVAS_CALLBACK_MOUSE_DOWN, _item_mouse_down, data);
161 evas_object_event_callback_del_full
162 (obj, EVAS_CALLBACK_MOUSE_UP, _item_mouse_up, data);
163 evas_object_event_callback_del_full
164 (obj, EVAS_CALLBACK_MOUSE_MOVE, _item_mouse_move, data);
165 evas_object_event_callback_del_full
166 (obj, EVAS_CALLBACK_MOUSE_IN, _item_mouse_in, data);
167}
168/* Mouse Controls ends */
169
170static void
171_sizing_eval(Evas_Object *obj, Efl_Ui_Item_Data *pd)
172{
173 Evas_Coord minh = -1, minw = -1;
174 Evas_Coord rest_w = 0, rest_h = 0;
175 ELM_WIDGET_DATA_GET_OR_RETURN(pd->obj, wd);
176
177 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
178 rest_w, rest_h);
179 evas_object_size_hint_min_set(obj, minw, minh);
180
181 pd->needs_size_calc = EINA_FALSE;
182}
183
184static void
185_efl_ui_item_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Item_Data *pd)
186{
187 if (pd->needs_size_calc) return;
188 pd->needs_size_calc = EINA_TRUE;
189
190 efl_canvas_group_change(obj);
191}
192
193EOLIAN static void
194_efl_ui_item_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Item_Data *pd)
195{
196 if (pd->needs_size_calc)
197 {
198 _sizing_eval(obj, pd);
199 pd->needs_size_calc = EINA_FALSE;
200 }
201}
202
203EOLIAN static Eo *
204_efl_ui_item_efl_object_constructor(Eo *obj, Efl_Ui_Item_Data *pd)
205{
206 pd->obj = obj;
207 obj = efl_constructor(efl_super(obj, MY_CLASS));
208
209 return obj;
210}
211
212EOLIAN static Efl_Object *
213_efl_ui_item_efl_object_finalize(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED)
214{
215 Eo *eo;
216 eo = efl_finalize(efl_super(obj, MY_CLASS));
217 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
218
219 _item_mouse_callback_add(wd->resize_obj, eo);
220 return eo;
221}
222
223EOLIAN static void
224_efl_ui_item_efl_object_destructor(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED)
225{
226 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
227
228 _item_mouse_callback_del(wd->resize_obj, obj);
229 efl_destructor(efl_super(obj, MY_CLASS));
230}
231
232EOLIAN static int
233_efl_ui_item_index_get(const Eo *obj, Efl_Ui_Item_Data *pd)
234{
235 return efl_pack_index_get(pd->parent, obj);
236}
237
238EOLIAN static void
239_efl_ui_item_selected_set(Eo *obj, Efl_Ui_Item_Data *pd, Eina_Bool select)
240{
241 Eina_Bool selected = !!select;
242 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
243 if (wd->disabled) return;
244
245 if (selected) _item_select(obj, pd);
246 else _item_unselect(obj, pd);
247}
248
249EOLIAN static Eina_Bool
250_efl_ui_item_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
251{
252 return pd->selected;
253}
254
255/* Internal EO APIs and hidden overrides */
256
257#define EFL_UI_ITEM_EXTRA_OPS \
258 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_item)
259
260#include "efl_ui_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo
new file mode 100644
index 0000000..6137dd9
--- /dev/null
+++ b/src/lib/elementary/efl_ui_item.eo
@@ -0,0 +1,30 @@
1abstract Efl.Ui.Item (Efl.Ui.Layout.Object, Efl.Ui.Selectable, Efl.Ui.Clickable)
2{
3 [[Item abstract class for pack widget. All item have to be inherited from this class.]]
4 methods {
5 @property index {
6 [[index number of item from their parent object.]]
7 get {}
8 values {
9 index : int;
10 }
11 }
12 @property selected {
13 [[Select property for item object.
14 Item can be selected by user mouse/key input also]]
15 set {}
16 get {}
17 values {
18 select: bool;
19 }
20 }
21 }
22 implements {
23 //Efl.Object
24 Efl.Object.constructor;
25 Efl.Object.finalize;
26 Efl.Object.destructor;
27 //Efl.Canvas
28 Efl.Canvas.Group.group_calculate;
29 }
30}
diff --git a/src/lib/elementary/efl_ui_item_private.h b/src/lib/elementary/efl_ui_item_private.h
new file mode 100644
index 0000000..b8849a2
--- /dev/null
+++ b/src/lib/elementary/efl_ui_item_private.h
@@ -0,0 +1,37 @@
1#ifndef EFL_UI_ITEM_PRIVATE_H
2#define EFL_UI_ITEM_PRIVATE_H
3
4#include "Elementary.h"
5
6typedef struct _Efl_Ui_Item_Data
7{
8 // Eo Objects
9 Eo *obj; /* Self-Object */
10 Eo *parent; /* Parent Widget */
11
12 Efl_Ui_Select_Mode *select_mode; /* Select Mdoe of parent widget */
13 Ecore_Timer *longpress_timer; /* Timer for longpress handle */
14
15 // Boolean Data
16 Eina_Bool selected : 1; /* State for item selected */
17 Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */
18} Efl_Ui_Item_Data;
19
20
21#define EFL_UI_ITEM_DATA_GET(o, pd) \
22 Efl_Ui_Item_Data * pd = efl_data_scope_safe_get(o, EFL_UI_ITEM_CLASS)
23
24#define EFL_UI_ITEM_DATA_GET_OR_RETURN(o, ptr, ...) \
25 EFL_UI_ITEM_DATA_GET(o, ptr); \
26 if (EINA_UNLIKELY(!ptr)) \
27 { \
28 ERR("No widget data for object %p (%s)", \
29 o, evas_object_type_get(o)); \
30 return __VA_ARGS__; \
31 }
32
33#define EFL_UI_ITEM_CHECK_OR_RETURN(obj, ...) \
34 if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_ITEM_CLASS))) \
35 return __VA_ARGS__;
36
37#endif
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
new file mode 100644
index 0000000..bb6abf3
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list.c
@@ -0,0 +1,1140 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define ELM_LAYOUT_PROTECTED
6#define EFL_UI_SCROLL_MANAGER_PROTECTED
7#define EFL_UI_SCROLLBAR_PROTECTED
8#define EFL_UI_SCROLLBAR_BETA
9
10#include <Elementary.h>
11#include "elm_priv.h"
12#include "efl_ui_list_item_private.h"
13#include "efl_ui_item_private.h"
14#include "efl_ui_list_private.h"
15
16#define MY_CLASS EFL_UI_LIST_CLASS
17#define MY_CLASS_PFX efl_ui_list
18
19#define MY_CLASS_NAME "Efl.Ui.List"
20
21static void
22_item_scroll_internal(Eo *obj,
23 Efl_Ui_List_Item *item,
24 double align,
25 Eina_Bool anim)
26{
27 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
28 Eina_Rect ipos, view;
29 Eina_Position2D vpos;
30
31 if (!pd->smanager) return;
32
33 ipos = efl_gfx_entity_geometry_get(item);
34 view = efl_ui_scrollable_viewport_geometry_get(pd->smanager);
35 vpos = efl_ui_scrollable_content_pos_get(pd->smanager);
36
37 ipos.x = view.x;
38 ipos.w = ipos.w;
39
40 // FIXME: align case will not correctly show in the position because of
41 // bar size calculation. there are no certain way to know the scroll calcuation finished.
42 if (EINA_DBL_EQ(align, -1.0))
43 {
44 ipos.y = ipos.y + vpos.y - view.y;
45 ipos.h = ipos.h;
46 }
47 else if ((align > 0.0 || EINA_DBL_EQ(align, 0.0)) &&
48 (align < 1.0 || EINA_DBL_EQ(align, 1.0)))
49 {
50 ipos.y = ipos.y + vpos.y - view.y - (int)((view.h - ipos.h) * align);
51 ipos.h = view.h;
52 }
53 else ERR("align (%.2lf) is not proper value. it must be the value between [0.0 , 1.0]!", align);
54
55 efl_ui_scrollable_scroll(pd->smanager, ipos, anim);
56}
57
58static void
59_efl_ui_list_bar_read_and_update(Eo *obj)
60{
61 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
62 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
63 double vx = 0.0, vy = 0.0;
64
65 edje_object_part_drag_value_get
66 (wd->resize_obj, "efl.dragable.vbar", NULL, &vy);
67
68 /* FIXME: Horizontal Scroll is not yet supported in the list.
69 edje_object_part_drag_value_get
70 (wd->resize_obj, "efl.dragable.hbar", &vx, NULL);
71 */
72
73 efl_ui_scrollbar_bar_position_set(pd->smanager, vx, vy);
74}
75
76static void
77_efl_ui_list_reload_cb(void *data,
78 Evas_Object *obj EINA_UNUSED,
79 const char *emission EINA_UNUSED,
80 const char *source EINA_UNUSED)
81{
82 Eo *list = data;
83 EFL_UI_LIST_DATA_GET_OR_RETURN(list, pd);
84
85 efl_ui_scrollbar_bar_visibility_update(pd->smanager);
86}
87
88static void
89_efl_ui_list_vbar_drag_cb(void *data,
90 Evas_Object *obj EINA_UNUSED,
91 const char *emission EINA_UNUSED,
92 const char *source EINA_UNUSED)
93{
94 _efl_ui_list_bar_read_and_update(data);
95
96 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
97 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
98}
99
100static void
101_efl_ui_list_vbar_press_cb(void *data,
102 Evas_Object *obj EINA_UNUSED,
103 const char *emission EINA_UNUSED,
104 const char *source EINA_UNUSED)
105{
106 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
107 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
108}
109
110static void
111_efl_ui_list_vbar_unpress_cb(void *data,
112 Evas_Object *obj EINA_UNUSED,
113 const char *emission EINA_UNUSED,
114 const char *source EINA_UNUSED)
115{
116 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_VERTICAL;
117 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
118}
119
120static void
121_efl_ui_list_edje_drag_start_cb(void *data,
122 Evas_Object *obj EINA_UNUSED,
123 const char *emission EINA_UNUSED,
124 const char *source EINA_UNUSED)
125{
126 Eo *list = data;
127 EFL_UI_LIST_DATA_GET_OR_RETURN(list, pd);
128
129 _efl_ui_list_bar_read_and_update(list);
130
131 pd->freeze_want = efl_ui_scrollable_scroll_freeze_get(pd->smanager);
132 efl_ui_scrollable_scroll_freeze_set(pd->smanager, EINA_TRUE);
133 efl_event_callback_call(list, EFL_UI_EVENT_SCROLL_DRAG_START, NULL);
134}
135
136static void
137_efl_ui_list_edje_drag_stop_cb(void *data,
138 Evas_Object *obj EINA_UNUSED,
139 const char *emission EINA_UNUSED,
140 const char *source EINA_UNUSED)
141{
142 Eo *list = data;
143 EFL_UI_LIST_DATA_GET_OR_RETURN(list, pd);
144
145 _efl_ui_list_bar_read_and_update(list);
146
147 efl_ui_scrollable_scroll_freeze_set(pd->smanager, pd->freeze_want);
148 efl_event_callback_call(list, EFL_UI_EVENT_SCROLL_DRAG_STOP, NULL);
149}
150
151static void
152_efl_ui_list_edje_drag_cb(void *data,
153 Evas_Object *obj EINA_UNUSED,
154 const char *emission EINA_UNUSED,
155 const char *source EINA_UNUSED)
156{
157 _efl_ui_list_bar_read_and_update(data);
158}
159
160/* FIXME: Horizontal Scroll is not yet supported in the list.
161 static void
162 _efl_ui_list_hbar_drag_cb(void *data,
163 Evas_Object *obj EINA_UNUSED,
164 const char *emission EINA_UNUSED,
165 const char *source EINA_UNUSED)
166 {
167 _efl_ui_list_bar_read_and_update(data);
168
169 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
170 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_DRAG, &type);
171 }
172
173 static void
174 _efl_ui_list_hbar_press_cb(void *data,
175 Evas_Object *obj EINA_UNUSED,
176 const char *emission EINA_UNUSED,
177 const char *source EINA_UNUSED)
178 {
179 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
180 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_PRESS, &type);
181 }
182
183 static void
184 _efl_ui_list_hbar_unpress_cb(void *data,
185 Evas_Object *obj EINA_UNUSED,
186 const char *emission EINA_UNUSED,
187 const char *source EINA_UNUSED)
188 {
189 Efl_Ui_Scrollbar_Direction type = EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL;
190 efl_event_callback_call(data, EFL_UI_SCROLLBAR_EVENT_BAR_UNPRESS, &type);
191 }
192 */
193
194static void
195_efl_ui_list_bar_size_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
196{
197 Eo *obj = data;
198 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
199 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
200
201 double width = 0.0, height = 0.0;
202
203 edje_object_calc_force(wd->resize_obj);
204 efl_ui_scrollbar_bar_size_get(pd->smanager, &width, &height);
205 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.hbar", width, 1.0);
206 edje_object_part_drag_size_set(wd->resize_obj, "efl.dragable.vbar", 1.0, height);
207}
208
209static void
210_efl_ui_list_bar_pos_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
211{
212 Eo *obj = data;
213 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
214 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
215
216 double posx = 0.0, posy = 0.0;
217
218 efl_ui_scrollbar_bar_position_get(pd->smanager, &posx, &posy);
219 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.hbar", posx, 0.0);
220 edje_object_part_drag_value_set(wd->resize_obj, "efl.dragable.vbar", 0.0, posy);
221}
222
223static void
224_efl_ui_list_bar_show_cb(void *data, const Efl_Event *event)
225{
226 Eo *obj = data;
227 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
228 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
229 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
230
231 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
232 edje_object_signal_emit(wd->resize_obj, "efl,action,show,hbar", "efl");
233 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
234 edje_object_signal_emit(wd->resize_obj, "efl,action,show,vbar", "efl");
235}
236
237static void
238_efl_ui_list_bar_hide_cb(void *data, const Efl_Event *event)
239{
240 Eo *obj = data;
241 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
242 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
243 Efl_Ui_Scrollbar_Direction type = *(Efl_Ui_Scrollbar_Direction *)(event->info);
244
245 if (type == EFL_UI_SCROLLBAR_DIRECTION_HORIZONTAL)
246 edje_object_signal_emit(wd->resize_obj, "efl,action,hide,hbar", "efl");
247 else if (type == EFL_UI_SCROLLBAR_DIRECTION_VERTICAL)
248 edje_object_signal_emit(wd->resize_obj, "efl,action,hide,vbar", "efl");
249}
250
251static void
252_scroll_edje_object_attach(Eo *obj)
253{
254 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
255
256 efl_layout_signal_callback_add
257 (obj, "reload", "efl",
258 _efl_ui_list_reload_cb, obj);
259 efl_layout_signal_callback_add
260 (obj, "drag", "efl.dragable.vbar",
261 _efl_ui_list_vbar_drag_cb, obj);
262 efl_layout_signal_callback_add
263 (obj, "drag,set", "efl.dragable.vbar",
264 _efl_ui_list_edje_drag_cb, obj);
265 efl_layout_signal_callback_add
266 (obj, "drag,start", "efl.dragable.vbar",
267 _efl_ui_list_edje_drag_start_cb, obj);
268 efl_layout_signal_callback_add
269 (obj, "drag,stop", "efl.dragable.vbar",
270 _efl_ui_list_edje_drag_stop_cb, obj);
271 efl_layout_signal_callback_add
272 (obj, "drag,step", "efl.dragable.vbar",
273 _efl_ui_list_edje_drag_cb, obj);
274 efl_layout_signal_callback_add
275 (obj, "drag,page", "efl.dragable.vbar",
276 _efl_ui_list_edje_drag_cb, obj);
277 efl_layout_signal_callback_add
278 (obj, "efl,vbar,press", "efl",
279 _efl_ui_list_vbar_press_cb, obj);
280 efl_layout_signal_callback_add
281 (obj, "efl,vbar,unpress", "efl",
282 _efl_ui_list_vbar_unpress_cb, obj);
283
284 /* FIXME: Horizontal Scroll is not yet supported in the list.
285 efl_layout_signal_callback_add
286 (obj, "drag", "efl.dragable.hbar",
287 _efl_ui_list_hbar_drag_cb, obj);
288 efl_layout_signal_callback_add
289 (obj, "drag,set", "efl.dragable.hbar",
290 _efl_ui_list_edje_drag_cb, obj);
291 efl_layout_signal_callback_add
292 (obj, "drag,start", "efl.dragable.hbar",
293 _efl_ui_list_edje_drag_start_cb, obj);
294 efl_layout_signal_callback_add
295 (obj, "drag,stop", "efl.dragable.hbar",
296 _efl_ui_list_edje_drag_stop_cb, obj);
297 efl_layout_signal_callback_add
298 (obj, "drag,step", "efl.dragable.hbar",
299 _efl_ui_list_edje_drag_cb, obj);
300 efl_layout_signal_callback_add
301 (obj, "drag,page", "efl.dragable.hbar",
302 _efl_ui_list_edje_drag_cb, obj);
303 efl_layout_signal_callback_add
304 (obj, "efl,hbar,press", "efl",
305 _efl_ui_list_hbar_press_cb, obj);
306 efl_layout_signal_callback_add
307 (obj, "efl,hbar,unpress", "efl",
308 _efl_ui_list_hbar_unpress_cb, obj);
309 */
310}
311
312static void
313_scroll_edje_object_detach(Eo *obj)
314{
315 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
316
317 efl_layout_signal_callback_del
318 (obj, "reload", "efl",
319 _efl_ui_list_reload_cb, obj);
320 efl_layout_signal_callback_del
321 (obj, "drag", "efl.dragable.vbar",
322 _efl_ui_list_vbar_drag_cb, obj);
323 efl_layout_signal_callback_del
324 (obj, "drag,set", "efl.dragable.vbar",
325 _efl_ui_list_edje_drag_cb, obj);
326 efl_layout_signal_callback_del
327 (obj, "drag,start", "efl.dragable.vbar",
328 _efl_ui_list_edje_drag_start_cb, obj);
329 efl_layout_signal_callback_del
330 (obj, "drag,stop", "efl.dragable.vbar",
331 _efl_ui_list_edje_drag_stop_cb, obj);
332 efl_layout_signal_callback_del
333 (obj, "drag,step", "efl.dragable.vbar",
334 _efl_ui_list_edje_drag_cb, obj);
335 efl_layout_signal_callback_del
336 (obj, "drag,page", "efl.dragable.vbar",
337 _efl_ui_list_edje_drag_cb, obj);
338 efl_layout_signal_callback_del
339 (obj, "efl,vbar,press", "efl",
340 _efl_ui_list_vbar_press_cb, obj);
341 efl_layout_signal_callback_del
342 (obj, "efl,vbar,unpress", "efl",
343 _efl_ui_list_vbar_unpress_cb, obj);
344
345 /* FIXME: Horizontal Scroll is not yet supported in the list.
346 efl_layout_signal_callback_del
347 (obj, "drag", "efl.dragable.hbar",
348 _efl_ui_list_hbar_drag_cb, obj);
349 efl_layout_signal_callback_del
350 (obj, "drag,set", "efl.dragable.hbar",
351 _efl_ui_list_edje_drag_cb, obj);
352 efl_layout_signal_callback_del
353 (obj, "drag,start", "efl.dragable.hbar",
354 _efl_ui_list_edje_drag_start_cb, obj);
355 efl_layout_signal_callback_del
356 (obj, "drag,stop", "efl.dragable.hbar",
357 _efl_ui_list_edje_drag_stop_cb, obj);
358 efl_layout_signal_callback_del
359 (obj, "drag,step", "efl.dragable.hbar",
360 _efl_ui_list_edje_drag_cb, obj);
361 efl_layout_signal_callback_del
362 (obj, "drag,page", "efl.dragable.hbar",
363 _efl_ui_list_edje_drag_cb, obj);
364 efl_layout_signal_callback_del
365 (obj, "efl,hbar,press", "efl",
366 _efl_ui_list_hbar_press_cb, obj);
367 efl_layout_signal_callback_del
368 (obj, "efl,hbar,unpress", "efl",
369 _efl_ui_list_hbar_unpress_cb, obj);
370 */
371}
372
373static void
374_efl_ui_list_pan_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
375{
376 Eo *obj = data;
377 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
378 if (!pd->smanager) return;
379
380 elm_layout_sizing_eval(obj);
381
382 if (!pd->pan_resized)
383 {
384 Eina_Rect view = efl_ui_scrollable_viewport_geometry_get(pd->smanager);
385 // FIXME: Below code is workaround size check
386 if (view.h > 1)
387 {
388 pd->pan_resized = EINA_TRUE;
389 if (pd->scroll.item)
390 {
391 _item_scroll_internal(obj, pd->scroll.item, pd->scroll.align, pd->scroll.anim);
392
393 pd->scroll.item = NULL;
394 pd->scroll.align = 0.0;
395 pd->scroll.anim = EINA_FALSE;
396 return;
397 }
398 }
399 }
400}
401
402static void
403_efl_ui_list_resized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
404{
405 elm_layout_sizing_eval(data);
406}
407
408static void
409_efl_ui_list_size_hint_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
410{
411 elm_layout_sizing_eval(data);
412}
413
414EOLIAN static Eo *
415_efl_ui_list_efl_object_constructor(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED)
416{
417 obj = efl_constructor(efl_super(obj, MY_CLASS));
418
419 return obj;
420}
421
422EOLIAN static Eo *
423_efl_ui_list_efl_object_finalize(Eo *obj,
424 Efl_Ui_List_Data *pd)
425{
426 obj = efl_finalize(efl_super(obj, MY_CLASS));
427
428 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
429
430 efl_ui_layout_object_theme_set(obj, "list", "base", efl_ui_widget_style_get(obj));
431
432 pd->smanager = efl_add(EFL_UI_SCROLL_MANAGER_CLASS, obj);
433 efl_ui_mirrored_set(pd->smanager, efl_ui_mirrored_get(obj));
434
435 pd->pan = efl_add(EFL_UI_PAN_CLASS, obj);
436
437 efl_ui_scroll_manager_pan_set(pd->smanager, pd->pan);
438 edje_object_part_swallow(wd->resize_obj, "efl.content", pd->pan);
439
440 pd->box = efl_add(EFL_UI_BOX_CLASS, obj,
441 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
442 efl_ui_mirrored_set(pd->box, efl_ui_mirrored_get(obj));
443 efl_content_set(pd->pan, pd->box);
444
445 pd->select_mode = EFL_UI_SELECT_SINGLE;
446
447 _scroll_edje_object_attach(obj);
448
449 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
450 _efl_ui_list_bar_size_changed_cb, obj);
451 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
452 _efl_ui_list_bar_pos_changed_cb, obj);
453 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
454 _efl_ui_list_bar_show_cb, obj);
455 efl_event_callback_add(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
456 _efl_ui_list_bar_hide_cb, obj);
457 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_RESIZE,
458 _efl_ui_list_resized_cb, obj);
459 efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_CHANGE_SIZE_HINTS,
460 _efl_ui_list_size_hint_changed_cb, obj);
461 efl_event_callback_add(pd->pan, EFL_GFX_ENTITY_EVENT_RESIZE,
462 _efl_ui_list_pan_resized_cb, obj);
463
464 elm_layout_sizing_eval(obj);
465
466 return obj;
467}
468
469EOLIAN static void
470_efl_ui_list_efl_object_destructor(Eo *obj, Efl_Ui_List_Data *pd)
471{
472 _scroll_edje_object_detach(obj);
473
474 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SIZE_CHANGED,
475 _efl_ui_list_bar_size_changed_cb, obj);
476 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_POS_CHANGED,
477 _efl_ui_list_bar_pos_changed_cb, obj);
478 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_SHOW,
479 _efl_ui_list_bar_show_cb, obj);
480 efl_event_callback_del(obj, EFL_UI_SCROLLBAR_EVENT_BAR_HIDE,
481 _efl_ui_list_bar_hide_cb, obj);
482 efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_RESIZE,
483 _efl_ui_list_resized_cb, obj);
484 efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_CHANGE_SIZE_HINTS,
485 _efl_ui_list_size_hint_changed_cb, obj);
486 efl_event_callback_del(pd->pan, EFL_GFX_ENTITY_EVENT_RESIZE,
487 _efl_ui_list_pan_resized_cb, obj);
488
489 efl_del(pd->box);
490 pd->box = NULL;
491 efl_del(pd->pan);
492 pd->pan = NULL;
493 efl_del(pd->smanager);
494 pd->smanager = NULL;
495
496 efl_destructor(efl_super(obj, MY_CLASS));
497}
498
499EOLIAN static void
500_efl_ui_list_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd EINA_UNUSED)
501{
502 // Need to be implemented
503 efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
504}
505
506EOLIAN static void
507_efl_ui_list_elm_layout_sizing_eval(Eo *obj, Efl_Ui_List_Data *pd)
508{
509 Eina_Size2D min = {0, 0}, max = {0, 0}, size = {-1, -1};
510 Eina_Rect view = {};
511 Evas_Coord vmw = 0, vmh = 0;
512 double xw = 0.0, yw = 0.0;
513
514 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
515
516 if (pd->box)
517 {
518 min = efl_gfx_size_hint_combined_min_get(pd->box);
519 max = efl_gfx_size_hint_max_get(pd->box);
520 efl_gfx_size_hint_weight_get(pd->box, &xw, &yw);
521 }
522
523 if (pd->smanager)
524 view = efl_ui_scrollable_viewport_geometry_get(pd->smanager);
525
526 if (xw > 0.0)
527 {
528 if ((min.w > 0) && (view.w < min.w))
529 view.w = min.w;
530 else if ((max.w > 0) && (view.w > max.w))
531 view.w = max.w;
532 }
533 else if (min.w > 0)
534 view.w = min.w;
535
536 if (yw > 0.0)
537 {
538 if ((min.h > 0) && (view.h < min.h))
539 view.h = min.h;
540 else if ((max.h > 0) && (view.h > max.h))
541 view.h = max.h;
542 }
543 else if (min.h > 0)
544 view.h = min.h;
545
546 if (pd->box) efl_gfx_entity_size_set(pd->box, EINA_SIZE2D(view.w, view.h));
547
548 edje_object_size_min_calc(wd->resize_obj, &vmw, &vmh);
549
550 if (pd->match_content_w) size.w = vmw + min.w;
551 if (pd->match_content_h) size.h = vmh + min.h;
552
553 max = efl_gfx_size_hint_max_get(obj);
554 if ((max.w > 0) && (size.w > max.w)) size.w = max.w;
555 if ((max.h > 0) && (size.h > max.h)) size.h = max.h;
556
557 efl_gfx_size_hint_min_set(obj, size);
558}
559
560//FIXME: is this box related API could be improved more?
561EOLIAN static int
562_efl_ui_list_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
563{
564 return pd->box ? efl_content_count(pd->box) : 0;
565}
566
567EOLIAN static Eina_Iterator *
568_efl_ui_list_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
569{
570 return pd->box ? efl_content_iterate(pd->box) : NULL;
571}
572
573/* FIXME: Direction is not supported yet in the list
574 EOLIAN static void
575 _efl_ui_list_efl_ui_direction_direction_set(Eo *obj, Efl_Ui_List_Data *pd, Efl_Ui_Dir dir)
576 {
577 switch (dir)
578 {
579 case EFL_UI_DIR_RTL:
580 // FIXME: Should be inverted!
581 case EFL_UI_DIR_HORIZONTAL:
582 case EFL_UI_DIR_LTR:
583 pd->dir = EFL_UI_DIR_HORIZONTAL;
584 break;
585
586 case EFL_UI_DIR_UP:
587 // FIXME: Should be inverted!
588 case EFL_UI_DIR_DOWN:
589 case EFL_UI_DIR_VERTICAL:
590 case EFL_UI_DIR_DEFAULT:
591 default:
592 pd->dir = EFL_UI_DIR_VERTICAL;
593 break;
594 }
595
596 efl_pack_layout_request(obj);
597 }
598 */
599
600EOLIAN static Efl_Ui_Theme_Apply
601_efl_ui_list_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_List_Data *pd)
602{
603 Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
604 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
605 if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
606
607 efl_ui_mirrored_set(pd->smanager, efl_ui_mirrored_get(obj));
608
609 elm_layout_sizing_eval(obj);
610
611 return int_ret;
612}
613
614static void
615_list_item_pressed(void *data, const Efl_Event *event)
616{
617 Eo *obj = data;
618 Efl_Ui_List_Item *item = event->object;
619 efl_event_callback_call(obj, EFL_UI_EVENT_PRESSED, item);
620}
621
622static void
623_list_item_unpressed(void *data, const Efl_Event *event)
624{
625 Eo *obj = data;
626 Efl_Ui_List_Item *item = event->object;
627 efl_event_callback_call(obj, EFL_UI_EVENT_UNPRESSED, item);
628}
629
630static void
631_list_item_longpressed(void *data, const Efl_Event *event)
632{
633 Eo *obj = data;
634 Efl_Ui_List_Item *item = event->object;
635 efl_event_callback_call(obj, EFL_UI_EVENT_LONGPRESSED, item);
636}
637
638static void
639_list_item_selected(void *data, const Efl_Event *event)
640{
641 Eo *obj = data;
642 Efl_Ui_List_Item *item = event->object;
643 Efl_Ui_List_Item *selected;
644 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
645
646 /* Single Select */
647 if (pd->select_mode != EFL_UI_SELECT_MULTI)
648 {
649 EINA_LIST_FREE(pd->selected, selected)
650 {
651 if (selected != item)
652 efl_ui_item_selected_set(selected, EINA_FALSE);
653 }
654 }
655 pd->selected = eina_list_append(pd->selected, item);
656 pd->last_selected = item;
657
658 efl_event_callback_call(obj, EFL_UI_EVENT_SELECTED, item);
659}
660
661static void
662_list_item_unselected(void *data, const Efl_Event *event)
663{
664 Eo *obj = data;
665 Efl_Ui_List_Item *item = event->object;
666 EFL_UI_LIST_DATA_GET_OR_RETURN(obj, pd);
667
668 pd->selected = eina_list_remove(pd->selected, item);
669 if (pd->last_selected == item) pd->last_selected = NULL;
670
671 efl_event_callback_call(obj, EFL_UI_EVENT_UNSELECTED, item);
672}
673
674static Eina_Bool
675_list_item_process(Eo *obj, Efl_Ui_List_Data *pd, EINA_UNUSED Efl_Ui_List_Item *it)
676{
677 EFL_UI_LIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
678
679 //FIXME: This is tricky workaround for set select mode and parent value.
680 EFL_UI_LIST_ITEM_DATA_GET(it, ld);
681 EFL_UI_ITEM_DATA_GET(it, id);
682 id->select_mode = &(pd->select_mode);
683 id->parent = obj;
684 ld->parent = obj;
685 efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj));
686
687 efl_event_callback_add(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
688 efl_event_callback_add(it, EFL_UI_EVENT_UNPRESSED, _list_item_unpressed, obj);
689 efl_event_callback_add(it, EFL_UI_EVENT_LONGPRESSED, _list_item_longpressed, obj);
690 efl_event_callback_add(it, EFL_UI_EVENT_SELECTED, _list_item_selected, obj);
691 efl_event_callback_add(it, EFL_UI_EVENT_UNSELECTED, _list_item_unselected, obj);
692
693 return EINA_TRUE;
694}
695
696static void
697_list_item_clear(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED, EINA_UNUSED Efl_Ui_List_Item *it)
698{
699 EFL_UI_LIST_ITEM_CHECK_OR_RETURN(it);
700 EFL_UI_LIST_ITEM_DATA_GET(it, ld);
701 EFL_UI_ITEM_DATA_GET(it, id);
702 id->select_mode = NULL;
703 id->parent = NULL;
704 ld->parent = NULL;
705
706 efl_event_callback_del(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
707 efl_event_callback_del(it, EFL_UI_EVENT_UNPRESSED, _list_item_unpressed, obj);
708 efl_event_callback_del(it, EFL_UI_EVENT_LONGPRESSED, _list_item_longpressed, obj);
709 efl_event_callback_del(it, EFL_UI_EVENT_SELECTED, _list_item_selected, obj);
710 efl_event_callback_del(it, EFL_UI_EVENT_UNSELECTED, _list_item_unselected, obj);
711}
712
713/* Pack APIs */
714EOLIAN static Eina_Bool
715_efl_ui_list_efl_pack_pack_clear(Eo *obj, Efl_Ui_List_Data *pd)
716{
717 Eina_Bool ret = efl_pack_clear(pd->box);
718
719 if (ret)
720 {
721 eina_list_free(pd->items);
722 eina_list_free(pd->selected);
723 pd->items = NULL;
724 pd->selected = NULL;
725 }
726
727 elm_layout_sizing_eval(obj);
728 return ret;
729}
730
731EOLIAN static Eina_Bool
732_efl_ui_list_efl_pack_unpack_all(Eo *obj, Efl_Ui_List_Data *pd)
733{
734 Eina_Bool ret = efl_pack_unpack_all(pd->box);
735
736 if (ret)
737 {
738 Efl_Ui_List_Item *it = NULL;
739 EINA_LIST_FREE(pd->items, it)
740 {
741 _list_item_clear(obj, pd, it);
742 }
743 eina_list_free(pd->selected);
744 pd->items = NULL;
745 pd->selected = NULL;
746 }
747
748 elm_layout_sizing_eval(obj);
749 return ret;
750}
751
752EOLIAN static Eina_Bool
753_efl_ui_list_efl_pack_unpack(Eo *obj, Efl_Ui_List_Data *pd, Efl_Gfx_Entity *subobj)
754{
755 Eina_Bool ret = efl_pack_unpack(pd->box, subobj);
756 Efl_Ui_List_Item *item = (Efl_Ui_List_Item *)subobj;
757
758 if (ret)
759 {
760 pd->items = eina_list_remove(pd->items, item);
761 if (efl_ui_item_selected_get(item))
762 {
763 pd->selected = eina_list_remove(pd->selected, item);
764 }
765 _list_item_clear(obj, pd, item);
766 }
767
768 elm_layout_sizing_eval(obj);
769 return ret;
770}
771
772EOLIAN static Eina_Bool
773_efl_ui_list_efl_pack_pack(Eo *obj, Efl_Ui_List_Data *pd, Efl_Gfx_Entity *subobj)
774{
775 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
776
777 Eina_Bool ret = efl_pack_end(pd->box, subobj);
778 pd->items = eina_list_append(pd->items, subobj);
779 return ret;
780}
781
782EOLIAN static Eina_Bool
783_efl_ui_list_efl_pack_linear_pack_end(Eo *obj, Efl_Ui_List_Data *pd, Efl_Gfx_Entity *subobj)
784{
785 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
786
787 Eina_Bool ret = efl_pack_end(pd->box, subobj);
788 pd->items = eina_list_append(pd->items, subobj);
789 return ret;
790}
791
792EOLIAN static Eina_Bool
793_efl_ui_list_efl_pack_linear_pack_begin(Eo *obj, Efl_Ui_List_Data *pd, Efl_Gfx_Entity *subobj)
794{
795 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
796
797 Eina_Bool ret = efl_pack_begin(pd->box, subobj);
798 pd->items = eina_list_prepend(pd->items, subobj);
799 return ret;
800}
801
802EOLIAN static Eina_Bool
803_efl_ui_list_efl_pack_linear_pack_before(Eo *obj,
804 Efl_Ui_List_Data *pd,
805 Efl_Gfx_Entity *subobj,
806 const Efl_Gfx_Entity *existing)
807{
808 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
809 EFL_UI_LIST_ITEM_CHECK_OR_RETURN(existing, EINA_FALSE);
810
811 Eina_Bool ret = efl_pack_before(pd->box, subobj, existing);
812 pd->items = eina_list_prepend_relative(pd->items, subobj, existing);
813 return ret;
814}
815
816EOLIAN static Eina_Bool
817_efl_ui_list_efl_pack_linear_pack_after(Eo *obj,
818 Efl_Ui_List_Data *pd,
819 Efl_Gfx_Entity *subobj,
820 const Efl_Gfx_Entity *existing)
821{
822 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
823 EFL_UI_LIST_ITEM_CHECK_OR_RETURN(existing, EINA_FALSE);
824
825 Eina_Bool ret = efl_pack_after(pd->box, subobj, existing);
826 pd->items = eina_list_append_relative(pd->items, subobj, existing);
827 return ret;
828}
829
830EOLIAN static Eina_Bool
831_efl_ui_list_efl_pack_linear_pack_at(Eo *obj,
832 Efl_Ui_List_Data *pd,
833 Efl_Gfx_Entity *subobj,
834 int index)
835{
836 if (!_list_item_process(obj, pd, subobj)) return EINA_FALSE;
837 Efl_Ui_List_Item *existing = efl_pack_content_get(pd->box, index);
838
839 Eina_Bool ret = efl_pack_at(pd->box, subobj, index);
840 pd->items = eina_list_append_relative(pd->items, subobj, existing);
841 return ret;
842}
843
844EOLIAN static Efl_Gfx_Entity *
845_efl_ui_list_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, int index)
846{
847 return efl_pack_content_get(pd->box, index);
848}
849
850EOLIAN static Efl_Gfx_Entity *
851_efl_ui_list_efl_pack_linear_pack_unpack_at(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, int index)
852{
853 return efl_pack_unpack_at(pd->box, index);
854}
855
856EOLIAN static int
857_efl_ui_list_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
858 Efl_Ui_List_Data *pd,
859 const Efl_Gfx_Entity *subobj)
860{
861 return efl_pack_index_get(pd->box, subobj);
862}
863
864EOLIAN static void
865_efl_ui_list_efl_pack_layout_layout_update(Eo *obj, Efl_Ui_List_Data *pd)
866{
867 efl_pack_layout_update(pd->box);
868 elm_layout_sizing_eval(obj);
869
870 efl_event_callback_legacy_call(obj, EFL_PACK_EVENT_LAYOUT_UPDATED, NULL);
871}
872
873EOLIAN static void
874_efl_ui_list_efl_pack_layout_layout_request(Eo *obj, Efl_Ui_List_Data *pd)
875{
876 efl_pack_layout_request(pd->box);
877 elm_layout_sizing_eval(obj);
878}
879
880EOLIAN static void
881_efl_ui_list_efl_pack_pack_padding_set(Eo *obj EINA_UNUSED,
882 Efl_Ui_List_Data *pd,
883 double h,
884 double v,
885 Eina_Bool scalable)
886{
887 efl_pack_padding_set(pd->box, h, v, scalable);
888}
889
890EOLIAN static void
891_efl_ui_list_efl_pack_pack_padding_get(const Eo *obj EINA_UNUSED,
892 Efl_Ui_List_Data *pd,
893 double *h,
894 double *v,
895 Eina_Bool *scalable)
896{
897 efl_pack_padding_get(pd->box, h, v, scalable);
898}
899
900/* FIXME: align could not work properly on the list
901 EOLIAN static void
902 _efl_ui_list_efl_pack_pack_align_set(Eo *obj, Efl_Ui_List_Data *pd, double h, double v)
903 {
904 efl_pack_align_set(pd->box, h, v);
905 }
906
907 EOLIAN static void
908 _efl_ui_list_efl_pack_pack_align_get(Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd, double *h, double *v)
909 {
910 efl_pack_align_get(pd->box, &h, &v);
911 }
912 */
913
914/* Scroll APIs */
915EOLIAN static Eina_Size2D
916_efl_ui_list_efl_ui_scrollable_interactive_content_size_get(const Eo *obj EINA_UNUSED,
917 Efl_Ui_List_Data *pd)
918{
919 return efl_ui_scrollable_content_size_get(pd->smanager);
920}
921
922EOLIAN static Eina_Rect
923_efl_ui_list_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo *obj EINA_UNUSED,
924 Efl_Ui_List_Data *pd)
925{
926 return efl_ui_scrollable_viewport_geometry_get(pd->smanager);
927}
928
929EOLIAN static void
930_efl_ui_list_efl_ui_scrollable_interactive_bounce_enabled_set(Eo *obj EINA_UNUSED,
931 Efl_Ui_List_Data *pd,
932 Eina_Bool horiz,
933 Eina_Bool vert)
934{
935 efl_ui_scrollable_bounce_enabled_set(pd->smanager, horiz, vert);
936}
937
938EOLIAN static void
939_efl_ui_list_efl_ui_scrollable_interactive_bounce_enabled_get(const Eo *obj EINA_UNUSED,
940 Efl_Ui_List_Data *pd,
941 Eina_Bool *horiz,
942 Eina_Bool *vert)
943{
944 efl_ui_scrollable_bounce_enabled_get(pd->smanager, horiz, vert);
945}
946
947EOLIAN static Eina_Bool
948_efl_ui_list_efl_ui_scrollable_interactive_scroll_hold_get(const Eo *obj EINA_UNUSED,
949 Efl_Ui_List_Data *pd)
950{
951 return efl_ui_scrollable_scroll_hold_get(pd->smanager);
952}
953
954EOLIAN static void
955_efl_ui_list_efl_ui_scrollable_interactive_scroll_hold_set(Eo *obj EINA_UNUSED,
956 Efl_Ui_List_Data *pd,
957 Eina_Bool hold)
958{
959 efl_ui_scrollable_scroll_hold_set(pd->smanager, hold);
960}
961
962EOLIAN static Eina_Bool
963_efl_ui_list_efl_ui_scrollable_interactive_scroll_freeze_get(const Eo *obj EINA_UNUSED,
964 Efl_Ui_List_Data *pd)
965{
966 return efl_ui_scrollable_scroll_freeze_get(pd->smanager);
967}
968
969EOLIAN static void
970_efl_ui_list_efl_ui_scrollable_interactive_scroll_freeze_set(Eo *obj EINA_UNUSED,
971 Efl_Ui_List_Data *pd,
972 Eina_Bool freeze)
973{
974 efl_ui_scrollable_scroll_freeze_set(pd->smanager, freeze);
975}
976
977EOLIAN static void
978_efl_ui_list_efl_ui_scrollable_interactive_match_content_set(Eo *obj EINA_UNUSED,
979 Efl_Ui_List_Data *pd,
980 Eina_Bool match_content_w,
981 Eina_Bool match_content_h)
982{
983 pd->match_content_w = !!match_content_w;
984 pd->match_content_h = !!match_content_h;
985
986 efl_ui_scrollable_match_content_set(pd->smanager, match_content_w, match_content_h);
987
988 elm_layout_sizing_eval(obj);
989}
990
991EOLIAN static void
992_efl_ui_list_efl_ui_scrollbar_bar_mode_set(Eo *obj EINA_UNUSED,
993 Efl_Ui_List_Data *pd,
994 Efl_Ui_Scrollbar_Mode hmode,
995 Efl_Ui_Scrollbar_Mode vmode)
996{
997 efl_ui_scrollbar_bar_mode_set(pd->smanager, hmode, vmode);
998}
999
1000EOLIAN static void
1001_efl_ui_list_efl_ui_scrollbar_bar_mode_get(const Eo *obj EINA_UNUSED,
1002 Efl_Ui_List_Data *pd,
1003 Efl_Ui_Scrollbar_Mode *hmode,
1004 Efl_Ui_Scrollbar_Mode *vmode)
1005{
1006 efl_ui_scrollbar_bar_mode_get(pd->smanager, hmode, vmode);
1007}
1008
1009EOLIAN static void
1010_efl_ui_list_efl_ui_scrollable_interactive_scroll(Eo *obj EINA_UNUSED,
1011 Efl_Ui_List_Data *pd,
1012 Eina_Rect rc,
1013 Eina_Bool animation)
1014{
1015 efl_ui_scrollable_scroll(pd->smanager, rc, animation);
1016}
1017
1018EOLIAN static void
1019_efl_ui_list_efl_ui_multi_selectable_select_mode_set(Eo *obj EINA_UNUSED,
1020 Efl_Ui_List_Data *pd,
1021 Efl_Ui_Select_Mode mode)
1022{
1023 Efl_Ui_List_Item *selected;
1024
1025 if ((pd->select_mode == EFL_UI_SELECT_MULTI &&
1026 mode != EFL_UI_SELECT_MULTI) ||
1027 mode == EFL_UI_SELECT_NONE)
1028 {
1029 Eina_List *clone = eina_list_clone(pd->selected);
1030 EINA_LIST_FREE(clone, selected)
1031 efl_ui_item_selected_set(selected, EINA_FALSE);
1032 }
1033
1034 pd->select_mode = mode;
1035}
1036
1037EOLIAN static Efl_Ui_Select_Mode
1038_efl_ui_list_efl_ui_multi_selectable_select_mode_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
1039{
1040 return pd->select_mode;
1041}
1042
1043/* List APIs */
1044EOLIAN static void
1045_efl_ui_list_item_scroll(Eo *obj,
1046 Efl_Ui_List_Data *pd,
1047 Efl_Ui_List_Item *item,
1048 Eina_Bool animation)
1049{
1050 // Need to be implemented here.
1051 if (pd->pan_resized)
1052 {
1053 _item_scroll_internal(obj, item, -1.0, animation);
1054 }
1055 else
1056 {
1057 pd->scroll.item = item;
1058 pd->scroll.align = -1.0;
1059 pd->scroll.anim = animation;
1060 }
1061}
1062
1063EOLIAN static void
1064_efl_ui_list_item_scroll_align(Eo *obj,
1065 Efl_Ui_List_Data *pd,
1066 Efl_Ui_List_Item *item,
1067 double align,
1068 Eina_Bool animation)
1069{
1070 // Need to be implemented here.
1071 if (pd->pan_resized)
1072 {
1073 _item_scroll_internal(obj, item, align, animation);
1074 }
1075 else
1076 {
1077 pd->scroll.item = item;
1078 pd->scroll.align = align;
1079 pd->scroll.anim = animation;
1080 }
1081}
1082
1083EOLIAN static Efl_Ui_List_Item *
1084_efl_ui_list_last_selected_item_get(const Eo *obj EINA_UNUSED, Efl_Ui_List_Data *pd)
1085{
1086 return pd->last_selected;
1087}
1088
1089static Eina_Bool
1090_list_item_iterator_next(Item_Iterator *it, void **data)
1091{
1092 Efl_Ui_List_Item *item;
1093
1094 if (!eina_iterator_next(it->real_iterator, (void **)&item))
1095 return EINA_FALSE;
1096
1097 if (data) *data = item;
1098 return EINA_TRUE;
1099}
1100
1101static Eo *
1102_list_item_iterator_get_container(Item_Iterator *it)
1103{
1104 return it->object;
1105}
1106
1107static void
1108_list_item_iterator_free(Item_Iterator *it)
1109{
1110 eina_iterator_free(it->real_iterator);
1111 eina_list_free(it->list);
1112 free(it);
1113}
1114
1115EOLIAN static Eina_Iterator *
1116_efl_ui_list_selected_items_get(Eo *obj, Efl_Ui_List_Data *pd)
1117{
1118 Item_Iterator *item;
1119
1120 item = calloc(1, sizeof(*item));
1121 if (!item) return NULL;
1122
1123 EINA_MAGIC_SET(&item->iterator, EINA_MAGIC_ITERATOR);
1124
1125 item->list = eina_list_clone(pd->selected);
1126 item->real_iterator = eina_list_iterator_new(item->list);
1127 item->iterator.version = EINA_ITERATOR_VERSION;
1128 item->iterator.next = FUNC_ITERATOR_NEXT(_list_item_iterator_next);
1129 item->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_list_item_iterator_get_container);
1130 item->iterator.free = FUNC_ITERATOR_FREE(_list_item_iterator_free);
1131 item->object = obj;
1132
1133 return &item->iterator;
1134}
1135
1136/* Internal EO APIs and hidden overrides */
1137#define EFL_UI_LIST_EXTRA_OPS \
1138 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_list)
1139
1140#include "efl_ui_list.eo.c"
diff --git a/src/lib/elementary/efl_ui_list.eo b/src/lib/elementary/efl_ui_list.eo
new file mode 100644
index 0000000..b97e5b5
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list.eo
@@ -0,0 +1,93 @@
1import efl_ui_list_item;
2
3class Efl.Ui.List (Efl.Ui.Layout.Object,
4 Efl.Ui.Scrollable_Interactive,
5 Efl.Ui.Scrollbar,
6 Efl.Pack_Linear, Efl.Pack_Layout,
7 Efl.Ui.Clickable,
8 Efl.Ui.Selectable,
9 Efl.Ui.Multi_Selectable)
10{
11 [[Simple list widget with Pack interface.]]
12 methods {
13 item_scroll {
14 [[scroll move the item to show in the viewport.]]
15 params {
16 @in item: Efl.Ui.List_Item; [[Target item.]]
17 @in animation: bool; [[Boolean value for animation of scroll move.]]
18 }
19 }
20 item_scroll_align {
21 [[scroll move the item to show at the align position of the viewport.]]
22 params {
23 @in item: Efl.Ui.List_Item; [[Target item.]]
24 @in align: double; [[align value in Viewport.]]
25 @in animation: bool; [[Boolean value for animation of scroll move.]]
26 }
27 }
28 @property last_selected_item {
29 [[Property data of last selected item.]]
30 get {}
31 values {
32 return: Efl.Ui.List_Item; [[last selected item of list.]]
33 }
34 }
35 selected_items_get {
36 [[Get the selected items iterator. The iterator sequence will be decided by selection.]]
37 return: iterator<Efl.Ui.List_Item> @owned @warn_unused; [[Iterator covered by selected items list.
38 user have to free the iterator after used.]]
39 }
40 }
41 implements {
42 //Efl.Object
43 Efl.Object.constructor;
44 Efl.Object.finalize;
45 Efl.Object.destructor;
46
47 //Efl.Canvas
48 Efl.Canvas.Group.group_calculate;
49
50 //Efl.Container
51 Efl.Container.content_iterate;
52 Efl.Container.content_count;
53
54 //Efl.Ui.Direction.direction { get; set; } //TODO
55
56 //Efl.Ui.Widget
57 Efl.Ui.Widget.theme_apply;
58
59 //Efl.Ui.Focus
60 //Efl.Ui.Focus.Object.on_focus_update;
61
62 //Efl.Pack
63 Efl.Pack.pack_clear;
64 Efl.Pack.unpack_all;
65 Efl.Pack.unpack;
66 Efl.Pack.pack;
67 Efl.Pack_Linear.pack_begin;
68 Efl.Pack_Linear.pack_end;
69 Efl.Pack_Linear.pack_before;
70 Efl.Pack_Linear.pack_after;
71 Efl.Pack_Linear.pack_at;
72 Efl.Pack_Linear.pack_content_get;
73 Efl.Pack_Linear.pack_unpack_at;
74 Efl.Pack_Linear.pack_index_get;
75 Efl.Pack_Layout.layout_update;
76 Efl.Pack_Layout.layout_request;
77 Efl.Pack.pack_padding { get; set; }
78 //Efl.Pack.pack_align { get; set; }
79
80 //Efl.Ui.Scrollable
81 Efl.Ui.Scrollable_Interactive.scroll;
82 Efl.Ui.Scrollable_Interactive.content_size{ get; }
83 Efl.Ui.Scrollable_Interactive.viewport_geometry{ get; }
84 Efl.Ui.Scrollable_Interactive.bounce_enabled { set; get; }
85 Efl.Ui.Scrollable_Interactive.scroll_freeze { get; set; }
86 Efl.Ui.Scrollable_Interactive.scroll_hold { get; set; }
87 Efl.Ui.Scrollable_Interactive.match_content { set; }
88 Efl.Ui.Scrollbar.bar_mode { get; set; }
89
90 //Efl.Ui.Multi_Selectable
91 Efl.Ui.Multi_Selectable.select_mode {get; set;}
92 }
93}
diff --git a/src/lib/elementary/efl_ui_list_default_item.c b/src/lib/elementary/efl_ui_list_default_item.c
new file mode 100644
index 0000000..25e9fda
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_default_item.c
@@ -0,0 +1,111 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_UI_LIST_DEFAULT_ITEM_PROTECTED
6
7#include <Elementary.h>
8
9#include "elm_priv.h"
10#include "efl_ui_list_default_item_part_icon.eo.h"
11#include "efl_ui_list_default_item_part_end.eo.h"
12#include "elm_part_helper.h"
13
14#define MY_CLASS EFL_UI_LIST_DEFAULT_ITEM_CLASS
15#define MY_CLASS_PFX efl_ui_list_default_item
16
17#define MY_CLASS_NAME "Efl.Ui.List_Default_Item"
18
19EOLIAN static Efl_Object *
20_efl_ui_list_default_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED)
21{
22 Eo *eo;
23 eo = efl_finalize(efl_super(obj, MY_CLASS));
24 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
25 Efl_Ui_Theme_Apply theme_apply = efl_ui_layout_object_theme_set(obj, "list_item", NULL, NULL);
26
27 if (theme_apply == EFL_UI_THEME_APPLY_FAILED)
28 CRI("Default Item(%p) failed to set theme [efl/list_item]!", eo);
29 return eo;
30}
31
32EOLIAN static void
33_efl_ui_list_default_item_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
34{
35 efl_destructor(efl_super(obj, MY_CLASS));
36}
37
38/* Efl.Part */
39
40ELM_PART_TEXT_DEFAULT_GET(efl_ui_list_default_item, "efl.text")
41ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void)
42ELM_PART_MARKUP_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void)
43ELM_PART_CONTENT_DEFAULT_GET(efl_ui_list_default_item, "efl.icon")
44ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_list_default_item, void
45)
46
47Eina_Bool
48_efl_ui_list_default_item_part_icon_efl_content_content_set(Eo *obj, void *pd EINA_UNUSED, Efl_Gfx_Entity *content)
49{
50 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
51 return efl_content_set(efl_part(efl_super(wd->obj, MY_CLASS), wd->part), content);
52}
53
54Efl_Gfx_Entity *
55_efl_ui_list_default_item_part_icon_efl_content_content_get(const Eo *obj, void *pd EINA_UNUSED)
56{
57 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
58 return efl_content_get(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
59}
60
61Efl_Gfx_Entity *
62_efl_ui_list_default_item_part_icon_efl_content_content_unset(Eo *obj, void *pd EINA_UNUSED)
63{
64 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
65 return efl_content_unset(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
66}
67#include "efl_ui_list_default_item_part_icon.eo.c"
68
69Eina_Bool
70_efl_ui_list_default_item_part_end_efl_content_content_set(Eo *obj, void *pd EINA_UNUSED, Efl_Gfx_Entity *content)
71{
72 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
73 return efl_content_set(efl_part(efl_super(wd->obj, MY_CLASS), wd->part), content);
74}
75
76Efl_Gfx_Entity *
77_efl_ui_list_default_item_part_end_efl_content_content_get(const Eo *obj, void *pd EINA_UNUSED)
78{
79 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
80 return efl_content_get(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
81}
82
83Efl_Gfx_Entity *
84_efl_ui_list_default_item_part_end_efl_content_content_unset(Eo *obj, void *pd EINA_UNUSED)
85{
86 Elm_Part_Data *wd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
87 return efl_content_unset(efl_part(efl_super(wd->obj, MY_CLASS), wd->part));
88}
89#include "efl_ui_list_default_item_part_end.eo.c"
90
91EOLIAN static Efl_Object *
92_efl_ui_list_default_item_efl_part_part(const Eo *obj, void *wd EINA_UNUSED, const char *part)
93{
94 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
95 if (eina_streq(part, "text"))
96 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_TEXT_CLASS, obj, "efl.text");
97 else if (eina_streq(part, "icon"))
98 return ELM_PART_IMPLEMENT(EFL_UI_LIST_DEFAULT_ITEM_PART_ICON_CLASS, obj, "efl.icon");
99 else if (eina_streq(part, "end"))
100 return ELM_PART_IMPLEMENT(EFL_UI_LIST_DEFAULT_ITEM_PART_END_CLASS, obj, "efl.end");
101
102 return efl_part(efl_super(obj, MY_CLASS), part);
103}
104/* Efl.Part end */
105
106/* Internal EO APIs and hidden overrides */
107#define EFL_UI_LIST_DEFAULT_ITEM_EXTRA_OPS \
108 ELM_PART_TEXT_DEFAULT_OPS(efl_ui_list_default_item), \
109 ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_list_default_item)
110
111#include "efl_ui_list_default_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_default_item.eo b/src/lib/elementary/efl_ui_list_default_item.eo
new file mode 100644
index 0000000..0fcb0b6
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_default_item.eo
@@ -0,0 +1,24 @@
1
2class Efl.Ui.List_Default_Item (Efl.Ui.List_Item,
3 Efl.Text,
4 Efl.Text_Markup,
5 Efl.Ui.Translatable,
6 Efl.Content)
7{
8 [[List Default Item class.
9 This class need to be sub object of list widget.
10 text and contents can be appliable by efl_text,
11 efl_content or efl_part APIs.]]
12 data: null;
13 implements {
14 //Efl.Object
15 Efl.Object.finalize;
16 Efl.Object.destructor;
17 Efl.Text.text { get; set; }
18 Efl.Text_Markup.markup { get; set; }
19 Efl.Ui.Translatable.translatable_text { get; set; }
20 Efl.Content.content { get; set; }
21 Efl.Content.content_unset;
22 Efl.Part.part;
23 }
24}
diff --git a/src/lib/elementary/efl_ui_list_default_item_part_end.eo b/src/lib/elementary/efl_ui_list_default_item_part_end.eo
new file mode 100644
index 0000000..7388c9f
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_default_item_part_end.eo
@@ -0,0 +1,9 @@
1class Efl.Ui.List_Default_Item_Part_End (Efl.Ui.Layout.Part, Efl.Content)
2{
3 [[List Default Item internal content of end part class]]
4 data: null;
5 implements {
6 Efl.Content.content { get; set; }
7 Efl.Content.content_unset;
8 }
9} \ No newline at end of file
diff --git a/src/lib/elementary/efl_ui_list_default_item_part_icon.eo b/src/lib/elementary/efl_ui_list_default_item_part_icon.eo
new file mode 100644
index 0000000..faed96d
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_default_item_part_icon.eo
@@ -0,0 +1,9 @@
1class Efl.Ui.List_Default_Item_Part_Icon (Efl.Ui.Layout.Part, Efl.Content)
2{
3 [[List Default Item internal content of icon part class]]
4 data: null;
5 implements {
6 Efl.Content.content { get; set; }
7 Efl.Content.content_unset;
8 }
9} \ No newline at end of file
diff --git a/src/lib/elementary/efl_ui_list_empty_item.c b/src/lib/elementary/efl_ui_list_empty_item.c
new file mode 100644
index 0000000..b78707a
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_empty_item.c
@@ -0,0 +1,56 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_UI_LIST_EMPTY_ITEM_PROTECTED
6
7#include <Elementary.h>
8
9#include "elm_priv.h"
10#include "elm_part_helper.h"
11
12#define MY_CLASS EFL_UI_LIST_EMPTY_ITEM_CLASS
13#define MY_CLASS_PFX efl_ui_list_empty_item
14
15#define MY_CLASS_NAME "Efl.Ui.List_Empty_Item"
16
17EOLIAN static Efl_Object *
18_efl_ui_list_empty_item_efl_object_finalize(Eo *obj, void *pd EINA_UNUSED)
19{
20 Eo *eo;
21 eo = efl_finalize(efl_super(obj, MY_CLASS));
22 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
23 Efl_Ui_Theme_Apply theme_apply = efl_ui_layout_object_theme_set(obj, "list_item", NULL, "empty");
24
25 if (theme_apply == EFL_UI_THEME_APPLY_FAILED)
26 CRI("Empty Item(%p) failed to set theme [efl/list_item:empty]!", eo);
27 return eo;
28}
29
30EOLIAN static void
31_efl_ui_list_empty_item_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED)
32{
33 efl_destructor(efl_super(obj, MY_CLASS));
34}
35
36/* Efl.Part */
37ELM_PART_CONTENT_DEFAULT_GET(efl_ui_list_empty_item, "efl.content")
38ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_list_empty_item, void)
39/* Efl.Part end */
40
41EOLIAN static Efl_Object *
42_efl_ui_list_empty_item_efl_part_part(const Eo *obj, void *wd EINA_UNUSED, const char *part)
43{
44 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
45 if (eina_streq(part, "content"))
46 return ELM_PART_IMPLEMENT(EFL_UI_LAYOUT_PART_CONTENT_CLASS, obj, "efl.content");
47
48 return efl_part(efl_super(obj, MY_CLASS), part);
49}
50
51/* Internal EO APIs and hidden overrides */
52
53#define EFL_UI_LIST_EMPTY_ITEM_EXTRA_OPS \
54 ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_list_empty_item)
55
56#include "efl_ui_list_empty_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_empty_item.eo b/src/lib/elementary/efl_ui_list_empty_item.eo
new file mode 100644
index 0000000..a139ef3
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_empty_item.eo
@@ -0,0 +1,16 @@
1
2class Efl.Ui.List_Empty_Item (Efl.Ui.List_Item, Efl.Content)
3{
4 [[List Empty Item class. This item have only one swallow space,
5 thus user can decorate item by filling the swallow with
6 any kind of container.]]
7 data: null;
8 implements {
9 //Efl.Object
10 Efl.Object.finalize;
11 Efl.Object.destructor;
12 Efl.Content.content { get; set; }
13 Efl.Content.content_unset;
14 Efl.Part.part;
15 }
16}
diff --git a/src/lib/elementary/efl_ui_list_item.c b/src/lib/elementary/efl_ui_list_item.c
new file mode 100644
index 0000000..1fe67e9
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_item.c
@@ -0,0 +1,83 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define EFL_ACCESS_PROTECTED
6#define EFL_UI_WIDGET_PART_BG_PROTECTED
7
8#include <Elementary.h>
9
10#include "elm_priv.h"
11#include "efl_ui_list_item_private.h"
12
13#define MY_CLASS EFL_UI_LIST_ITEM_CLASS
14#define MY_CLASS_PFX efl_ui_list_item
15
16#define MY_CLASS_NAME "Efl.Ui.List_Item"
17
18static void
19_sizing_eval(Evas_Object *obj, Efl_Ui_List_Item_Data *pd)
20{
21 Evas_Coord minh = -1, minw = -1;
22 Evas_Coord rest_w = 0, rest_h = 0;
23 ELM_WIDGET_DATA_GET_OR_RETURN(pd->obj, wd);
24
25 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh,
26 rest_w, rest_h);
27 evas_object_size_hint_min_set(obj, minw, minh);
28
29 pd->needs_size_calc = EINA_FALSE;
30}
31
32static void
33_efl_ui_list_item_elm_layout_sizing_eval(Eo *obj, Efl_Ui_List_Item_Data *pd)
34{
35 if (pd->needs_size_calc) return;
36 pd->needs_size_calc = EINA_TRUE;
37
38 efl_canvas_group_change(obj);
39}
40
41EOLIAN static void
42_efl_ui_list_item_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_List_Item_Data *pd)
43{
44 if (pd->needs_size_calc)
45 {
46 _sizing_eval(obj, pd);
47 pd->needs_size_calc = EINA_FALSE;
48 }
49}
50
51EOLIAN static Eo *
52_efl_ui_list_item_efl_object_constructor(Eo *obj, Efl_Ui_List_Item_Data *pd)
53{
54 pd->obj = obj;
55 obj = efl_constructor(efl_super(obj, MY_CLASS));
56
57 return obj;
58}
59
60EOLIAN static Efl_Object *
61_efl_ui_list_item_efl_object_finalize(Eo *obj, Efl_Ui_List_Item_Data *pd EINA_UNUSED)
62{
63 Eo *eo;
64 eo = efl_finalize(efl_super(obj, MY_CLASS));
65 ELM_WIDGET_DATA_GET_OR_RETURN(eo, wd, eo);
66
67 return eo;
68}
69
70EOLIAN static void
71_efl_ui_list_item_efl_object_destructor(Eo *obj, Efl_Ui_List_Item_Data *pd EINA_UNUSED)
72{
73 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
74
75 efl_destructor(efl_super(obj, MY_CLASS));
76}
77
78/* Internal EO APIs and hidden overrides */
79
80#define EFL_UI_LIST_ITEM_EXTRA_OPS \
81 ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_list_item)
82
83#include "efl_ui_list_item.eo.c"
diff --git a/src/lib/elementary/efl_ui_list_item.eo b/src/lib/elementary/efl_ui_list_item.eo
new file mode 100644
index 0000000..82943ad
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_item.eo
@@ -0,0 +1,12 @@
1
2abstract Efl.Ui.List_Item (Efl.Ui.Item)
3{
4 implements {
5 //Efl.Object
6 Efl.Object.constructor;
7 Efl.Object.finalize;
8 Efl.Object.destructor;
9 //Efl.Canvas
10 Efl.Canvas.Group.group_calculate;
11 }
12}
diff --git a/src/lib/elementary/efl_ui_list_item_private.h b/src/lib/elementary/efl_ui_list_item_private.h
new file mode 100644
index 0000000..e68b3fa
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_item_private.h
@@ -0,0 +1,31 @@
1#ifndef EFL_UI_LIST_ITEM_PRIVATE_H
2#define EFL_UI_LIST_ITEM_PRIVATE_H
3
4#include "Elementary.h"
5
6typedef struct _Efl_Ui_List_Item_Data
7{
8 // Eo Objects
9 Eo *obj; /* Self-Object */
10 Eo *parent; /* Parent Widget */
11 Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */
12} Efl_Ui_List_Item_Data;
13
14
15#define EFL_UI_LIST_ITEM_DATA_GET(o, pd) \
16 Efl_Ui_List_Item_Data * pd = efl_data_scope_safe_get(o, EFL_UI_LIST_ITEM_CLASS)
17
18#define EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(o, ptr, ...) \
19 EFL_UI_LIST_ITEM_DATA_GET(o, ptr); \
20 if (EINA_UNLIKELY(!ptr)) \
21 { \
22 ERR("No widget data for object %p (%s)", \
23 o, evas_object_type_get(o)); \
24 return __VA_ARGS__; \
25 }
26
27#define EFL_UI_LIST_ITEM_CHECK_OR_RETURN(obj, ...) \
28 if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_LIST_ITEM_CLASS))) \
29 return __VA_ARGS__;
30
31#endif
diff --git a/src/lib/elementary/efl_ui_list_private.h b/src/lib/elementary/efl_ui_list_private.h
new file mode 100644
index 0000000..409956d
--- /dev/null
+++ b/src/lib/elementary/efl_ui_list_private.h
@@ -0,0 +1,63 @@
1#ifndef EFL_UI_LIST_PRIVATE_H
2#define EFL_UI_LIST_PRIVATE_H
3
4#include "Elementary.h"
5
6typedef struct _Efl_Ui_List_Data
7{
8 // Eo Objects
9 Eo *box; /* Internal box for Efl.Pack support */
10 Eo *pan; /* Internal pan for scroll */
11 Eo *smanager; /* Scroll Manager for support scroll with pan */
12
13 struct {
14 Efl_Ui_List_Item *item; /* Scroll target item */
15 double align; /* Item scroll aligned position.
16 -1 is for default case of scroll in */
17 Eina_Bool anim : 1; /* boolean data for animation on scroll */
18 } scroll; /* Item scroll values for deferred operation */
19
20 Eina_List *items; /* All item list for internal maintaining */
21 Eina_List *selected; /* Selected items list */
22 Efl_Ui_List_Item *last_selected; /* latest selected item */
23
24 Efl_Ui_Select_Mode select_mode; /* Select mode for items
25 with single or multiple seleciton */
26
27 // Boolean Data
28 Eina_Bool freeze_want : 1; /* Flag for Scroll freezing */
29 Eina_Bool match_content_w: 1; /* Flag for size matching on content width.
30 it will disable horizontal scroll */
31 Eina_Bool match_content_h: 1; /* Flag for size matching on content height.
32 it will disable vertical scroll */
33 Eina_Bool pan_resized : 1; /* Flag for pan resized.
34 This value is used for checking scroll is
35 calculated after initialized */
36} Efl_Ui_List_Data;
37
38typedef struct _Item_Iterator
39{
40 Eina_Iterator iterator;
41 Eina_List *list;
42 Eina_Iterator *real_iterator;
43 Eo *object;
44} Item_Iterator;
45
46
47#define EFL_UI_LIST_DATA_GET(o, pd) \
48 Efl_Ui_List_Data * pd = efl_data_scope_safe_get(o, EFL_UI_LIST_CLASS)
49
50#define EFL_UI_LIST_DATA_GET_OR_RETURN(o, ptr, ...) \
51 EFL_UI_LIST_DATA_GET(o, ptr); \
52 if (EINA_UNLIKELY(!ptr)) \
53 { \
54 ERR("No widget data for object %p (%s)", \
55 o, evas_object_type_get(o)); \
56 return __VA_ARGS__; \
57 }
58
59#define EFL_UI_LIST_CHECK(obj) \
60 if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_LIST_CLASS))) \
61 return
62
63#endif