1 #include <Elementary.h>
3 # include "elementary_config.h"
10 Eina_List *transitions;
12 Evas_Object_Box_Layout last_layout;
16 _add_cb(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
20 Transitions_Data *tdata = data;
22 btn = elm_button_add(tdata->box);
23 elm_object_text_set(btn, "I do nothing");
24 children = (Eina_List *)elm_box_children_get(tdata->box);
27 elm_box_pack_after(tdata->box, btn, (Evas_Object *)children->data);
28 eina_list_free(children);
31 elm_box_pack_end(tdata->box, btn);
32 evas_object_show(btn);
36 _clear_cb(void *data, Evas_Object *obj __UNUSED__, void *ev __UNUSED__)
38 Transitions_Data *tdata = data;
39 elm_box_clear(tdata->box);
43 _unpack_cb(void *data, Evas_Object *obj, void *ev __UNUSED__)
45 Transitions_Data *tdata = data;
46 elm_box_unpack(tdata->box, obj);
47 evas_object_move(obj, 0, 50);
48 evas_object_color_set(obj, 128, 64, 0, 128);
52 _test_box_transition_change(void *data)
54 Transitions_Data *tdata = data;
55 Elm_Box_Transition *layout_data;
56 Evas_Object_Box_Layout next_layout;
59 next_layout = eina_list_data_get(tdata->transitions);
60 layout_data = elm_box_transition_new(2.0, tdata->last_layout,
61 NULL, NULL, next_layout, NULL, NULL,
62 _test_box_transition_change, tdata);
63 elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data,
64 elm_box_transition_free);
65 tdata->last_layout = next_layout;
67 tdata->transitions = eina_list_demote_list(tdata->transitions,
72 elm_main(int argc __UNUSED__, char *argv[] __UNUSED__)
74 Evas_Object *win, *bg, *bigbox, *bx, *bt;
75 static Transitions_Data tdata = {
81 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
83 win = elm_win_add(NULL, "box-transition", ELM_WIN_BASIC);
84 elm_win_title_set(win, "Box Transition");
85 elm_win_autodel_set(win, EINA_TRUE);
86 evas_object_resize(win, 300, 320);
87 evas_object_show(win);
90 elm_win_resize_object_add(win, bg);
91 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
94 bigbox = elm_box_add(win);
95 evas_object_size_hint_weight_set(bigbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
96 elm_win_resize_object_add(win, bigbox);
97 evas_object_show(bigbox);
99 bx = elm_box_add(win);
100 elm_box_horizontal_set(bx, EINA_TRUE);
101 elm_box_pack_end(bigbox, bx);
102 evas_object_show(bx);
104 bt = elm_button_add(win);
105 elm_object_text_set(bt, "Add");
106 elm_box_pack_end(bx, bt);
107 evas_object_show(bt);
108 evas_object_smart_callback_add(bt, "clicked", _add_cb, &tdata);
110 bt = elm_button_add(win);
111 elm_object_text_set(bt, "Clear");
112 elm_box_pack_end(bx, bt);
113 evas_object_show(bt);
114 evas_object_smart_callback_add(bt, "clicked", _clear_cb, &tdata);
116 bx = elm_box_add(win);
117 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
118 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
119 elm_box_pack_end(bigbox, bx);
120 evas_object_show(bx);
122 bt = elm_button_add(win);
123 elm_object_text_set(bt, "Button 1");
124 evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata);
125 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
126 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
127 elm_box_pack_end(bx, bt);
128 evas_object_show(bt);
130 bt = elm_button_add(win);
131 elm_object_text_set(bt, "Button 2");
132 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
133 evas_object_size_hint_align_set(bt, 1.0, 0.5);
134 evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata);
135 elm_box_pack_end(bx, bt);
136 evas_object_show(bt);
138 bt = elm_button_add(win);
139 elm_object_text_set(bt, "Button 3");
140 evas_object_smart_callback_add(bt, "clicked", _unpack_cb, &tdata);
141 elm_box_pack_end(bx, bt);
142 evas_object_show(bt);
145 tdata.last_layout = evas_object_box_layout_horizontal;
146 tdata.transitions = eina_list_append(tdata.transitions,
147 evas_object_box_layout_vertical);
148 tdata.transitions = eina_list_append(tdata.transitions,
149 evas_object_box_layout_horizontal);
150 tdata.transitions = eina_list_append(tdata.transitions,
151 evas_object_box_layout_stack);
152 tdata.transitions = eina_list_append(tdata.transitions,
153 evas_object_box_layout_homogeneous_vertical);
154 tdata.transitions = eina_list_append(tdata.transitions,
155 evas_object_box_layout_homogeneous_horizontal);
156 tdata.transitions = eina_list_append(tdata.transitions,
157 evas_object_box_layout_flow_vertical);
158 tdata.transitions = eina_list_append(tdata.transitions,
159 evas_object_box_layout_flow_horizontal);
160 tdata.transitions = eina_list_append(tdata.transitions,
161 evas_object_box_layout_stack);
163 elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL);
164 _test_box_transition_change(&tdata);