1 #include <Elementary.h>
2 #ifndef ELM_LIB_QUICKLAUNCH
4 static Evas_Object *slideshow, *bt_start, *bt_stop;
5 static Elm_Slideshow_Item_Class itc;
6 static char *img1 = PACKAGE_DATA_DIR"/images/logo.png";
7 static char *img2 = PACKAGE_DATA_DIR"/images/plant_01.jpg";
8 static char *img3 = PACKAGE_DATA_DIR"/images/rock_01.jpg";
9 static char *img4 = PACKAGE_DATA_DIR"/images/rock_02.jpg";
10 static char *img5 = PACKAGE_DATA_DIR"/images/sky_01.jpg";
11 static char *img6 = PACKAGE_DATA_DIR"/images/sky_04.jpg";
12 static char *img7 = PACKAGE_DATA_DIR"/images/wood_01.jpg";
13 static char *img8 = PACKAGE_DATA_DIR"/images/mystrale.jpg";
14 static char *img9 = PACKAGE_DATA_DIR"/images/mystrale_2.jpg";
17 _notify_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
19 evas_object_show(data);
20 elm_notify_timer_init(data);
24 _next(void *data, Evas_Object *obj, void *event_info)
26 elm_slideshow_next(data);
30 _previous(void *data, Evas_Object *obj, void *event_info)
32 elm_slideshow_previous(data);
36 _mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
38 elm_notify_timeout_set(data, 0);
43 _mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
45 elm_notify_timeout_set(data, 3);
49 _hv_select(void *data, Evas_Object *obj, void *event_info)
51 elm_slideshow_transition_set(slideshow, data);
52 elm_hoversel_label_set(obj, data);
56 _layout_select(void *data, Evas_Object *obj, void *event_info)
58 elm_slideshow_layout_set(slideshow, data);
59 elm_hoversel_label_set(obj, data);
63 _start(void *data, Evas_Object *obj, void *event_info)
65 elm_slideshow_timeout_set(slideshow, (int)elm_spinner_value_get(data));
67 elm_object_disabled_set(bt_start, 1);
68 elm_object_disabled_set(bt_stop, 0);
72 _stop(void *data, Evas_Object *obj, void *event_info)
74 elm_slideshow_timeout_set(slideshow, 0);
75 elm_object_disabled_set(bt_start, 0);
76 elm_object_disabled_set(bt_stop, 1);
80 _spin(void *data, Evas_Object *obj, void *event_info)
82 if (elm_slideshow_timeout_get(slideshow) > 0)
83 elm_slideshow_timeout_set(slideshow, (int)elm_spinner_value_get(data));
87 _get(void *data, Evas_Object *obj)
89 //Evas_Object *photo = elm_photocam_add(obj);
90 //elm_photocam_file_set(photo, data);
91 //elm_photocam_zoom_mode_set(photo, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
93 Evas_Object *photo = elm_photo_add(obj);
94 elm_photo_file_set(photo, data);
95 elm_photo_fill_inside_set(photo, EINA_TRUE);
96 elm_object_style_set(photo, "shadow");
104 test_slideshow(void *data, Evas_Object *obj, void *event_info)
106 Evas_Object *win, *bg, *notify, *bx, *bt, *hv, *spin;
108 const char *transition, *layout;
110 win = elm_win_add(NULL, "Slideshow", ELM_WIN_BASIC);
111 elm_win_title_set(win, "Slideshow");
112 elm_win_autodel_set(win, 1);
114 bg = elm_bg_add(win);
115 elm_win_resize_object_add(win, bg);
116 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
117 evas_object_show(bg);
119 slideshow = elm_slideshow_add(win);
120 elm_slideshow_loop_set(slideshow, 1);
121 elm_win_resize_object_add(win, slideshow);
122 evas_object_size_hint_weight_set(slideshow, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
123 evas_object_show(slideshow);
128 elm_slideshow_item_add(slideshow, &itc, img1);
129 elm_slideshow_item_add(slideshow, &itc, img2);
130 elm_slideshow_item_add(slideshow, &itc, img3);
131 elm_slideshow_item_add(slideshow, &itc, img4);
132 elm_slideshow_item_add(slideshow, &itc, img9);
133 elm_slideshow_item_add(slideshow, &itc, img5);
134 elm_slideshow_item_add(slideshow, &itc, img6);
135 elm_slideshow_item_add(slideshow, &itc, img7);
136 elm_slideshow_item_add(slideshow, &itc, img8);
138 notify = elm_notify_add(win);
139 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
140 elm_win_resize_object_add(win, notify);
141 elm_notify_timeout_set(notify, 3);
143 bx = elm_box_add(win);
144 elm_box_horizontal_set(bx, 1);
145 elm_notify_content_set(notify, bx);
146 evas_object_show(bx);
148 evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_IN, _mouse_in, notify);
149 evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, notify);
151 bt = elm_button_add(win);
152 elm_button_label_set(bt, "Previous");
153 evas_object_smart_callback_add(bt, "clicked", _previous, slideshow);
154 elm_box_pack_end(bx, bt);
155 evas_object_show(bt);
157 bt = elm_button_add(win);
158 elm_button_label_set(bt, "Next");
159 evas_object_smart_callback_add(bt, "clicked", _next, slideshow);
160 elm_box_pack_end(bx, bt);
161 evas_object_show(bt);
163 hv = elm_hoversel_add(win);
164 elm_box_pack_end(bx, hv);
165 elm_hoversel_hover_parent_set(hv, win);
166 EINA_LIST_FOREACH(elm_slideshow_transitions_get(slideshow), l, transition)
167 elm_hoversel_item_add(hv, transition, NULL, 0, _hv_select, transition);
168 elm_hoversel_label_set(hv, eina_list_data_get(elm_slideshow_transitions_get(slideshow)));
169 evas_object_show(hv);
171 hv = elm_hoversel_add(win);
172 elm_box_pack_end(bx, hv);
173 elm_hoversel_hover_parent_set(hv, win);
174 EINA_LIST_FOREACH(elm_slideshow_layouts_get(slideshow), l, layout)
175 elm_hoversel_item_add(hv, layout, NULL, 0, _layout_select, layout);
176 elm_hoversel_label_set(hv, elm_slideshow_layout_get(slideshow));
177 evas_object_show(hv);
179 spin = elm_spinner_add(win);
180 elm_spinner_label_format_set(spin, "%2.0f secs.");
181 evas_object_smart_callback_add(spin, "changed", _spin, spin);
182 elm_spinner_step_set(spin, 1);
183 elm_spinner_min_max_set(spin, 1, 30);
184 elm_spinner_value_set(spin, 3);
185 elm_box_pack_end(bx, spin);
186 evas_object_show(spin);
188 bt = elm_button_add(win);
190 elm_button_label_set(bt, "Start");
191 evas_object_smart_callback_add(bt, "clicked", _start, spin);
192 elm_box_pack_end(bx, bt);
193 evas_object_show(bt);
195 bt = elm_button_add(win);
197 elm_button_label_set(bt, "Stop");
198 evas_object_smart_callback_add(bt, "clicked", _stop, spin);
199 elm_box_pack_end(bx, bt);
200 elm_object_disabled_set(bt, 1);
201 evas_object_show(bt);
204 evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_UP, _notify_show, notify);
205 evas_object_event_callback_add(slideshow, EVAS_CALLBACK_MOUSE_MOVE, _notify_show, notify);
207 evas_object_resize(win, 500, 400);
208 evas_object_show(win);