1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 test_toggle(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
9 Evas_Object *win, *bg, *bx, *ic, *tg;
12 win = elm_win_add(NULL, "toggles", ELM_WIN_BASIC);
13 elm_win_title_set(win, "Toggles");
14 elm_win_autodel_set(win, EINA_TRUE);
17 elm_win_resize_object_add(win, bg);
18 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
21 bx = elm_box_add(win);
22 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
23 elm_win_resize_object_add(win, bx);
26 ic = elm_icon_add(win);
27 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
28 elm_icon_file_set(ic, buf, NULL);
29 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
31 tg = elm_toggle_add(win);
32 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
33 evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
34 elm_object_text_set(tg, "Icon sized to toggle");
35 elm_toggle_icon_set(tg, ic);
36 elm_toggle_state_set(tg, 1);
37 elm_toggle_states_labels_set(tg, "Yes", "No");
38 elm_box_pack_end(bx, tg);
42 ic = elm_icon_add(win);
43 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
44 elm_icon_file_set(ic, buf, NULL);
45 elm_icon_scale_set(ic, 0, 0);
47 tg = elm_toggle_add(win);
48 elm_object_text_set(tg, "Icon no scale");
49 elm_toggle_icon_set(tg, ic);
50 elm_box_pack_end(bx, tg);
54 ic = elm_icon_add(win);
55 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
56 elm_icon_file_set(ic, buf, NULL);
57 elm_icon_scale_set(ic, 0, 0);
59 tg = elm_toggle_add(win);
60 elm_object_text_set(tg, "Icon no scale");
61 elm_toggle_icon_set(tg, ic);
62 elm_object_disabled_set(tg, 1);
63 elm_box_pack_end(bx, tg);
67 tg = elm_toggle_add(win);
68 elm_object_text_set(tg, "Label Only");
69 elm_toggle_states_labels_set(tg, "Big long fun times label",
70 "Small long happy fun label");
71 elm_box_pack_end(bx, tg);
74 ic = elm_icon_add(win);
75 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
76 elm_icon_file_set(ic, buf, NULL);
77 elm_icon_scale_set(ic, 0, 0);
79 tg = elm_toggle_add(win);
80 elm_toggle_icon_set(tg, ic);
81 elm_box_pack_end(bx, tg);
85 evas_object_show(win);