2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
7 #define BUTTON_TEXT_SET(BT, TEXT) \
8 elm_object_text_set((BT), (TEXT)); \
9 elm_object_tooltip_text_set((BT), (TEXT)); \
10 elm_object_tooltip_window_mode_set((BT), EINA_TRUE)
12 static const char *img1 = PACKAGE_DATA_DIR "/images/logo.png";
13 static const char *img2 = PACKAGE_DATA_DIR "/images/plant_01.jpg";
14 static const char *img3 = PACKAGE_DATA_DIR "/images/rock_01.jpg";
15 static const char *img4 = PACKAGE_DATA_DIR "/images/rock_02.jpg";
16 static const char *img5 = PACKAGE_DATA_DIR "/images/sky_01.jpg";
17 static const char *img6 = PACKAGE_DATA_DIR "/images/sky_02.jpg";
18 static const char *img7 = PACKAGE_DATA_DIR "/images/sky_03.jpg";
21 _content_new(Evas_Object *parent, const char *img)
23 Evas_Object *photo = elm_photo_add(parent);
24 elm_photo_file_set(photo, img);
25 elm_photo_fill_inside_set(photo, EINA_TRUE);
26 elm_object_style_set(photo, "shadow");
31 _navi_pop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
33 elm_naviframe_item_pop(data);
37 _navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
39 elm_object_item_del(data);
43 _title_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
45 printf("Title Clicked!\n");
49 _title_visible(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
51 elm_naviframe_item_title_visible_set(data,
52 !elm_naviframe_item_title_visible_get(data));
56 _promote(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
58 elm_naviframe_item_promote(data);
62 _page7(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
64 Evas_Object *bt, *bt2, *content, *nf = data;
67 bt = elm_button_add(nf);
68 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
69 BUTTON_TEXT_SET(bt, "Page 6");
71 bt2 = elm_button_add(nf);
72 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
73 BUTTON_TEXT_SET(bt2, "Page 1");
74 evas_object_smart_callback_add(bt2, "clicked", _promote,
75 evas_object_data_get(nf, "page1"));
76 content = _content_new(nf, img6);
77 it = elm_naviframe_item_push(nf, "Page 7", bt, bt2, content, "overlap");
78 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");
80 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
84 _page6(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
86 Evas_Object *bt, *bt2, *content, *nf = data;
89 bt = elm_button_add(nf);
90 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
91 BUTTON_TEXT_SET(bt, "Page 5");
93 bt2 = elm_button_add(nf);
94 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
95 BUTTON_TEXT_SET(bt2, "Page 7");
96 evas_object_smart_callback_add(bt2, "clicked", _page7, nf);
98 content = _content_new(nf, img7);
99 it = elm_naviframe_item_push(nf, "Page 6", bt, bt2, content, "overlap");
100 elm_object_item_part_text_set(it, "subtitle", "Overlap style!");
102 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
106 _page5(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
108 Evas_Object *bt, *bt2, *content, *nf = data;
111 bt = elm_button_add(nf);
112 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
113 BUTTON_TEXT_SET(bt, "Page 4");
115 bt2 = elm_button_add(nf);
116 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
117 BUTTON_TEXT_SET(bt2, "Page 6");
118 evas_object_smart_callback_add(bt2, "clicked", _page6, nf);
120 content = _content_new(nf, img5);
121 it = elm_naviframe_item_insert_after(nf,
122 elm_naviframe_top_item_get(nf),
128 elm_object_item_part_text_set(it, "subtitle", "This page is inserted without transition");
129 evas_object_smart_callback_add(bt, "clicked", _navi_it_del, it);
133 _page4(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
135 Evas_Object *bt, *ic, *content, *nf = data;
139 ic = elm_icon_add(nf);
140 snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png",
141 elm_app_data_dir_get());
142 elm_icon_file_set(ic, buf, NULL);
143 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
145 bt = elm_button_add(nf);
146 evas_object_smart_callback_add(bt, "clicked", _page5, nf);
147 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
148 elm_object_part_content_set(bt, "icon", ic);
150 content = _content_new(nf, img4);
152 it = elm_naviframe_item_push(nf,
158 elm_object_item_part_text_set(it, "subtitle", "Title area visibility test");
160 ic = elm_icon_add(nf);
161 snprintf(buf, sizeof(buf), "%s/images/logo_small.png",
162 elm_app_data_dir_get());
163 elm_icon_file_set(ic, buf, NULL);
164 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
165 elm_object_item_part_content_set(it, "icon", ic);
166 elm_naviframe_item_title_visible_set(it, EINA_FALSE);
167 evas_object_smart_callback_add(content, "clicked", _title_visible, it);
171 _page3(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
173 Evas_Object *bt, *bt2, *ic, *content, *nf = data;
177 bt = elm_button_add(nf);
178 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
179 BUTTON_TEXT_SET(bt, "Prev");
180 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
182 bt2 = elm_button_add(nf);
183 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
184 BUTTON_TEXT_SET(bt2, "Next");
185 evas_object_smart_callback_add(bt2, "clicked", _page4, nf);
187 content = _content_new(nf, img3);
189 it = elm_naviframe_item_push(nf,
195 ic = elm_icon_add(nf);
196 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
197 elm_icon_file_set(ic, buf, NULL);
198 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
200 elm_object_item_part_content_set(it, "icon", ic);
204 _page2(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
206 Evas_Object *bt, *content, *ic, *nf = data;
210 bt = elm_button_add(nf);
211 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
212 evas_object_smart_callback_add(bt, "clicked", _page3, nf);
214 ic = elm_icon_add(nf);
215 snprintf(buf, sizeof(buf), "%s/images/icon_right_arrow.png",
216 elm_app_data_dir_get());
217 elm_icon_file_set(ic, buf, NULL);
218 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
219 elm_object_part_content_set(bt, "icon", ic);
221 content = _content_new(nf, img2);
223 it = elm_naviframe_item_push(nf, "Page 2", NULL, bt, content, NULL);
224 elm_object_item_part_text_set(it, "subtitle", "Here is sub-title part!");
228 test_naviframe(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
230 Evas_Object *win, *nf, *btn, *content;
233 win = elm_win_util_standard_add("naviframe", "Naviframe");
234 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
235 elm_win_autodel_set(win, EINA_TRUE);
237 nf = elm_naviframe_add(win);
238 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
239 elm_win_resize_object_add(win, nf);
240 evas_object_show(nf);
241 evas_object_smart_callback_add(nf, "title,clicked", _title_clicked, 0);
243 btn = elm_button_add(nf);
244 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
245 evas_object_smart_callback_add(btn, "clicked", _page2, nf);
246 BUTTON_TEXT_SET(btn, "Next");
247 evas_object_show(btn);
249 content = _content_new(nf, img1);
250 it = elm_naviframe_item_push(nf, "Page 1", NULL, btn, content, NULL);
251 evas_object_data_set(nf, "page1", it);
253 evas_object_resize(win, 400, 600);
254 evas_object_show(win);