1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4 #define EO_BETA_API
5 #define EFL_UI_WIDGET_PROTECTED
6
7 #include <Efl_Ui.h>
8 #include <Elementary.h>
9
10 typedef enum _View_Type
11 {
12 LAYOUT,
13 LIST,
14 BUTTON
15 } View_Type;
16
17 typedef enum _Pack_Type
18 {
19 PACK_BEGIN,
20 PACK_END,
21 PACK_BEFORE,
22 PACK_AFTER,
23 PACK_AT,
24 UNPACK_AT,
25 CLEAR
26 } Pack_Type;
27
28 typedef struct _Params
29 {
30 Evas_Object *navi;
31 Eo *spotlight;
32 Eo *indicator;
33 int w, h;
34 Eina_Bool wfill, hfill;
35 } Params;
36
37 typedef struct _Page_Set_Params
38 {
39 Eo *spotlight;
40 Eo *spinner;
41 } Page_Set_Params;
42
43 typedef struct _Pack_Params
44 {
45 Pack_Type type;
46 Eo *spotlight;
47 Eo *pack_sp;
48 Eo *unpack_sp;
49 Eo *unpack_btn;
50 } Pack_Params;
51
52 typedef struct _Size_Params
53 {
54 Eo *spotlight;
55 Eo *slider;
56 Params *params;
57 } Size_Params;
58
59 #define PAGE_NUM 3
60
61 static void
page_clicked_cb(void * data EINA_UNUSED,const Efl_Event * ev EINA_UNUSED)62 page_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
63 {
64 printf("Button Page is clicked!\n");
65 }
66
67 static Eo *
view_add(View_Type p,Eo * parent)68 view_add(View_Type p, Eo *parent)
69 {
70 Eo *page;
71 char buf[PATH_MAX];
72 int i;
73
74 switch (p)
75 {
76 case LAYOUT:
77 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
78 elm_app_data_dir_get());
79 page = efl_add(EFL_UI_LAYOUT_CLASS, parent,
80 efl_file_set(efl_added, buf),
81 efl_file_key_set(efl_added, "page"),
82 efl_file_load(efl_added),
83 efl_text_set(efl_part(efl_added, "text"), "Layout Page"));
84 efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE);
85 break;
86
87 case LIST:
88 page = elm_list_add(parent);
89 elm_list_select_mode_set(page, ELM_OBJECT_SELECT_MODE_ALWAYS);
90 evas_object_show(page);
91 for (i = 0; i < 20; i++) {
92 snprintf(buf, sizeof(buf), "List Page - Item #%d", i);
93 elm_list_item_append(page, buf, NULL, NULL, NULL, NULL);
94 }
95 efl_gfx_hint_size_min_set(page, EINA_SIZE2D(200, 200));
96 evas_object_size_hint_weight_set(page, EVAS_HINT_EXPAND,
97 EVAS_HINT_EXPAND);
98 evas_object_size_hint_align_set(page, EVAS_HINT_FILL,
99 EVAS_HINT_FILL);
100 break;
101
102 case BUTTON:
103 page = efl_add(EFL_UI_BUTTON_CLASS, parent,
104 efl_text_set(efl_added, "Button Page"));
105 efl_event_callback_add(page, EFL_INPUT_EVENT_CLICKED, page_clicked_cb, NULL);
106 efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE);
107 break;
108
109 default:
110 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
111 elm_app_data_dir_get());
112 page = efl_add(EFL_UI_LAYOUT_CLASS, parent,
113 efl_file_set(efl_added, buf),
114 efl_file_key_set(efl_added, "page"),
115 efl_file_load(efl_added),
116 efl_text_set(efl_part(efl_added, "text"), "Layout Page"));
117 efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE);
118 break;
119 }
120
121 return page;
122 }
123
124 static void
prev_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)125 prev_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
126 {
127 Eo *spotlight = data;
128 int active_index = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
129
130 if (active_index - 1 > -1)
131 efl_ui_spotlight_active_element_set(spotlight, efl_pack_content_get(spotlight, active_index - 1));
132 }
133
134 static void
next_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)135 next_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
136 {
137 Eo *spotlight = data;
138 int active_index = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
139
140 if (active_index + 1 < efl_content_count(spotlight))
141 efl_ui_spotlight_active_element_set(spotlight, efl_pack_content_get(spotlight, active_index + 1));
142 }
143
144 static Eina_Value
future_then_cb(void * data EINA_UNUSED,const Eina_Value value,const Eina_Future * dead_future EINA_UNUSED)145 future_then_cb(void *data EINA_UNUSED, const Eina_Value value, const Eina_Future *dead_future EINA_UNUSED)
146 {
147 /* If efl_ui_spotlight_pop is called with EINA_FALSE, then the content is not
148 * deleted and the value contains the content. */
149 Eo *content = eina_value_object_get(&value);
150 if (content)
151 efl_gfx_entity_visible_set(content, EINA_FALSE);
152
153 return EINA_VALUE_EMPTY;
154 }
155
156 static void
pop_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)157 pop_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
158 {
159 Eo *spotlight = data;
160
161 if (efl_content_count(spotlight) == 0) return;
162
163 Eina_Future *future = efl_ui_spotlight_pop(spotlight, EINA_TRUE);
164 eina_future_then(future, future_then_cb, NULL);
165 }
166
167 static void
push_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)168 push_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
169 {
170 Eo *spotlight = data;
171 Eo *view;
172 int count = efl_content_count(spotlight);
173
174 switch (count % 3)
175 {
176 case 0:
177 view = view_add(BUTTON, spotlight);
178 break;
179
180 case 1:
181 view = view_add(LIST, spotlight);
182 break;
183
184 case 2:
185 view = view_add(LAYOUT, spotlight);
186 break;
187
188 default:
189 view = view_add(LAYOUT, spotlight);
190 break;
191 }
192 efl_ui_spotlight_push(spotlight, view);
193 }
194
195 static void
back_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)196 back_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
197 {
198 elm_naviframe_item_pop(data);
199 }
200
201 static void
list_del_cb(void * data,const Efl_Event * ev EINA_UNUSED)202 list_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
203 {
204 free(data);
205 }
206
207 static void
width_slider_cb(void * data,const Efl_Event * ev)208 width_slider_cb(void *data, const Efl_Event *ev)
209 {
210 Params *params = data;
211 int h;
212
213 if (params->hfill) h = -1;
214 else h = params->h;
215
216 params->w = efl_ui_range_value_get(ev->object);
217 efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(params->w, h));
218 }
219
220 static void
height_slider_cb(void * data,const Efl_Event * ev)221 height_slider_cb(void *data, const Efl_Event *ev)
222 {
223 Params *params = data;
224 int w;
225
226 if (params->wfill) w = -1;
227 else w = params->w;
228
229 params->h = efl_ui_range_value_get(ev->object);
230 efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, params->h));
231 }
232
233 static void
width_check_cb(void * data,Evas_Object * obj,void * event_info EINA_UNUSED)234 width_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
235 {
236 Size_Params *params = data;
237 Eina_Bool ck = elm_check_selected_get(obj);
238 int w, h;
239
240 elm_object_disabled_set(params->slider, ck);
241
242 params->params->wfill = ck;
243
244 if (params->params->wfill) w = -1;
245 else w = params->params->w;
246
247 if (params->params->hfill) h = -1;
248 else h = params->params->h;
249
250 efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
251 }
252
253 static void
height_check_cb(void * data,Evas_Object * obj,void * event_info EINA_UNUSED)254 height_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
255 {
256 Size_Params *params = data;
257 Eina_Bool ck = elm_check_selected_get(obj);
258 int w, h;
259
260 elm_object_disabled_set(params->slider, ck);
261
262 params->params->hfill = ck;
263
264 if (params->params->wfill) w = -1;
265 else w = params->params->w;
266
267 if (params->params->hfill) h = -1;
268 else h = params->params->h;
269
270 efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
271 }
272
273 static void
check_del_cb(void * data,const Efl_Event * ev EINA_UNUSED)274 check_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
275 {
276 free(data);
277 }
278
279 static void
pack_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)280 pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
281 {
282 Pack_Params *param = data;
283 Eo *spotlight = param->spotlight;
284 Eo *page = NULL;
285 int index, cnt;
286
287 if ((param->type != UNPACK_AT) && (param->type != CLEAR))
288 {
289 index = efl_content_count(spotlight);
290
291 switch (index % 3)
292 {
293 case 0:
294 page = view_add(LAYOUT, spotlight);
295 break;
296
297 case 1:
298 page = view_add(LIST, spotlight);
299 break;
300
301 case 2:
302 page = view_add(BUTTON, spotlight);
303 break;
304
305 default:
306 page = view_add(LAYOUT, spotlight);
307 break;
308 }
309 }
310
311 switch (param->type)
312 {
313 case PACK_BEGIN:
314 efl_pack_begin(spotlight, page);
315 break;
316
317 case PACK_END:
318 efl_pack_end(spotlight, page);
319 break;
320
321 case PACK_BEFORE:
322 efl_pack_before(spotlight, page, efl_ui_spotlight_active_element_get(spotlight));
323 break;
324
325 case PACK_AFTER:
326 efl_pack_after(spotlight, page, efl_ui_spotlight_active_element_get(spotlight));
327 break;
328
329 case PACK_AT:
330 index = efl_ui_range_value_get(param->pack_sp);
331 efl_pack_at(spotlight, page, index);
332 break;
333
334 case UNPACK_AT:
335 index = efl_ui_range_value_get(param->unpack_sp);
336 page = efl_pack_unpack_at(spotlight, index);
337 efl_del(page);
338 break;
339
340 case CLEAR:
341 efl_pack_clear(spotlight);
342 break;
343 }
344
345 cnt = efl_content_count(spotlight);
346
347 index = efl_ui_range_value_get(param->pack_sp);
348 if (index > cnt)
349 efl_ui_range_value_set(param->pack_sp, cnt);
350 if (cnt > 0)
351 efl_ui_range_limits_set(param->pack_sp, 0, cnt);
352
353 if (cnt > 0)
354 {
355 elm_object_disabled_set(param->unpack_btn, EINA_FALSE);
356 elm_object_disabled_set(param->unpack_sp, EINA_FALSE);
357
358 cnt -= 1;
359 index = efl_ui_range_value_get(param->unpack_sp);
360 if (index > cnt)
361 efl_ui_range_value_set(param->unpack_sp, cnt);
362 if (cnt > 0)
363 efl_ui_range_limits_set(param->unpack_sp, 0, cnt);
364 }
365 else
366 {
367 elm_object_disabled_set(param->unpack_btn, EINA_TRUE);
368 elm_object_disabled_set(param->unpack_sp, EINA_TRUE);
369 }
370 }
371
372 static void
pack_btn_del_cb(void * data,const Efl_Event * ev EINA_UNUSED)373 pack_btn_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
374 {
375 free(data);
376 }
377
378 static void
page_set_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)379 page_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
380 {
381 Page_Set_Params *psp = data;
382
383 efl_ui_spotlight_active_element_set(psp->spotlight,
384 efl_pack_content_get(psp->spotlight,
385 efl_ui_range_value_get(psp->spinner)));
386 }
387
388 static void
page_set_btn_del_cb(void * data,const Efl_Event * ev EINA_UNUSED)389 page_set_btn_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
390 {
391 free(data);
392 }
393
394 static void
indicator_icon_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)395 indicator_icon_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
396 {
397 Params *params = data;
398
399 params->indicator = efl_new(EFL_UI_SPOTLIGHT_ICON_INDICATOR_CLASS);
400 efl_ui_spotlight_indicator_set(params->spotlight, params->indicator);
401 }
402
403 static void
indicator_none_btn_cb(void * data,const Efl_Event * ev EINA_UNUSED)404 indicator_none_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
405 {
406 Params *params = data;
407 efl_ui_spotlight_indicator_set(params->spotlight, NULL);
408 }
409
410 static void
spotlight_size(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)411 spotlight_size(void *data,
412 Evas_Object *obj EINA_UNUSED,
413 void *event_info EINA_UNUSED)
414 {
415 Params *params = data;
416 Size_Params *size_params;
417 Evas_Object *navi = params->navi;
418 Eo *btn, *box, *fr, *inbox, *ck, *sl;
419
420 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
421 efl_text_set(efl_added, "Back"),
422 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
423 back_btn_cb, navi));
424
425 box = efl_add(EFL_UI_BOX_CLASS, navi,
426 elm_naviframe_item_push(navi, "View Size", btn, NULL,
427 efl_added, NULL));
428
429 // Width
430 fr = elm_frame_add(box);
431 elm_object_text_set(fr, "Width");
432 efl_gfx_hint_align_set(fr, -1, -1);
433 efl_gfx_hint_weight_set(fr, 1, 1);
434 efl_pack(box, fr);
435 efl_gfx_entity_visible_set(fr, 1);
436
437 inbox = efl_add(EFL_UI_BOX_CLASS, fr,
438 efl_content_set(fr, efl_added));
439
440 ck = elm_check_add(inbox);
441 elm_object_text_set(ck, "Fill");
442 efl_pack_end(inbox, ck);
443 efl_gfx_entity_visible_set(ck, 1);
444
445 sl = efl_add(EFL_UI_SLIDER_CLASS, inbox,
446 efl_ui_range_limits_set(efl_added, 100, 200),
447 efl_ui_range_value_set(efl_added, params->w),
448 efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 0)),
449 efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED,
450 width_slider_cb, params),
451 efl_pack_end(inbox, efl_added));
452
453 size_params = calloc(1, sizeof(Size_Params));
454 if (!size_params) return;
455
456 size_params->slider = sl;
457 size_params->spotlight = params->spotlight;
458 size_params->params = params;
459
460 evas_object_smart_callback_add(ck, "changed", width_check_cb, size_params);
461 efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
462
463 if (params->wfill)
464 {
465 elm_check_state_set(ck, EINA_TRUE);
466 elm_object_disabled_set(sl, EINA_TRUE);
467 }
468
469 // Height
470 fr = elm_frame_add(box);
471 elm_object_text_set(fr, "Height");
472 efl_gfx_hint_align_set(fr, -1, -1);
473 efl_gfx_hint_weight_set(fr, 1, 1);
474 efl_pack(box, fr);
475 efl_gfx_entity_visible_set(fr, 1);
476
477 inbox = efl_add(EFL_UI_BOX_CLASS, fr,
478 efl_content_set(fr, efl_added));
479
480 ck = elm_check_add(inbox);
481 elm_object_text_set(ck, "Fill");
482 efl_pack_end(inbox, ck);
483 efl_gfx_entity_visible_set(ck, 1);
484
485 sl = efl_add(EFL_UI_SLIDER_CLASS, inbox,
486 efl_ui_range_limits_set(efl_added, 100, 300),
487 efl_ui_range_value_set(efl_added, params->h),
488 efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(100, 0)),
489 efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED,
490 height_slider_cb, params),
491 efl_pack_end(inbox, efl_added));
492
493 size_params = calloc(1, sizeof(Size_Params));
494 if (!size_params) return;
495
496 size_params->slider = sl;
497 size_params->spotlight = params->spotlight;
498 size_params->params = params;
499
500 evas_object_smart_callback_add(ck, "changed", height_check_cb, size_params);
501 efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
502
503 if (params->hfill)
504 {
505 elm_check_state_set(ck, EINA_TRUE);
506 elm_object_disabled_set(sl, EINA_TRUE);
507 }
508 }
509
510 static void
_animation_cb(void * data,const Efl_Event * ev)511 _animation_cb(void *data, const Efl_Event *ev)
512 {
513 Params *params = data;
514
515 efl_ui_spotlight_manager_animated_transition_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_selectable_selected_get(ev->object));
516 }
517
518 static void
view_animation_cb(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)519 view_animation_cb(void *data,
520 Evas_Object *obj EINA_UNUSED,
521 void *event_info EINA_UNUSED)
522 {
523 Params *params = data;
524 Evas_Object *navi = params->navi;
525 Eo *btn, *box, *ck;
526
527 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
528 efl_text_set(efl_added, "Back"),
529 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
530 back_btn_cb, navi));
531
532 box = efl_add(EFL_UI_BOX_CLASS, navi,
533 elm_naviframe_item_push(navi, "View Manager animation", btn, NULL,
534 efl_added, NULL));
535
536 ck = efl_add(EFL_UI_CHECK_CLASS, box);
537 efl_event_callback_add(ck, EFL_UI_EVENT_SELECTED_CHANGED, _animation_cb, params);
538 efl_ui_selectable_selected_set(ck, efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(params->spotlight)));
539 efl_text_set(ck, "Animation");
540 efl_pack_end(box, ck);
541 efl_gfx_entity_visible_set(ck, 1);
542 }
543
544 static void
_scroll_block_check_cb(void * data,const Efl_Event * ev)545 _scroll_block_check_cb(void *data, const Efl_Event *ev)
546 {
547 Params *params = data;
548
549 efl_ui_spotlight_manager_scroll_block_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_selectable_selected_get(ev->object));
550 }
551
552 static void
scroll_block_cb(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)553 scroll_block_cb(void *data,
554 Evas_Object *obj EINA_UNUSED,
555 void *event_info EINA_UNUSED)
556 {
557 Params *params = data;
558 Evas_Object *navi = params->navi;
559 Eo *btn, *box, *ck;
560
561 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
562 efl_text_set(efl_added, "Back"),
563 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
564 back_btn_cb, navi));
565
566 box = efl_add(EFL_UI_BOX_CLASS, navi,
567 elm_naviframe_item_push(navi, "Scroll Block", btn, NULL,
568 efl_added, NULL));
569
570 ck = efl_add(EFL_UI_CHECK_CLASS, box);
571 efl_event_callback_add(ck, EFL_UI_EVENT_SELECTED_CHANGED, _scroll_block_check_cb, params);
572 efl_ui_selectable_selected_set(ck, efl_ui_spotlight_manager_scroll_block_get(efl_ui_spotlight_manager_get(params->spotlight)));
573 efl_text_set(ck, "Scroll Block");
574 efl_pack_end(box, ck);
575 efl_gfx_entity_visible_set(ck, 1);
576 }
577
578 static void
pack_cb(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)579 pack_cb(void *data,
580 Evas_Object *obj EINA_UNUSED,
581 void *event_info EINA_UNUSED)
582 {
583 Params *params = (Params *)data;
584 Evas_Object *navi = params->navi;
585 Eo *spotlight = params->spotlight;
586 Eo *btn, *box, *in_box1, *in_box2, *sp1, *sp2;
587 Pack_Params *pack_param;
588 int num;
589
590 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
591 efl_text_set(efl_added, "Back"),
592 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
593 back_btn_cb, navi));
594
595 box = efl_add(EFL_UI_BOX_CLASS, navi,
596 efl_gfx_arrangement_content_padding_set(efl_added, 10, 10),
597 elm_naviframe_item_push(navi, "Pack", btn, NULL,
598 efl_added, NULL));
599
600 in_box1 = efl_add(EFL_UI_BOX_CLASS, box,
601 efl_gfx_arrangement_content_padding_set(efl_added, 10, 10),
602 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL));
603
604 sp1 = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box1);
605 num = efl_content_count(spotlight);
606 if (num)
607 efl_ui_range_limits_set(sp1, 0, num);
608 num = efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight));
609 if (num >= 0)
610 efl_ui_range_value_set(sp1, num);
611
612 in_box2 = efl_add(EFL_UI_BOX_CLASS, box,
613 efl_gfx_arrangement_content_padding_set(efl_added, 10, 10),
614 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL));
615
616 sp2 = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box2);
617
618 btn = efl_add(EFL_UI_BUTTON_CLASS, in_box2,
619 efl_text_set(efl_added, "Unpack At"));
620
621 // Pack Begin
622 pack_param = calloc(1, sizeof(Pack_Params));
623 if (!pack_param) return;
624
625 pack_param->spotlight = spotlight;
626 pack_param->pack_sp = sp1;
627 pack_param->unpack_sp = sp2;
628 pack_param->unpack_btn = btn;
629 pack_param->type = PACK_BEGIN;
630
631 efl_add(EFL_UI_BUTTON_CLASS, box,
632 efl_text_set(efl_added, "Pack Begin"),
633 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
634 pack_btn_cb, pack_param),
635 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
636 pack_btn_del_cb, pack_param),
637 efl_pack_end(box, efl_added));
638
639 // Pack End
640 pack_param = calloc(1, sizeof(Pack_Params));
641 if (!pack_param) return;
642
643 pack_param->spotlight = spotlight;
644 pack_param->pack_sp = sp1;
645 pack_param->unpack_sp = sp2;
646 pack_param->unpack_btn = btn;
647 pack_param->type = PACK_END;
648
649 efl_add(EFL_UI_BUTTON_CLASS, box,
650 efl_text_set(efl_added, "Pack End"),
651 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
652 pack_btn_cb, pack_param),
653 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
654 pack_btn_del_cb, pack_param),
655 efl_pack_end(box, efl_added));
656
657 // Pack Before
658 pack_param = calloc(1, sizeof(Pack_Params));
659 if (!pack_param) return;
660
661 pack_param->spotlight = spotlight;
662 pack_param->pack_sp = sp1;
663 pack_param->unpack_sp = sp2;
664 pack_param->unpack_btn = btn;
665 pack_param->type = PACK_BEFORE;
666
667 efl_add(EFL_UI_BUTTON_CLASS, box,
668 efl_text_set(efl_added, "Pack Before Current Page"),
669 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
670 pack_btn_cb, pack_param),
671 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
672 pack_btn_del_cb, pack_param),
673 efl_pack_end(box, efl_added));
674
675 // Pack After
676 pack_param = calloc(1, sizeof(Pack_Params));
677 if (!pack_param) return;
678
679 pack_param->spotlight = spotlight;
680 pack_param->pack_sp = sp1;
681 pack_param->unpack_sp = sp2;
682 pack_param->unpack_btn = btn;
683 pack_param->type = PACK_AFTER;
684
685 efl_add(EFL_UI_BUTTON_CLASS, box,
686 efl_text_set(efl_added, "Pack After Current Page"),
687 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
688 pack_btn_cb, pack_param),
689 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
690 pack_btn_del_cb, pack_param),
691 efl_pack_end(box, efl_added));
692
693 // Pack At
694 pack_param = calloc(1, sizeof(Pack_Params));
695 if (!pack_param) return;
696
697 pack_param->spotlight = spotlight;
698 pack_param->pack_sp = sp1;
699 pack_param->unpack_sp = sp2;
700 pack_param->unpack_btn = btn;
701 pack_param->type = PACK_AT;
702
703 efl_add(EFL_UI_BUTTON_CLASS, in_box1,
704 efl_text_set(efl_added, "Pack At"),
705 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
706 pack_btn_cb, pack_param),
707 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
708 pack_btn_del_cb, pack_param),
709 efl_pack_end(in_box1, efl_added));
710
711 efl_pack_end(box, in_box1);
712 efl_pack_end(in_box1, sp1);
713
714 // Unpack At
715 pack_param = calloc(1, sizeof(Pack_Params));
716 if (!pack_param) return;
717
718 pack_param->spotlight = spotlight;
719 pack_param->pack_sp = sp1;
720 pack_param->unpack_sp = sp2;
721 pack_param->unpack_btn = btn;
722 pack_param->type = UNPACK_AT;
723
724 efl_event_callback_add(btn, EFL_INPUT_EVENT_CLICKED,
725 pack_btn_cb, pack_param);
726 efl_event_callback_add(btn, EFL_EVENT_DEL,
727 pack_btn_del_cb, pack_param);
728
729 if (efl_content_count(spotlight) > 0)
730 {
731 efl_ui_range_limits_set(sp2, 0,
732 (efl_content_count(spotlight) - 1));
733 efl_ui_range_value_set(sp2,
734 efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight)));
735 }
736 else
737 {
738 elm_object_disabled_set(btn, EINA_TRUE);
739 elm_object_disabled_set(sp2, EINA_TRUE);
740 }
741
742 efl_pack_end(box, in_box2);
743 efl_pack_end(in_box2, btn);
744 efl_pack_end(in_box2, sp2);
745
746 // Clear
747 pack_param = calloc(1, sizeof(Pack_Params));
748 if (!pack_param) return;
749
750 pack_param->spotlight = spotlight;
751 pack_param->pack_sp = sp1;
752 pack_param->unpack_sp = sp2;
753 pack_param->unpack_btn = btn;
754 pack_param->type = CLEAR;
755
756 efl_add(EFL_UI_BUTTON_CLASS, box,
757 efl_text_set(efl_added, "Clear"),
758 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
759 pack_btn_cb, pack_param),
760 efl_event_callback_add(efl_added, EFL_EVENT_DEL,
761 pack_btn_del_cb, pack_param),
762 efl_pack_end(box, efl_added));
763 }
764
765 static void
active_index_cb(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)766 active_index_cb(void *data,
767 Evas_Object *obj EINA_UNUSED,
768 void *event_info EINA_UNUSED)
769 {
770 Params *params = (Params *)data;
771 Evas_Object *navi = params->navi;
772 Eo *spotlight = params->spotlight;
773 Eo *btn, *box, *sp;
774 Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params));
775 if (!psp) return;
776
777 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
778 efl_text_set(efl_added, "Back"),
779 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
780 back_btn_cb, navi));
781
782 box = efl_add(EFL_UI_BOX_CLASS, navi,
783 efl_gfx_arrangement_content_padding_set(efl_added, 10, 10),
784 elm_naviframe_item_push(navi, "Active Index", btn, NULL,
785 efl_added, NULL));
786
787 btn = efl_add(EFL_UI_BUTTON_CLASS, box,
788 efl_text_set(efl_added, "Set Active Index"),
789 efl_pack_end(box, efl_added));
790
791 sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box,
792 efl_gfx_hint_align_set(efl_added, -1, -1),
793 efl_pack_end(box, efl_added));
794
795 if (efl_content_count(spotlight) > 0)
796 {
797 efl_ui_range_limits_set(sp, 0,
798 (efl_content_count(spotlight) - 1));
799 efl_ui_range_value_set(sp,
800 efl_pack_index_get(spotlight, efl_ui_spotlight_active_element_get(spotlight)));
801 }
802 else
803 {
804 elm_object_disabled_set(btn, EINA_TRUE);
805 elm_object_disabled_set(sp, EINA_TRUE);
806 }
807
808 psp->spotlight = spotlight;
809 psp->spinner = sp;
810
811 efl_event_callback_add(btn, EFL_INPUT_EVENT_CLICKED, page_set_btn_cb, psp);
812 efl_event_callback_add(btn, EFL_EVENT_DEL, page_set_btn_del_cb, psp);
813 }
814
815 static void
indicator_cb(void * data,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)816 indicator_cb(void *data,
817 Evas_Object *obj EINA_UNUSED,
818 void *event_info EINA_UNUSED)
819 {
820 Params *params = (Params *)data;
821 Evas_Object *navi = params->navi;
822 Eo *btn, *box;
823
824 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
825 efl_text_set(efl_added, "Back"),
826 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
827 back_btn_cb, navi));
828
829 box = efl_add(EFL_UI_BOX_CLASS, navi,
830 efl_gfx_arrangement_content_padding_set(efl_added, 10, 10),
831 elm_naviframe_item_push(navi, "Indicator", btn, NULL,
832 efl_added, NULL));
833
834 efl_add(EFL_UI_BUTTON_CLASS, box,
835 efl_text_set(efl_added, "Icon Type"),
836 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
837 indicator_icon_btn_cb, params),
838 efl_pack_end(box, efl_added));
839
840 efl_add(EFL_UI_BUTTON_CLASS, box,
841 efl_text_set(efl_added, "None"),
842 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED,
843 indicator_none_btn_cb, params),
844 efl_pack_end(box, efl_added));
845 }
846
847 void
test_ui_spotlight_stack(void * data EINA_UNUSED,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)848 test_ui_spotlight_stack(void *data EINA_UNUSED,
849 Evas_Object *obj EINA_UNUSED,
850 void *event_info EINA_UNUSED)
851 {
852 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view = NULL;
853 Params *params = NULL;
854 char buf[PATH_MAX];
855 int i;
856
857 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
858 efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"),
859 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
860
861 panes = efl_add(EFL_UI_PANES_CLASS, win,
862 efl_gfx_hint_weight_set(efl_added, 1, 1),
863 efl_ui_panes_split_ratio_set(efl_added, 0.3),
864 efl_content_set(win, efl_added));
865
866 navi = elm_naviframe_add(panes);
867 evas_object_show(navi);
868 efl_content_set(efl_part(panes, "first"), navi);
869
870 list = elm_list_add(navi);
871 elm_list_horizontal_set(list, EINA_FALSE);
872 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
873 elm_naviframe_item_push(navi, "Properties", NULL, NULL, list, NULL);
874 evas_object_show(list);
875
876 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
877 elm_app_data_dir_get());
878 layout = efl_add(EFL_UI_LAYOUT_CLASS, panes,
879 efl_file_set(efl_added, buf),
880 efl_file_key_set(efl_added, "pager"),
881 efl_file_load(efl_added),
882 efl_content_set(efl_part(panes, "second"), efl_added));
883
884 spotlight = efl_add(EFL_UI_STACK_CLASS, layout,
885 efl_content_set(efl_part(layout, "pager"), efl_added),
886 efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
887
888 efl_add(EFL_UI_BUTTON_CLASS, layout,
889 efl_text_set(efl_added, "Pop"),
890 efl_event_callback_add(efl_added,
891 EFL_INPUT_EVENT_CLICKED, pop_btn_cb, spotlight),
892 efl_content_set(efl_part(layout, "prev_btn"), efl_added));
893
894 efl_add(EFL_UI_BUTTON_CLASS, layout,
895 efl_text_set(efl_added, "Push"),
896 efl_event_callback_add(efl_added,
897 EFL_INPUT_EVENT_CLICKED, push_btn_cb, spotlight),
898 efl_content_set(efl_part(layout, "next_btn"), efl_added));
899
900 params = calloc(1, sizeof(Params));
901 if (!params) return;
902
903 params->navi = navi;
904 params->spotlight = spotlight;
905 params->indicator = NULL;
906 params->w = 200;
907 params->h = 300;
908 params->wfill = EINA_FALSE;
909 params->hfill = EINA_FALSE;
910
911 elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
912 elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
913 elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
914 elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
915 elm_list_item_append(list, "Animation", NULL, NULL, view_animation_cb, params);
916 elm_list_item_append(list, "Scroll Block", NULL, NULL, scroll_block_cb, params);
917 elm_list_go(list);
918
919 efl_event_callback_add(list, EFL_EVENT_DEL, list_del_cb, params);
920
921 for (i = 0; i < PAGE_NUM; i++)
922 {
923 switch (i % 3)
924 {
925 case 0:
926 view = view_add(LAYOUT, spotlight);
927 break;
928
929 case 1:
930 view = view_add(LIST, spotlight);
931 break;
932
933 case 2:
934 view = view_add(BUTTON, spotlight);
935 break;
936 }
937 efl_pack_end(spotlight, view);
938 }
939
940 efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
941 }
942
943 void
test_ui_spotlight_plain(void * data EINA_UNUSED,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)944 test_ui_spotlight_plain(void *data EINA_UNUSED,
945 Evas_Object *obj EINA_UNUSED,
946 void *event_info EINA_UNUSED)
947 {
948 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view = NULL;
949 Params *params = NULL;
950 char buf[PATH_MAX];
951 int i;
952
953 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
954 efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"),
955 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
956
957 panes = efl_add(EFL_UI_PANES_CLASS, win,
958 efl_gfx_hint_weight_set(efl_added, 1, 1),
959 efl_ui_panes_split_ratio_set(efl_added, 0.3),
960 efl_content_set(win, efl_added));
961
962 navi = elm_naviframe_add(panes);
963 evas_object_show(navi);
964 efl_content_set(efl_part(panes, "first"), navi);
965
966 list = elm_list_add(navi);
967 elm_list_horizontal_set(list, EINA_FALSE);
968 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
969 elm_naviframe_item_push(navi, "Properties", NULL, NULL, list, NULL);
970 evas_object_show(list);
971
972 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
973 elm_app_data_dir_get());
974 layout = efl_add(EFL_UI_LAYOUT_CLASS, panes,
975 efl_file_set(efl_added, buf),
976 efl_file_key_set(efl_added, "pager"),
977 efl_file_load(efl_added),
978 efl_content_set(efl_part(panes, "second"), efl_added));
979
980 spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
981 efl_content_set(efl_part(layout, "pager"), efl_added),
982 efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
983
984 efl_add(EFL_UI_BUTTON_CLASS, layout,
985 efl_text_set(efl_added, "Prev"),
986 efl_event_callback_add(efl_added,
987 EFL_INPUT_EVENT_CLICKED, prev_btn_cb, spotlight),
988 efl_content_set(efl_part(layout, "prev_btn"), efl_added));
989
990 efl_add(EFL_UI_BUTTON_CLASS, layout,
991 efl_text_set(efl_added, "Next"),
992 efl_event_callback_add(efl_added,
993 EFL_INPUT_EVENT_CLICKED, next_btn_cb, spotlight),
994 efl_content_set(efl_part(layout, "next_btn"), efl_added));
995
996 params = calloc(1, sizeof(Params));
997 if (!params) return;
998
999 params->navi = navi;
1000 params->spotlight = spotlight;
1001 params->indicator = NULL;
1002 params->w = 200;
1003 params->h = 300;
1004 params->wfill = EINA_FALSE;
1005 params->hfill = EINA_FALSE;
1006
1007 elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
1008 elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
1009 elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
1010 elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
1011 elm_list_go(list);
1012
1013 efl_event_callback_add(list, EFL_EVENT_DEL, list_del_cb, params);
1014
1015 for (i = 0; i < PAGE_NUM; i++)
1016 {
1017 switch (i % 3)
1018 {
1019 case 0:
1020 view = view_add(LAYOUT, spotlight);
1021 break;
1022
1023 case 1:
1024 view = view_add(LIST, spotlight);
1025 break;
1026
1027 case 2:
1028 view = view_add(BUTTON, spotlight);
1029 break;
1030 }
1031 efl_pack_end(spotlight, view);
1032 }
1033
1034 efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
1035 }
1036
1037 void
test_ui_spotlight_scroll(void * data EINA_UNUSED,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)1038 test_ui_spotlight_scroll(void *data EINA_UNUSED,
1039 Evas_Object *obj EINA_UNUSED,
1040 void *event_info EINA_UNUSED)
1041 {
1042 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view = NULL;
1043 Params *params = NULL;
1044 char buf[PATH_MAX];
1045 int i;
1046
1047 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
1048 efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"),
1049 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
1050
1051 panes = efl_add(EFL_UI_PANES_CLASS, win,
1052 efl_gfx_hint_weight_set(efl_added, 1, 1),
1053 efl_ui_panes_split_ratio_set(efl_added, 0.3),
1054 efl_content_set(win, efl_added));
1055
1056 navi = elm_naviframe_add(panes);
1057 evas_object_show(navi);
1058 efl_content_set(efl_part(panes, "first"), navi);
1059
1060 list = elm_list_add(navi);
1061 elm_list_horizontal_set(list, EINA_FALSE);
1062 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
1063 elm_naviframe_item_push(navi, "Properties", NULL, NULL, list, NULL);
1064 evas_object_show(list);
1065
1066 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
1067 elm_app_data_dir_get());
1068 layout = efl_add(EFL_UI_LAYOUT_CLASS, panes,
1069 efl_file_set(efl_added, buf),
1070 efl_file_key_set(efl_added, "pager"),
1071 efl_file_load(efl_added),
1072 efl_content_set(efl_part(panes, "second"), efl_added));
1073
1074 spotlight = efl_add(EFL_UI_PAGER_CLASS, layout,
1075 efl_content_set(efl_part(layout, "pager"), efl_added),
1076 efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
1077
1078 efl_add(EFL_UI_BUTTON_CLASS, layout,
1079 efl_text_set(efl_added, "Prev"),
1080 efl_event_callback_add(efl_added,
1081 EFL_INPUT_EVENT_CLICKED, prev_btn_cb, spotlight),
1082 efl_content_set(efl_part(layout, "prev_btn"), efl_added));
1083
1084 efl_add(EFL_UI_BUTTON_CLASS, layout,
1085 efl_text_set(efl_added, "Next"),
1086 efl_event_callback_add(efl_added,
1087 EFL_INPUT_EVENT_CLICKED, next_btn_cb, spotlight),
1088 efl_content_set(efl_part(layout, "next_btn"), efl_added));
1089
1090 params = calloc(1, sizeof(Params));
1091 if (!params) return;
1092
1093 params->navi = navi;
1094 params->spotlight = spotlight;
1095 params->indicator = NULL;
1096 params->w = 200;
1097 params->h = 300;
1098 params->wfill = EINA_FALSE;
1099 params->hfill = EINA_FALSE;
1100
1101 elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
1102 elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
1103 elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
1104 elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
1105 elm_list_item_append(list, "Animation", NULL, NULL, view_animation_cb, params);
1106 elm_list_item_append(list, "Scroll Block", NULL, NULL, scroll_block_cb, params);
1107 elm_list_go(list);
1108
1109 efl_event_callback_add(list, EFL_EVENT_DEL, list_del_cb, params);
1110
1111 for (i = 0; i < PAGE_NUM; i++) {
1112 switch (i % 3)
1113 {
1114 case 0:
1115 view = view_add(LAYOUT, spotlight);
1116 break;
1117
1118 case 1:
1119 view = view_add(LIST, spotlight);
1120 break;
1121
1122 case 2:
1123 view = view_add(BUTTON, spotlight);
1124 break;
1125 }
1126 efl_pack_end(spotlight, view);
1127 }
1128
1129 efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
1130 }
1131
1132
1133 void
test_ui_spotlight_animation(void * data EINA_UNUSED,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)1134 test_ui_spotlight_animation(void *data EINA_UNUSED,
1135 Evas_Object *obj EINA_UNUSED,
1136 void *event_info EINA_UNUSED)
1137 {
1138 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view, *custom_animation_manager;
1139 Efl_Canvas_Animation *jump_animation, *push_animation, *pop_animation;
1140 Params *params = NULL;
1141 char buf[PATH_MAX];
1142 int i;
1143
1144 win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
1145 efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"),
1146 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
1147
1148 panes = efl_add(EFL_UI_PANES_CLASS, win,
1149 efl_gfx_hint_weight_set(efl_added, 1, 1),
1150 efl_ui_panes_split_ratio_set(efl_added, 0.3),
1151 efl_content_set(win, efl_added));
1152
1153 navi = elm_naviframe_add(panes);
1154 evas_object_show(navi);
1155 efl_content_set(efl_part(panes, "first"), navi);
1156
1157 list = elm_list_add(navi);
1158 elm_list_horizontal_set(list, EINA_FALSE);
1159 elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
1160 elm_naviframe_item_push(navi, "Properties", NULL, NULL, list, NULL);
1161 evas_object_show(list);
1162
1163 snprintf(buf, sizeof(buf), "%s/objects/test_pager.edj",
1164 elm_app_data_dir_get());
1165 layout = efl_add(EFL_UI_LAYOUT_CLASS, panes,
1166 efl_file_set(efl_added, buf),
1167 efl_file_key_set(efl_added, "pager"),
1168 efl_file_load(efl_added),
1169 efl_content_set(efl_part(panes, "second"), efl_added));
1170
1171
1172 jump_animation = efl_new(EFL_CANVAS_ALPHA_ANIMATION_CLASS);
1173 efl_animation_alpha_set(jump_animation, 0.0, 1.0);
1174 efl_animation_duration_set(jump_animation, 0.5);
1175
1176 push_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS);
1177 efl_animation_translate_set(push_animation, EINA_POSITION2D(0, 100), EINA_POSITION2D(0, 0));
1178 efl_animation_duration_set(push_animation, 0.5);
1179
1180 pop_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS);
1181 efl_animation_translate_set(pop_animation, EINA_POSITION2D(0, -100), EINA_POSITION2D(0, 0));
1182 efl_animation_duration_set(pop_animation, 0.5);
1183
1184 custom_animation_manager = efl_new(EFL_UI_SPOTLIGHT_ANIMATION_MANAGER_CLASS,
1185 efl_ui_spotlight_manager_animation_push_setup_set(efl_added, push_animation, jump_animation),
1186 efl_ui_spotlight_manager_animation_pop_setup_set(efl_added, jump_animation, pop_animation),
1187 efl_ui_spotlight_manager_animation_jump_setup_set(efl_added, jump_animation, jump_animation));
1188
1189 spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
1190 efl_ui_spotlight_manager_set(efl_added, custom_animation_manager),
1191 efl_content_set(efl_part(layout, "pager"), efl_added),
1192 efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
1193
1194 efl_add(EFL_UI_BUTTON_CLASS, layout,
1195 efl_text_set(efl_added, "Pop"),
1196 efl_event_callback_add(efl_added,
1197 EFL_INPUT_EVENT_CLICKED, pop_btn_cb, spotlight),
1198 efl_content_set(efl_part(layout, "prev_btn"), efl_added));
1199
1200 efl_add(EFL_UI_BUTTON_CLASS, layout,
1201 efl_text_set(efl_added, "Push"),
1202 efl_event_callback_add(efl_added,
1203 EFL_INPUT_EVENT_CLICKED, push_btn_cb, spotlight),
1204 efl_content_set(efl_part(layout, "next_btn"), efl_added));
1205
1206 params = calloc(1, sizeof(Params));
1207 if (!params) return;
1208
1209 params->navi = navi;
1210 params->spotlight = spotlight;
1211 params->indicator = NULL;
1212 params->w = 200;
1213 params->h = 300;
1214 params->wfill = EINA_FALSE;
1215 params->hfill = EINA_FALSE;
1216
1217 elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
1218 elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
1219 elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
1220 elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
1221 elm_list_item_append(list, "Animation", NULL, NULL, view_animation_cb, params);
1222 elm_list_item_append(list, "Scroll Block", NULL, NULL, scroll_block_cb, params);
1223 elm_list_go(list);
1224
1225 efl_event_callback_add(list, EFL_EVENT_DEL, list_del_cb, params);
1226
1227 for (i = 0; i < PAGE_NUM; i++) {
1228 switch (i % 3)
1229 {
1230 case 0:
1231 view = view_add(LAYOUT, spotlight);
1232 break;
1233
1234 case 1:
1235 view = view_add(LIST, spotlight);
1236 break;
1237
1238 case 2:
1239 view = view_add(BUTTON, spotlight);
1240 break;
1241 }
1242 efl_pack_end(spotlight, view);
1243 }
1244
1245 efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
1246 }
1247