[Entry] Fix scrolling issue with cnp, magnifier
[framework/uifw/elementary.git] / src / bin / test_box.c
1 #include "test.h"
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #include <Elementary.h>
6 #ifndef ELM_LIB_QUICKLAUNCH
7 #define ICON_MAX 24
8
9 typedef enum
10 {
11   BOX_PACK_POSITION_START,
12   BOX_PACK_POSITION_BEFORE,
13   BOX_PACK_POSITION_AFTER,
14   BOX_PACK_POSITION_END
15 } Box_Pack_Position;
16
17 struct _api_data
18 {
19    unsigned int state;  /* What state we are testing       */
20    void *box;           /* Use this to get box content     */
21 };
22 typedef struct _api_data api_data;
23
24 enum _api_state
25 {
26    BOX_PACK_START,
27    BOX_PACK_BEFORE,
28    BOX_PACK_AFTER,
29    BOX_PADDING_SET,
30    BOX_ALIGN_SET,
31    BOX_HOMOGENEOUS_SET,
32    BOX_UNPACK_ALL,
33    BOX_CLEAR,
34    API_STATE_LAST
35 };
36 typedef enum _api_state api_state;
37
38 static void
39 set_api_state(api_data *api)
40 {
41    const Eina_List *items = elm_box_children_get(api->box);
42    if (!eina_list_count(items))
43      return;
44
45    /* use elm_box_children_get() to get list of children */
46    switch(api->state)
47      { /* Put all api-changes under switch */
48       case BOX_PACK_START:  /* Move last item to begining */
49          elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
50          elm_box_pack_start(api->box, eina_list_data_get(eina_list_last(items)));
51          break;
52
53       case BOX_PACK_BEFORE:
54          if (eina_list_count(items) > 1)
55                {  /* Put last item before the one preceeding it */
56                   elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
57                   elm_box_pack_before(api->box,
58                         eina_list_data_get(eina_list_last(items)),
59                         eina_list_nth(items, eina_list_count(items)-2));
60                }
61          break;
62
63       case BOX_PACK_AFTER:
64          if (eina_list_count(items) > 1)
65                {  /* Put item before last to last */
66                   elm_box_unpack(api->box, eina_list_nth(items,
67                            eina_list_count(items)-2));
68                   elm_box_pack_after(api->box,
69                         eina_list_nth(items, eina_list_count(items)-2),
70                         eina_list_data_get(eina_list_last(items)));
71                }
72          break;
73
74       case BOX_PADDING_SET:
75          elm_box_padding_set(api->box, 30, 15);
76          break;
77
78       case BOX_ALIGN_SET:
79          elm_box_align_set(api->box, 0.25, 0.75);
80          break;
81
82       case BOX_HOMOGENEOUS_SET:
83          elm_box_homogeneous_set(api->box, EINA_TRUE);
84          break;
85
86       case BOX_UNPACK_ALL:
87            {
88               Eina_List *l;
89               Evas_Object *data;
90               elm_box_unpack_all(api->box);
91               EINA_LIST_REVERSE_FOREACH(items, l, data)
92                  elm_box_pack_end(api->box, data);
93            }
94          break;
95
96       case BOX_CLEAR:
97          elm_box_clear(api->box);
98          break;
99
100       case API_STATE_LAST:
101
102          break;
103       default:
104          return;
105      }
106 }
107
108 static void
109 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
110 {  /* Will add here a SWITCH command containing code to modify test-object */
111    /* in accordance a->state value. */
112    api_data *a = data;
113    char str[128];
114
115    printf("clicked event on API Button: api_state=<%d>\n", a->state);
116    set_api_state(a);
117    a->state++;
118    sprintf(str, "Next API function (%u)", a->state);
119    elm_object_text_set(obj, str);
120    elm_object_disabled_set(obj, a->state == API_STATE_LAST);
121 }
122
123 static void
124 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
125 {
126    free(data);
127 }
128
129 void
130 test_box_vert(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
131 {
132    Evas_Object *win, *bx, *ic, *bxx, *bt;
133    char buf[PATH_MAX];
134    api_data *api = calloc(1, sizeof(api_data));
135
136    win = elm_win_util_standard_add("box-vert", "Box Vert");
137    elm_win_autodel_set(win, EINA_TRUE);
138    evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
139
140    bxx = elm_box_add(win);
141    elm_win_resize_object_add(win, bxx);
142    evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
143    evas_object_show(bxx);
144
145    bx = elm_box_add(win);
146    api->box = bx;
147    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
148    evas_object_show(bx);
149
150    bt = elm_button_add(win);
151    elm_object_text_set(bt, "Next API function");
152    evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
153    elm_box_pack_end(bxx, bt);
154    elm_object_disabled_set(bt, api->state == API_STATE_LAST);
155    evas_object_show(bt);
156
157    elm_box_pack_end(bxx, bx);
158
159    ic = elm_icon_add(win);
160    snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get());
161    elm_image_file_set(ic, buf, NULL);
162    elm_image_resizable_set(ic, 0, 0);
163    evas_object_size_hint_align_set(ic, 0.5, 0.5);
164    elm_box_pack_end(bx, ic);
165    evas_object_show(ic);
166
167    ic = elm_icon_add(win);
168    snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get());
169    elm_image_file_set(ic, buf, NULL);
170    elm_image_resizable_set(ic, 0, 0);
171    evas_object_size_hint_align_set(ic, 0.0, 0.5);
172    elm_box_pack_end(bx, ic);
173    evas_object_show(ic);
174
175    ic = elm_icon_add(win);
176    snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get());
177    elm_image_file_set(ic, buf, NULL);
178    elm_image_resizable_set(ic, 0, 0);
179    evas_object_size_hint_align_set(ic, EVAS_HINT_EXPAND, 0.5);
180    elm_box_pack_end(bx, ic);
181    evas_object_show(ic);
182
183    evas_object_show(win);
184 }
185
186 static void
187 _del_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
188 {
189    elm_box_unpack(data, obj);
190    evas_object_move(obj, 0, 0);
191    evas_object_color_set(obj, 128, 64, 0, 128);
192    evas_object_del(obj);
193 }
194
195 void
196 test_box_vert2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
197 {
198    Evas_Object *win, *bx, *bt;
199
200    win = elm_win_util_standard_add("box-vert2", "Box Vert 2");
201    elm_win_autodel_set(win, EINA_TRUE);
202
203    bx = elm_box_add(win);
204    elm_win_resize_object_add(win, bx);
205    elm_box_padding_set(bx, 10, 10);
206    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
207    evas_object_show(bx);
208
209    bt = elm_button_add(win);
210    elm_object_text_set(bt, "Button 1");
211    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
212    evas_object_size_hint_weight_set(bt, 0.0, 0.0);
213    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
214    elm_box_pack_end(bx, bt);
215    evas_object_show(bt);
216
217    bt = elm_button_add(win);
218    elm_object_text_set(bt, "Button 2");
219    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
220    evas_object_size_hint_weight_set(bt, 0.0, 0.0);
221    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
222    elm_box_pack_end(bx, bt);
223    evas_object_show(bt);
224
225    bt = elm_button_add(win);
226    elm_object_text_set(bt, "Button 3");
227    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
228    evas_object_size_hint_weight_set(bt, 0.0, 0.0);
229    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
230    elm_box_pack_end(bx, bt);
231    evas_object_show(bt);
232
233    bt = elm_button_add(win);
234    elm_object_text_set(bt, "Button 4");
235    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
236    evas_object_size_hint_weight_set(bt, 0.0, 0.0);
237    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
238    elm_box_pack_end(bx, bt);
239    evas_object_show(bt);
240
241    bt = elm_button_add(win);
242    elm_object_text_set(bt, "Button 5");
243    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
244    evas_object_size_hint_weight_set(bt, 0.0, 0.0);
245    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
246    elm_box_pack_end(bx, bt);
247    evas_object_show(bt);
248
249    evas_object_show(win);
250 }
251
252 void
253 test_box_horiz(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
254 {
255    Evas_Object *win, *bx, *ic, *bxx, *bt;
256    char buf[PATH_MAX];
257    api_data *api = calloc(1, sizeof(api_data));
258
259    win = elm_win_util_standard_add("box-horiz", "Box Horiz");
260    elm_win_autodel_set(win, EINA_TRUE);
261    evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
262
263    bxx = elm_box_add(win);
264    elm_win_resize_object_add(win, bxx);
265    evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
266    evas_object_show(bxx);
267
268    bx = elm_box_add(win);
269    elm_box_horizontal_set(bx, EINA_TRUE);
270    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
271    api->box = bx;
272    evas_object_show(bx);
273
274    bt = elm_button_add(win);
275    elm_object_text_set(bt, "Next API function");
276    evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
277    elm_box_pack_end(bxx, bt);
278    elm_object_disabled_set(bt, api->state == API_STATE_LAST);
279    evas_object_show(bt);
280
281    elm_box_pack_end(bxx, bx);
282
283    ic = elm_icon_add(win);
284    snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get());
285    elm_image_file_set(ic, buf, NULL);
286    elm_image_resizable_set(ic, 0, 0);
287    evas_object_size_hint_align_set(ic, 0.5, 0.5);
288    elm_box_pack_end(bx, ic);
289    evas_object_show(ic);
290
291    ic = elm_icon_add(win);
292    snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get());
293    elm_image_file_set(ic, buf, NULL);
294    elm_image_resizable_set(ic, 0, 0);
295    evas_object_size_hint_align_set(ic, 0.5, 0.0);
296    elm_box_pack_end(bx, ic);
297    evas_object_show(ic);
298
299    ic = elm_icon_add(win);
300    snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get());
301    elm_image_file_set(ic, buf, NULL);
302    elm_image_resizable_set(ic, 0, 0);
303    evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
304    elm_box_pack_end(bx, ic);
305    evas_object_show(ic);
306
307    evas_object_show(win);
308 }
309
310 static Eina_Bool radio_index[ICON_MAX];
311
312 static int
313 _index_get(void)
314 {
315    int i;
316    for (i = 0; i < ICON_MAX; i++)
317      {
318         if (!radio_index[i])
319           {
320              radio_index[i] = EINA_TRUE;
321              return i;
322           }
323
324      }
325    return -1;
326 }
327
328 static void
329 _index_remove(int i)
330 {
331    if (i >= ICON_MAX) return;
332    radio_index[i] = EINA_FALSE;
333 }
334
335 static void
336 _index_clear()
337 {
338    int i;
339    for (i = 0; i < ICON_MAX; i++)
340      radio_index[i] = EINA_FALSE;
341 }
342
343 static Evas_Object *
344 _radio_new(Evas_Object *obj)
345 {
346    Evas_Object *ic, *rd;
347    int idx;
348    char buf[PATH_MAX];
349    Evas_Object *rdg;
350
351    idx = _index_get();
352    if (idx == -1) return NULL;
353
354    ic = elm_icon_add(obj);
355    snprintf(buf, sizeof(buf), "%s/images/icon_%02d.png",
356             elm_app_data_dir_get(), idx);
357    elm_image_file_set(ic, buf, NULL);
358    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
359
360    rd = elm_radio_add(obj);
361    elm_radio_state_value_set(rd, idx);
362    evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
363    evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
364    elm_object_part_content_set(rd, "icon", ic);
365
366    rdg = evas_object_data_get(obj, "radio-group");
367    if (rdg) elm_radio_group_add(rd, rdg);
368
369    evas_object_show(rd);
370    evas_object_show(ic);
371
372    return rd;
373 }
374
375 static void
376 _pack_start_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
377 {
378    Evas_Object *rd;
379    if (!data) return;
380
381    rd = _radio_new(data);
382    if (!rd) return;
383    elm_box_pack_start(data, rd);
384 }
385
386 static void
387 _pack_before_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
388 {
389    Evas_Object *rd, *selected_rd, *rdg;
390    if (!data) return;
391
392    rdg = evas_object_data_get(data, "radio-group");
393    if (!rdg) return;
394
395    selected_rd = elm_radio_selected_object_get(rdg);
396    if (!selected_rd || (selected_rd == rdg)) return;
397
398    rd = _radio_new(data);
399    if (!rd) return;
400    elm_box_pack_before(data, rd, selected_rd);
401 }
402
403 static void
404 _pack_after_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
405 {
406    Evas_Object *rd, *selected_rd, *rdg;
407    if (!data) return;
408
409    rdg = evas_object_data_get(data, "radio-group");
410    if (!rdg) return;
411
412    selected_rd = elm_radio_selected_object_get(rdg);
413    if (!selected_rd || (selected_rd == rdg)) return;
414
415    rd = _radio_new(data);
416    if (!rd) return;
417    elm_box_pack_after(data, rd, selected_rd);
418 }
419
420 static void
421 _pack_end_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
422 {
423    Evas_Object *rd;
424    if (!data) return;
425
426    rd = _radio_new(data);
427    if (!rd) return;
428    elm_box_pack_end(data, rd);
429 }
430
431 static void
432 _unpack_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
433 {
434    Evas_Object *rdg, *selected_rd;
435    if (!data) return;
436
437    rdg = evas_object_data_get(data, "radio-group");
438    if (!rdg) return;
439
440    selected_rd = elm_radio_selected_object_get(rdg);
441    if (selected_rd == rdg) return;
442
443    _index_remove(elm_radio_value_get(selected_rd));
444    elm_box_unpack(data, selected_rd);
445    evas_object_del(selected_rd);
446    elm_radio_value_set(rdg, -1);
447 }
448
449 static void
450 _unpack_all_btn_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
451 {
452    Evas_Object *radio, *rdg;
453    Eina_List *rl, *l;
454    if (!data) return;
455
456    rdg = evas_object_data_get(data, "radio-group");
457    if (!rdg) return;
458
459    _index_clear();
460    rl = elm_box_children_get(data);
461    EINA_LIST_FOREACH(rl, l, radio)
462      {
463         if (radio != rdg)
464           evas_object_del(radio);
465      }
466    elm_box_unpack_all(data);
467    elm_radio_value_set(rdg, -1);
468 }
469
470 void
471 test_box_pack(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
472 {
473    Evas_Object *win, *sc, *bt;
474    Evas_Object *box, *lbox, *rbox;
475    Evas_Object *rd, *rdg = NULL;
476    int i;
477
478    win = elm_win_util_standard_add("box-pack", "Box Pack");
479    elm_win_autodel_set(win, EINA_TRUE);
480
481    box = elm_box_add(win);
482    elm_box_horizontal_set(box, EINA_TRUE);
483    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
484    evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
485    elm_win_resize_object_add(win, box);
486    evas_object_show(box);
487
488    // left side
489    lbox = elm_box_add(win);
490    evas_object_size_hint_weight_set(lbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
491    evas_object_size_hint_align_set(lbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
492
493    sc = elm_scroller_add(win);
494    elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
495    evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
496    evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
497
498    rdg = elm_radio_add(win); /* a radio for easy group handling */
499    elm_radio_state_value_set(rdg, -1);
500    evas_object_data_set(lbox, "radio-group", rdg);
501
502    for (i = 0; i < 3; i++)
503      {
504         rd = _radio_new(lbox);
505         elm_box_pack_end(lbox, rd);
506      }
507
508    elm_object_content_set(sc, lbox);
509    evas_object_show(lbox);
510    elm_box_pack_end(box, sc);
511    evas_object_show(sc);
512
513    // right side
514    rbox = elm_box_add(win);
515    evas_object_size_hint_weight_set(rbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
516    evas_object_size_hint_align_set(rbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
517    evas_object_show(rbox);
518    elm_box_pack_end(box, rbox);
519
520    bt = elm_button_add(win);
521    elm_object_text_set(bt, "Pack Start");
522    evas_object_show(bt);
523    elm_box_pack_end(rbox, bt);
524    evas_object_smart_callback_add(bt, "clicked", _pack_start_btn_cb, lbox);
525
526    bt = elm_button_add(win);
527    elm_object_text_set(bt, "Pack Before");
528    evas_object_show(bt);
529    elm_box_pack_end(rbox, bt);
530    evas_object_smart_callback_add(bt, "clicked", _pack_before_btn_cb, lbox);
531
532    bt = elm_button_add(win);
533    elm_object_text_set(bt, "Pack After");
534    evas_object_show(bt);
535    elm_box_pack_end(rbox, bt);
536    evas_object_smart_callback_add(bt, "clicked", _pack_after_btn_cb, lbox);
537
538    bt = elm_button_add(win);
539    elm_object_text_set(bt, "Pack End");
540    evas_object_show(bt);
541    elm_box_pack_end(rbox, bt);
542    evas_object_smart_callback_add(bt, "clicked", _pack_end_btn_cb, lbox);
543
544    bt = elm_button_add(win);
545    elm_object_text_set(bt, "Unpack");
546    evas_object_show(bt);
547    elm_box_pack_end(rbox, bt);
548    evas_object_smart_callback_add(bt, "clicked", _unpack_btn_cb, lbox);
549
550    bt = elm_button_add(win);
551    elm_object_text_set(bt, "Unpack All");
552    evas_object_show(bt);
553    elm_box_pack_end(rbox, bt);
554    evas_object_smart_callback_add(bt, "clicked", _unpack_all_btn_cb, lbox);
555
556    evas_object_resize(win, 320, 320);
557    evas_object_show(win);
558 }
559
560 static void
561 _cb_check_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
562 {
563    Eina_Bool homo;
564    Evas_Object *box = data;
565
566    homo = elm_check_state_get(obj);
567    elm_box_homogeneous_set(box, homo);
568 }
569
570 void
571 test_box_homo(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
572 {
573    Evas_Object *win;
574    Evas_Object *box, *o_bg;
575    Evas_Object *rd;
576    char buf[PATH_MAX];
577
578    win = elm_win_util_standard_add("box-homogeneous", "Box Homogeneous");
579    elm_win_autodel_set(win, EINA_TRUE);
580
581    box = elm_box_add(win);
582    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
583    elm_win_resize_object_add(win, box);
584    evas_object_show(box);
585
586    o_bg = elm_bg_add(win);
587    snprintf(buf, sizeof(buf), "%s/images/twofish.jpg", elm_app_data_dir_get());
588    elm_bg_file_set(o_bg, buf, NULL);
589    evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
590    evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
591    elm_box_pack_end(box, o_bg);
592
593    rd = elm_check_add(win);
594    elm_object_text_set(rd, "Homogeneous");
595    evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
596    evas_object_smart_callback_add(rd, "changed", _cb_check_changed, box);
597    elm_box_pack_end(box, rd);
598    evas_object_show(rd);
599    evas_object_show(o_bg);
600
601    evas_object_resize(win, 320, 320);
602    evas_object_show(win);
603 }
604
605 typedef struct
606 {
607    Eina_List *transitions;
608    Evas_Object *box;
609    Evas_Object_Box_Layout last_layout;
610 } Transitions_Data;
611
612 static void
613 _test_box_transition_change(void *data)
614 {
615    Transitions_Data *tdata = data;
616    Elm_Box_Transition *layout_data;
617    Evas_Object_Box_Layout next_layout;
618
619    if (!data) return;
620    next_layout = eina_list_data_get(tdata->transitions);
621    layout_data = elm_box_transition_new(2.0, tdata->last_layout,
622                                         NULL, NULL, next_layout, NULL, NULL,
623                                         _test_box_transition_change, tdata);
624    elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, elm_box_transition_free);
625    tdata->last_layout = next_layout;
626
627    tdata->transitions = eina_list_demote_list(tdata->transitions, tdata->transitions);
628 }
629
630 static void
631 _win_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
632 {
633    Transitions_Data *tdata = data;
634    if (!data) return;
635    free(tdata);
636 }
637
638 void
639 test_box_transition(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
640 {
641    Evas_Object *win, *bx, *bt;
642    Transitions_Data *tdata;
643
644    win = elm_win_util_standard_add("box-transition", "Box Transition");
645    elm_win_autodel_set(win, EINA_TRUE);
646
647    bx = elm_box_add(win);
648    elm_win_resize_object_add(win, bx);
649    evas_object_size_hint_weight_set(bx, 1.0, 1.0);
650    evas_object_show(bx);
651
652    bt = elm_button_add(win);
653    elm_object_text_set(bt, "Button 1");
654    evas_object_size_hint_weight_set(bt, 1.0, 1.0);
655    evas_object_size_hint_align_set(bt, -1.0, -1.0);
656    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
657    elm_box_pack_end(bx, bt);
658    evas_object_resize(bt, 100, 100);
659    evas_object_show(bt);
660
661    bt = elm_button_add(win);
662    elm_object_text_set(bt, "Button 2");
663    evas_object_size_hint_weight_set(bt, 1.0, 1.0);
664    evas_object_size_hint_align_set(bt, -1.0, -1.0);
665    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
666    elm_box_pack_end(bx, bt);
667    evas_object_resize(bt, 100, 100);
668    evas_object_show(bt);
669
670    bt = elm_button_add(win);
671    elm_object_text_set(bt, "Button 3");
672    evas_object_size_hint_weight_set(bt, 1.0, 1.0);
673    evas_object_size_hint_align_set(bt, -1.0, -1.0);
674    evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
675    elm_box_pack_end(bx, bt);
676    evas_object_resize(bt, 100, 100);
677    evas_object_show(bt);
678
679    tdata = calloc(1, sizeof(Transitions_Data));
680    tdata->box = bx;
681    tdata->last_layout = evas_object_box_layout_horizontal;
682    tdata->transitions = eina_list_append(tdata->transitions,
683          evas_object_box_layout_vertical);
684    tdata->transitions = eina_list_append(tdata->transitions,
685          evas_object_box_layout_horizontal);
686    tdata->transitions = eina_list_append(tdata->transitions,
687          evas_object_box_layout_stack);
688    tdata->transitions = eina_list_append(tdata->transitions,
689          evas_object_box_layout_homogeneous_vertical);
690    tdata->transitions = eina_list_append(tdata->transitions,
691          evas_object_box_layout_homogeneous_horizontal);
692    tdata->transitions = eina_list_append(tdata->transitions,
693          evas_object_box_layout_flow_vertical);
694    tdata->transitions = eina_list_append(tdata->transitions,
695          evas_object_box_layout_flow_horizontal);
696    tdata->transitions = eina_list_append(tdata->transitions,
697          evas_object_box_layout_stack);
698
699    evas_object_resize(win, 300, 300);
700    evas_object_resize(bx, 300, 300);
701    evas_object_smart_callback_add(win, "delete,request", _win_del, tdata);
702    evas_object_show(win);
703    elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL);
704    _test_box_transition_change(tdata);
705 }
706 #endif