e692badd1fcd1b38afa5fbe47968271b7e9e4446
[framework/uifw/elementary.git] / src / bin / test_radio.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 void
7 test_radio(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    Evas_Object *win, *bg, *bx, *ic, *rd, *rdg;
10    char buf[PATH_MAX];
11
12    win = elm_win_add(NULL, "radios", ELM_WIN_BASIC);
13    elm_win_title_set(win, "Radios");
14    elm_win_autodel_set(win, EINA_TRUE);
15
16    bg = elm_bg_add(win);
17    elm_win_resize_object_add(win, bg);
18    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
19    evas_object_show(bg);
20
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);
24    evas_object_show(bx);
25
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);
30
31    rd = elm_radio_add(win);
32    elm_radio_state_value_set(rd, 0);
33    evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34    evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
35    elm_object_text_set(rd, "Icon sized to radio");
36    elm_object_part_content_set(rd, "icon", ic);
37    elm_box_pack_end(bx, rd);
38    evas_object_show(rd);
39    evas_object_show(ic);
40    rdg = rd;
41
42    ic = elm_icon_add(win);
43    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
44    elm_icon_file_set(ic, buf, NULL);
45    elm_icon_scale_set(ic, 0, 0);
46
47    rd = elm_radio_add(win);
48    elm_radio_state_value_set(rd, 1);
49    elm_radio_group_add(rd, rdg);
50    elm_object_text_set(rd, "Icon no scale");
51    elm_object_part_content_set(rd, "icon", ic);
52    elm_box_pack_end(bx, rd);
53    evas_object_show(rd);
54    evas_object_show(ic);
55
56    rd = elm_radio_add(win);
57    elm_radio_state_value_set(rd, 2);
58    elm_radio_group_add(rd, rdg);
59    elm_object_text_set(rd, "Label Only");
60    elm_box_pack_end(bx, rd);
61    evas_object_show(rd);
62
63    rd = elm_radio_add(win);
64    elm_radio_state_value_set(rd, 3);
65    elm_radio_group_add(rd, rdg);
66    elm_object_text_set(rd, "Disabled");
67    elm_object_disabled_set(rd, EINA_TRUE);
68    elm_box_pack_end(bx, rd);
69    evas_object_show(rd);
70
71    ic = elm_icon_add(win);
72    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
73    elm_icon_file_set(ic, buf, NULL);
74    elm_icon_scale_set(ic, 0, 0);
75
76    rd = elm_radio_add(win);
77    elm_radio_state_value_set(rd, 4);
78    elm_radio_group_add(rd, rdg);
79    elm_object_part_content_set(rd, "icon", ic);
80    elm_box_pack_end(bx, rd);
81    evas_object_show(rd);
82    evas_object_show(ic);
83
84    ic = elm_icon_add(win);
85    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
86    elm_icon_file_set(ic, buf, NULL);
87    elm_icon_scale_set(ic, 0, 0);
88
89    rd = elm_radio_add(win);
90    elm_radio_state_value_set(rd, 5);
91    elm_radio_group_add(rd, rdg);
92    elm_object_part_content_set(rd, "icon", ic);
93    elm_object_disabled_set(rd, EINA_TRUE);
94    elm_box_pack_end(bx, rd);
95    evas_object_show(rd);
96    evas_object_show(ic);
97
98    elm_radio_value_set(rdg, 2);
99
100    evas_object_show(win);
101 }
102 #endif