1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
6 typedef struct _Pginfo Pginfo;
10 Evas_Object *win, *pager, *pg1, *pg2, *pg3, *pg4;
14 my_pager_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
17 elm_pager_content_promote(info->pager, info->pg2);
21 my_pager_2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
24 elm_pager_content_promote(info->pager, info->pg3);
28 my_pager_3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
31 elm_pager_content_promote(info->pager, info->pg4);
36 my_pager_4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
39 elm_pager_content_promote(info->pager, info->pg1);
44 my_pager_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
47 elm_pager_content_pop(info->pager);
54 static const struct style_tuple styles[] = {
55 { "Default", "default"},
57 { "Slide Invisible", "slide_invisible"},
59 { "Fade Translucide", "fade_translucide"},
60 { "Fade Invisible", "fade_invisible"},
65 _style(void *data, Evas_Object *obj, void *event_info __UNUSED__)
67 Evas_Object *pg = data;
68 elm_object_style_set(pg, styles[elm_radio_value_get(obj)].name);
72 test_pager(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
74 Evas_Object *win, *bg, *pg, *bx, *lb, *bt;
77 win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
78 elm_win_title_set(win, "Pager");
79 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
80 elm_win_autodel_set(win, EINA_TRUE);
84 elm_win_resize_object_add(win, bg);
85 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
88 pg = elm_pager_add(win);
89 evas_object_size_hint_weight_set(pg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
90 elm_win_resize_object_add(win, pg);
95 bx = elm_box_add(win);
96 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
99 lb = elm_label_add(win);
100 elm_object_text_set(lb,
101 "This is page 1 in a pager stack.<br>"
103 "So what is a pager stack? It is a stack<br>"
104 "of pages that hold widgets in it. The<br>"
105 "pages can be pushed and popped on and<br>"
106 "off the stack, activated and otherwise<br>"
107 "activated if already in the stack<br>"
108 "(activated means promoted to the top of<br>"
111 "The theme may define the animation how<br>"
112 "show and hide of pages. Select one theme style:");
113 elm_box_pack_end(bx, lb);
114 evas_object_show(lb);
117 Evas_Object *rdg = NULL, *rd;
118 for (i = 0; i < (sizeof(styles) / sizeof(struct style_tuple)); i++)
120 rd = elm_radio_add(win);
121 elm_object_text_set(rd, styles[i].label);
122 elm_radio_state_value_set(rd, i);
124 elm_radio_group_add(rd, rdg);
127 evas_object_smart_callback_add(rd, "changed", _style, pg);
128 elm_box_pack_end(bx, rd);
129 evas_object_show(rd);
131 elm_radio_value_set(rd, 0);
133 bt = elm_button_add(win);
134 elm_object_text_set(bt, "Flip to 2");
135 evas_object_smart_callback_add(bt, "clicked", my_pager_1, &info);
136 elm_box_pack_end(bx, bt);
137 evas_object_show(bt);
139 bt = elm_button_add(win);
140 elm_object_text_set(bt, "Popme");
141 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
142 elm_box_pack_end(bx, bt);
143 evas_object_show(bt);
144 elm_pager_content_push(pg, bx);
147 bx = elm_box_add(win);
148 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
149 evas_object_show(bx);
151 lb = elm_label_add(win);
152 elm_object_text_set(lb,
153 "This is page 2 in a pager stack.<br>"
155 "This is just like the previous page in<br>"
158 elm_box_pack_end(bx, lb);
159 evas_object_show(lb);
161 bt = elm_button_add(win);
162 elm_object_text_set(bt, "Flip to 3");
163 evas_object_smart_callback_add(bt, "clicked", my_pager_2, &info);
164 elm_box_pack_end(bx, bt);
165 evas_object_show(bt);
167 bt = elm_button_add(win);
168 elm_object_text_set(bt, "Popme");
169 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
170 elm_box_pack_end(bx, bt);
171 evas_object_show(bt);
172 elm_pager_content_push(pg, bx);
175 bx = elm_box_add(win);
176 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
177 evas_object_show(bx);
179 lb = elm_label_add(win);
180 elm_object_text_set(lb,
181 "This is page 3 in a pager stack.<br>"
183 "This is just like the previous page in<br>"
185 elm_box_pack_end(bx, lb);
186 evas_object_show(lb);
188 bt = elm_button_add(win);
189 elm_object_text_set(bt, "Flip to 1");
190 evas_object_smart_callback_add(bt, "clicked", my_pager_3, &info);
191 elm_box_pack_end(bx, bt);
192 evas_object_show(bt);
194 bt = elm_button_add(win);
195 elm_object_text_set(bt, "Popme");
196 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
197 elm_box_pack_end(bx, bt);
198 evas_object_show(bt);
199 elm_pager_content_push(pg, bx);
202 Evas_Object *ly, *ly2;
205 ly = elm_layout_add(win);
206 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
207 elm_layout_file_set(ly, buf, "test/layout");
208 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
209 evas_object_show(ly);
211 ly2 = elm_layout_add(win);
212 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
213 elm_layout_file_set(ly2, buf, "layout2");
214 evas_object_size_hint_weight_set(ly2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
215 //elm_win_resize_object_add(win, ly2);
216 evas_object_show(ly2);
221 bt = elm_button_add(win);
222 elm_object_text_set(bt, "Flip to 1");
223 evas_object_smart_callback_add(bt, "clicked", my_pager_4, &info);
224 elm_object_part_content_set(ly2, "element1", bt);
225 evas_object_show(bt);
227 bt = elm_button_add(win);
228 elm_object_text_set(bt, "Popme");
229 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
230 evas_object_show(bt);
231 elm_object_part_content_set(ly2, "element2", bt);
233 elm_object_part_content_set(ly, "swallow", ly2);
234 evas_object_show(ly);
236 elm_pager_content_push(pg, ly);
240 evas_object_show(win);
244 my_pager_push(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
247 Evas_Object *bx, *bt, *lb;
248 static int count = 2;
251 bx = elm_box_add(info->win);
252 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
253 evas_object_show(bx);
255 lb = elm_label_add(info->win);
256 snprintf(buf, sizeof(buf), "This is page %d in the slide pager<br><br>", count++);
257 elm_object_text_set(lb, buf);
258 elm_box_pack_end(bx, lb);
259 evas_object_show(lb);
261 bt = elm_button_add(info->win);
262 elm_object_text_set(bt, "Push a new page");
263 evas_object_smart_callback_add(bt, "clicked", my_pager_push, info);
264 elm_box_pack_end(bx, bt);
265 evas_object_show(bt);
267 bt = elm_button_add(info->win);
268 elm_object_text_set(bt, "Go back (pop)");
269 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, info);
270 elm_box_pack_end(bx, bt);
271 evas_object_show(bt);
272 elm_pager_content_push(info->pager, bx);
276 test_pager_slide(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
278 Evas_Object *win, *bg, *pg, *bx, *lb, *bt;
281 win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
282 elm_win_title_set(win, "Pager Slide");
283 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
284 elm_win_autodel_set(win, EINA_TRUE);
287 bg = elm_bg_add(win);
288 elm_win_resize_object_add(win, bg);
289 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
290 evas_object_show(bg);
292 pg = elm_pager_add(win);
293 elm_win_resize_object_add(win, pg);
294 elm_object_style_set(pg, "slide");
295 evas_object_show(pg);
298 bx = elm_box_add(win);
299 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
300 evas_object_show(bx);
302 lb = elm_label_add(win);
303 elm_object_text_set(lb,
304 "This is page 1 in a slide pager.<br>"
306 "The slide pager style is useful for browsing<br>"
307 "a hierarchy of objects, as it makes clear<br>"
308 "the direction of the browse.<br>"
309 "This is the 'slide' style, also available<br>"
310 "a fully transparent style named 'slide_invisble'.<br>"
312 elm_box_pack_end(bx, lb);
313 evas_object_show(lb);
315 bt = elm_button_add(win);
316 elm_object_text_set(bt, "Push a new page");
317 evas_object_smart_callback_add(bt, "clicked", my_pager_push, &info);
318 elm_box_pack_end(bx, bt);
319 evas_object_show(bt);
321 bt = elm_button_add(win);
322 elm_object_text_set(bt, "Go back (pop)");
323 evas_object_smart_callback_add(bt, "clicked", my_pager_pop, &info);
324 elm_box_pack_end(bx, bt);
325 evas_object_show(bt);
326 elm_pager_content_push(pg, bx);
328 evas_object_show(win);