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, 1);
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_object_content_set(tg, ic);
36 elm_check_state_set(tg, 1);
37 elm_object_text_part_set(tg, "on", "Yes");
38 elm_object_text_part_set(tg, "off", "No");
39 elm_box_pack_end(bx, tg);
43 ic = elm_icon_add(win);
44 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
45 elm_icon_file_set(ic, buf, NULL);
46 elm_icon_scale_set(ic, 0, 0);
48 tg = elm_toggle_add(win);
49 elm_object_text_set(tg, "Icon no scale");
50 elm_object_content_set(tg, ic);
51 elm_box_pack_end(bx, tg);
55 ic = elm_icon_add(win);
56 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
57 elm_icon_file_set(ic, buf, NULL);
58 elm_icon_scale_set(ic, 0, 0);
60 tg = elm_toggle_add(win);
61 elm_object_text_set(tg, "Icon no scale");
62 elm_object_content_set(tg, ic);
63 elm_object_disabled_set(tg, 1);
64 elm_box_pack_end(bx, tg);
68 tg = elm_toggle_add(win);
69 elm_object_text_set(tg, "Label Only");
70 elm_toggle_states_labels_set(tg, "Big long fun times label",
71 "Small long happy fun label");
72 elm_box_pack_end(bx, tg);
75 ic = elm_icon_add(win);
76 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
77 elm_icon_file_set(ic, buf, NULL);
78 elm_icon_scale_set(ic, 0, 0);
80 tg = elm_check_add(win);
81 elm_object_style_set(tg, "toggle");
82 elm_object_content_set(tg, ic);
83 elm_box_pack_end(bx, tg);
87 evas_object_show(win);