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_object_text_part_set(tg, "on", "Yes");
39 elm_object_text_part_set(tg, "off", "No");
40 elm_box_pack_end(bx, tg);
44 ic = elm_icon_add(win);
45 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
46 elm_icon_file_set(ic, buf, NULL);
47 elm_icon_scale_set(ic, 0, 0);
49 tg = elm_check_add(win);
50 elm_object_style_set(tg, "toggle");
51 elm_object_text_set(tg, "Icon no scale");
52 elm_check_icon_set(tg, ic);
53 elm_box_pack_end(bx, tg);
57 ic = elm_icon_add(win);
58 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
59 elm_icon_file_set(ic, buf, NULL);
60 elm_icon_scale_set(ic, 0, 0);
62 tg = elm_check_add(win);
63 elm_object_style_set(tg, "toggle");
64 elm_object_text_set(tg, "Icon no scale");
65 elm_check_icon_set(tg, ic);
66 elm_object_disabled_set(tg, 1);
67 elm_box_pack_end(bx, tg);
71 tg = elm_check_add(win);
72 elm_object_style_set(tg, "toggle");
73 elm_object_text_set(tg, "Label Only");
74 elm_object_text_part_set(tg, "on", "Big long fun times label");
75 elm_object_text_part_set(tg, "off", "Small long happy fun label");
76 elm_box_pack_end(bx, tg);
79 ic = elm_icon_add(win);
80 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
81 elm_icon_file_set(ic, buf, NULL);
82 elm_icon_scale_set(ic, 0, 0);
84 tg = elm_check_add(win);
85 elm_object_style_set(tg, "toggle");
86 elm_check_icon_set(tg, ic);
87 elm_box_pack_end(bx, tg);
91 evas_object_show(win);