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", elm_app_data_dir_get());
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_check_add(win);
32 elm_object_style_set(tg, "toggle");
33 evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34 evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
35 elm_object_text_set(tg, "Icon sized to toggle");
36 elm_check_icon_set(tg, ic);
37 elm_check_state_set(tg, 1);
38 elm_check_states_labels_set(tg, "Yes", "No");
39 elm_box_pack_end(bx, tg);
43 ic = elm_icon_add(win);
44 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
45 elm_icon_file_set(ic, buf, NULL);
46 elm_icon_scale_set(ic, 0, 0);
48 tg = elm_check_add(win);
49 elm_object_style_set(tg, "toggle");
50 elm_object_text_set(tg, "Icon no scale");
51 elm_check_icon_set(tg, ic);
52 elm_box_pack_end(bx, tg);
56 ic = elm_icon_add(win);
57 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
58 elm_icon_file_set(ic, buf, NULL);
59 elm_icon_scale_set(ic, 0, 0);
61 tg = elm_check_add(win);
62 elm_object_style_set(tg, "toggle");
63 elm_object_text_set(tg, "Icon no scale");
64 elm_check_icon_set(tg, ic);
65 elm_object_disabled_set(tg, 1);
66 elm_box_pack_end(bx, tg);
70 tg = elm_check_add(win);
71 elm_object_style_set(tg, "toggle");
72 elm_object_text_set(tg, "Label Only");
73 elm_check_states_labels_set(tg, "Big long fun times label",
74 "Small long happy fun label");
75 elm_box_pack_end(bx, tg);
78 ic = elm_icon_add(win);
79 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
80 elm_icon_file_set(ic, buf, NULL);
81 elm_icon_scale_set(ic, 0, 0);
83 tg = elm_check_add(win);
84 elm_object_style_set(tg, "toggle");
85 elm_check_icon_set(tg, ic);
86 elm_box_pack_end(bx, tg);
90 evas_object_show(win);