1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
6 typedef struct _Testitem
8 Elm_Genlist_Item *item;
12 static int rotate_with_resize = 0;
15 my_bt_38_alpha_on(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
17 Evas_Object *win = data;
18 Evas_Object *bg = evas_object_data_get(win, "bg");
20 elm_win_alpha_set(win, EINA_TRUE);
24 my_bt_38_alpha_off(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
26 Evas_Object *win = data;
27 Evas_Object *bg = evas_object_data_get(win, "bg");
29 elm_win_alpha_set(win, EINA_FALSE);
33 my_ck_38_resize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
35 // Evas_Object *win = data;
36 rotate_with_resize = elm_check_state_get(obj);
40 my_bt_38_rot_0(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
42 Evas_Object *win = data;
43 if (rotate_with_resize)
44 elm_win_rotation_with_resize_set(win, 0);
46 elm_win_rotation_set(win, 0);
50 my_bt_38_rot_90(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
52 Evas_Object *win = data;
53 if (rotate_with_resize)
54 elm_win_rotation_with_resize_set(win, 90);
56 elm_win_rotation_set(win, 90);
60 my_bt_38_rot_180(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
62 Evas_Object *win = data;
63 if (rotate_with_resize)
64 elm_win_rotation_with_resize_set(win, 180);
66 elm_win_rotation_set(win, 180);
70 my_bt_38_rot_270(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
72 Evas_Object *win = data;
73 if (rotate_with_resize)
74 elm_win_rotation_with_resize_set(win, 270);
76 elm_win_rotation_set(win, 270);
80 my_win_move(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
83 elm_win_screen_position_get(obj, &x, &y);
84 printf("MOVE - win geom: %4i %4i\n", x, y);
88 _win_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
91 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
92 printf("RESIZE - win geom: %4ix%4i\n", w, h);
96 _win_foc_in(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info __UNUSED__)
102 _win_foc_out(void *data __UNUSED__, Evas *e __UNUSED__, void *event_info __UNUSED__)
108 _close_win(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
110 evas_object_del(data);
114 test_win_state(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
116 Evas_Object *win, *bg, *sl, *bx, *bx2, *bt, *ck;
118 win = elm_win_add(NULL, "window-states", ELM_WIN_BASIC);
119 elm_win_title_set(win, "Window States");
120 evas_object_smart_callback_add(win, "moved", my_win_move, NULL);
121 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _win_resize, NULL);
122 evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_FOCUS_IN, _win_foc_in, NULL);
123 evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_CANVAS_FOCUS_OUT, _win_foc_out, NULL);
124 elm_win_autodel_set(win, EINA_TRUE);
126 bg = elm_bg_add(win);
127 elm_win_resize_object_add(win, bg);
128 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
129 evas_object_show(bg);
130 evas_object_data_set(win, "bg", bg);
132 bx = elm_box_add(win);
133 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
134 elm_win_resize_object_add(win, bx);
135 evas_object_show(bx);
137 bx2 = elm_box_add(win);
138 elm_box_horizontal_set(bx2, EINA_TRUE);
139 elm_box_homogeneous_set(bx2, EINA_TRUE);
140 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
141 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
143 bt = elm_button_add(win);
144 elm_object_text_set(bt, "Alpha On");
145 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_on, win);
146 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
147 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
148 elm_box_pack_end(bx2, bt);
149 evas_object_show(bt);
151 bt = elm_button_add(win);
152 elm_object_text_set(bt, "Alpha Off");
153 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_off, win);
154 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
155 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
156 elm_box_pack_end(bx2, bt);
157 evas_object_show(bt);
159 elm_box_pack_end(bx, bx2);
160 evas_object_show(bx2);
162 bx2 = elm_box_add(win);
163 elm_box_horizontal_set(bx2, EINA_TRUE);
164 elm_box_homogeneous_set(bx2, EINA_TRUE);
165 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
166 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
168 sl = elm_slider_add(win);
169 elm_object_text_set(sl, "Test");
170 elm_slider_span_size_set(sl, 100);
171 evas_object_size_hint_align_set(sl, 0.5, 0.5);
172 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
173 elm_slider_indicator_format_set(sl, "%3.0f");
174 elm_slider_min_max_set(sl, 50, 150);
175 elm_slider_value_set(sl, 50);
176 elm_slider_inverted_set(sl, 1);
177 elm_box_pack_end(bx2, sl);
178 evas_object_show(sl);
180 elm_box_pack_end(bx, bx2);
181 evas_object_show(bx2);
183 ck = elm_check_add(win);
184 elm_object_text_set(ck, "resize");
185 elm_check_state_set(ck, rotate_with_resize);
186 evas_object_smart_callback_add(ck, "changed", my_ck_38_resize, win);
187 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
188 evas_object_size_hint_align_set(ck, 0.02, 0.99);
189 evas_object_show(ck);
190 elm_box_pack_end(bx, ck);
192 bx2 = elm_box_add(win);
193 elm_box_horizontal_set(bx2, EINA_TRUE);
194 elm_box_homogeneous_set(bx2, EINA_TRUE);
195 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
196 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
198 bt = elm_button_add(win);
199 elm_object_text_set(bt, "Rot 0");
200 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_0, win);
201 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
202 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
203 elm_box_pack_end(bx2, bt);
204 evas_object_show(bt);
206 bt = elm_button_add(win);
207 elm_object_text_set(bt, "Rot 90");
208 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_90, win);
209 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
210 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
211 elm_box_pack_end(bx2, bt);
212 evas_object_show(bt);
214 bt = elm_button_add(win);
215 elm_object_text_set(bt, "Rot 180");
216 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_180, win);
217 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
218 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
219 elm_box_pack_end(bx2, bt);
220 evas_object_show(bt);
222 bt = elm_button_add(win);
223 elm_object_text_set(bt, "Rot 270");
224 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_270, win);
225 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
226 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
227 elm_box_pack_end(bx2, bt);
228 evas_object_show(bt);
230 elm_box_pack_end(bx, bx2);
231 evas_object_show(bx2);
233 evas_object_resize(win, 280, 400);
234 evas_object_show(win);
238 test_win_state2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
240 Evas_Object *win, *bg, *sl, *bx, *bx2, *bt, *ck;
243 win = elm_win_add(NULL, "window-states2", ELM_WIN_BASIC);
244 elm_win_override_set(win, 1);
245 evas_object_smart_callback_add(win, "moved", my_win_move, NULL);
246 evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _win_resize, NULL);
247 elm_win_title_set(win, "Window States 2");
248 elm_win_autodel_set(win, EINA_TRUE);
250 bg = elm_bg_add(win);
251 snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", elm_app_data_dir_get());
252 elm_bg_file_set(bg, buf, NULL);
253 elm_win_resize_object_add(win, bg);
254 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
255 evas_object_show(bg);
256 evas_object_data_set(win, "bg", bg);
258 bx = elm_box_add(win);
259 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
260 elm_win_resize_object_add(win, bx);
261 evas_object_show(bx);
263 bx2 = elm_box_add(win);
264 elm_box_horizontal_set(bx2, EINA_TRUE);
265 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
266 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
268 bt = elm_button_add(win);
269 elm_object_text_set(bt, "Alpha On");
270 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_on, win);
271 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
272 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
273 elm_box_pack_end(bx2, bt);
274 evas_object_show(bt);
276 bt = elm_button_add(win);
277 elm_object_text_set(bt, "Alpha Off");
278 evas_object_smart_callback_add(bt, "clicked", my_bt_38_alpha_off, win);
279 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
280 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
281 elm_box_pack_end(bx2, bt);
282 evas_object_show(bt);
284 bt = elm_button_add(win);
285 elm_object_text_set(bt, "Close");
286 evas_object_smart_callback_add(bt, "clicked", _close_win, win);
287 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
288 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
289 elm_box_pack_end(bx2, bt);
290 evas_object_show(bt);
292 elm_box_pack_end(bx, bx2);
293 evas_object_show(bx2);
295 bx2 = elm_box_add(win);
296 elm_box_horizontal_set(bx2, EINA_TRUE);
297 elm_box_homogeneous_set(bx2, EINA_TRUE);
298 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
299 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
301 sl = elm_slider_add(win);
302 elm_object_text_set(sl, "Override Redirect");
303 elm_slider_span_size_set(sl, 100);
304 evas_object_size_hint_align_set(sl, 0.5, 0.5);
305 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
306 elm_slider_indicator_format_set(sl, "%3.0f");
307 elm_slider_min_max_set(sl, 50, 150);
308 elm_slider_value_set(sl, 50);
309 elm_slider_inverted_set(sl, 1);
310 elm_box_pack_end(bx2, sl);
311 evas_object_show(sl);
313 elm_box_pack_end(bx, bx2);
314 evas_object_show(bx2);
316 ck = elm_check_add(win);
317 elm_object_text_set(ck, "resize");
318 elm_check_state_set(ck, rotate_with_resize);
319 evas_object_smart_callback_add(ck, "changed", my_ck_38_resize, win);
320 evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
321 evas_object_size_hint_align_set(ck, 0.02, 0.99);
322 evas_object_show(ck);
323 elm_box_pack_end(bx, ck);
325 bx2 = elm_box_add(win);
326 elm_box_horizontal_set(bx2, EINA_TRUE);
327 elm_box_homogeneous_set(bx2, EINA_TRUE);
328 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
329 evas_object_size_hint_fill_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
331 bt = elm_button_add(win);
332 elm_object_text_set(bt, "Rot 0");
333 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_0, win);
334 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
335 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
336 elm_box_pack_end(bx2, bt);
337 evas_object_show(bt);
339 bt = elm_button_add(win);
340 elm_object_text_set(bt, "Rot 90");
341 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_90, win);
342 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
343 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
344 elm_box_pack_end(bx2, bt);
345 evas_object_show(bt);
347 bt = elm_button_add(win);
348 elm_object_text_set(bt, "Rot 180");
349 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_180, win);
350 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
351 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
352 elm_box_pack_end(bx2, bt);
353 evas_object_show(bt);
355 bt = elm_button_add(win);
356 elm_object_text_set(bt, "Rot 270");
357 evas_object_smart_callback_add(bt, "clicked", my_bt_38_rot_270, win);
358 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
359 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
360 elm_box_pack_end(bx2, bt);
361 evas_object_show(bt);
363 elm_box_pack_end(bx, bx2);
364 evas_object_show(bx2);
366 evas_object_resize(win, 320, 480);
367 evas_object_show(win);