1 #include <Elementary.h>
2 #include <elementary_config.h>
3 #ifndef ELM_LIB_QUICKLAUNCH
5 static Evas_Object *slideshow, *bt_start, *bt_stop;
6 static Elm_Slideshow_Item_Class itc;
7 static const char *img1 = PACKAGE_DATA_DIR"/images/logo.png";
8 static const char *img2 = PACKAGE_DATA_DIR"/images/plant_01.jpg";
9 static const char *img3 = PACKAGE_DATA_DIR"/images/rock_01.jpg";
10 static const char *img4 = PACKAGE_DATA_DIR"/images/rock_02.jpg";
11 static const char *img5 = PACKAGE_DATA_DIR"/images/sky_01.jpg";
12 static const char *img6 = PACKAGE_DATA_DIR"/images/sky_04.jpg";
13 static const char *img7 = PACKAGE_DATA_DIR"/images/wood_01.jpg";
14 static const char *img8 = PACKAGE_DATA_DIR"/images/mystrale.jpg";
15 static const char *img9 = PACKAGE_DATA_DIR"/images/mystrale_2.jpg";
18 _notify_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
20 evas_object_show(data);
24 _next(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
26 elm_slideshow_next(data);
30 _previous(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
32 elm_slideshow_previous(data);
36 _mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
38 elm_notify_timeout_set(data, 0.0);
39 evas_object_show(data);
44 _mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
46 elm_notify_timeout_set(data, 3.0);
50 _hv_select(void *data, Evas_Object *obj, void *event_info __UNUSED__)
52 elm_slideshow_transition_set(slideshow, data);
53 elm_hoversel_label_set(obj, data);
57 _layout_select(void *data, Evas_Object *obj, void *event_info __UNUSED__)
59 elm_slideshow_layout_set(slideshow, data);
60 elm_hoversel_label_set(obj, data);
64 _start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
66 elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data));
68 elm_object_disabled_set(bt_start, EINA_TRUE);
69 elm_object_disabled_set(bt_stop, EINA_FALSE);
73 _stop(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
75 elm_slideshow_timeout_set(slideshow, 0.0);
76 elm_object_disabled_set(bt_start, EINA_FALSE);
77 elm_object_disabled_set(bt_stop, EINA_TRUE);
81 _spin(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
83 if (elm_slideshow_timeout_get(slideshow) > 0)
84 elm_slideshow_timeout_set(slideshow, elm_spinner_value_get(data));
88 _get(void *data, Evas_Object *obj)
90 //Evas_Object *photo = elm_photocam_add(obj);
91 //elm_photocam_file_set(photo, data);
92 //elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
94 Evas_Object *photo = elm_photo_add(obj);
95 elm_photo_file_set(photo, data);
96 elm_photo_fill_inside_set(photo, EINA_TRUE);
97 elm_object_style_set(photo, "shadow");
105 test_slideshow(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
107 Evas_Object *win, *bg, *notify, *bx, *bt, *hv, *spin;
109 const char *transition, *layout;
111 win = elm_win_add(NULL, "Slideshow", ELM_WIN_BASIC);
112 elm_win_title_set(win, "Slideshow");
113 elm_win_autodel_set(win, 1);
115 bg = elm_bg_add(win);
116 elm_win_resize_object_add(win, bg);
117 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
118 evas_object_show(bg);
120 slideshow = elm_slideshow_add(win);
121 elm_slideshow_loop_set(slideshow, EINA_TRUE);
122 elm_win_resize_object_add(win, slideshow);
123 evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
124 evas_object_show(slideshow);
129 elm_slideshow_item_add(slideshow, &itc, img1);
130 elm_slideshow_item_add(slideshow, &itc, img2);
131 elm_slideshow_item_add(slideshow, &itc, img3);
132 elm_slideshow_item_add(slideshow, &itc, img4);
133 elm_slideshow_item_add(slideshow, &itc, img9);
134 elm_slideshow_item_add(slideshow, &itc, img5);
135 elm_slideshow_item_add(slideshow, &itc, img6);
136 elm_slideshow_item_add(slideshow, &itc, img7);
137 elm_slideshow_item_add(slideshow, &itc, img8);
139 notify = elm_notify_add(win);
140 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
141 elm_win_resize_object_add(win, notify);
142 elm_notify_timeout_set(notify, 3.0);
144 bx = elm_box_add(win);
145 elm_box_horizontal_set(bx, EINA_TRUE);
146 elm_notify_content_set(notify, bx);
147 evas_object_show(bx);
149 evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_IN, _mouse_in,
151 evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_OUT, _mouse_out,
154 bt = elm_button_add(win);
155 elm_button_label_set(bt, "Previous");
156 evas_object_smart_callback_add(bt, "clicked", _previous, slideshow);
157 elm_box_pack_end(bx, bt);
158 evas_object_show(bt);
160 bt = elm_button_add(win);
161 elm_button_label_set(bt, "Next");
162 evas_object_smart_callback_add(bt, "clicked", _next, slideshow);
163 elm_box_pack_end(bx, bt);
164 evas_object_show(bt);
166 hv = elm_hoversel_add(win);
167 elm_box_pack_end(bx, hv);
168 elm_hoversel_hover_parent_set(hv, win);
169 EINA_LIST_FOREACH(elm_slideshow_transitions_get(slideshow), l, transition)
170 elm_hoversel_item_add(hv, transition, NULL, 0, _hv_select, transition);
171 elm_hoversel_label_set(hv, eina_list_data_get(elm_slideshow_transitions_get(slideshow)));
172 evas_object_show(hv);
174 hv = elm_hoversel_add(win);
175 elm_box_pack_end(bx, hv);
176 elm_hoversel_hover_parent_set(hv, win);
177 EINA_LIST_FOREACH(elm_slideshow_layouts_get(slideshow), l, layout)
178 elm_hoversel_item_add(hv, layout, NULL, 0, _layout_select, layout);
179 elm_hoversel_label_set(hv, elm_slideshow_layout_get(slideshow));
180 evas_object_show(hv);
182 spin = elm_spinner_add(win);
183 elm_spinner_label_format_set(spin, "%2.0f secs.");
184 evas_object_smart_callback_add(spin, "changed", _spin, spin);
185 elm_spinner_step_set(spin, 1);
186 elm_spinner_min_max_set(spin, 1, 30);
187 elm_spinner_value_set(spin, 3);
188 elm_box_pack_end(bx, spin);
189 evas_object_show(spin);
191 bt = elm_button_add(win);
193 elm_button_label_set(bt, "Start");
194 evas_object_smart_callback_add(bt, "clicked", _start, spin);
195 elm_box_pack_end(bx, bt);
196 evas_object_show(bt);
198 bt = elm_button_add(win);
200 elm_button_label_set(bt, "Stop");
201 evas_object_smart_callback_add(bt, "clicked", _stop, spin);
202 elm_box_pack_end(bx, bt);
203 elm_object_disabled_set(bt, EINA_TRUE);
204 evas_object_show(bt);
206 evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_UP,
207 _notify_show, notify);
208 evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_MOVE,
209 _notify_show, notify);
211 evas_object_resize(win, 500, 400);
212 evas_object_show(win);