1c822eabd8bd663cc07c10eb1f3843d0fde322d8
[framework/uifw/elementary.git] / src / bin / test_radio.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4 #include <Elementary.h>
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, *bx, *ic, *rd, *rdg;
10    char buf[PATH_MAX];
11
12    win = elm_win_util_standard_add("radios", "Radios");
13    elm_win_autodel_set(win, EINA_TRUE);
14
15    bx = elm_box_add(win);
16    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
17    elm_win_resize_object_add(win, bx);
18    evas_object_show(bx);
19
20    ic = elm_icon_add(win);
21    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
22    elm_icon_file_set(ic, buf, NULL);
23    evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
24
25    rd = elm_radio_add(win);
26    elm_radio_state_value_set(rd, 0);
27    evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
28    evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
29    elm_object_text_set(rd, "Icon sized to radio");
30    elm_object_part_content_set(rd, "icon", ic);
31    elm_box_pack_end(bx, rd);
32    evas_object_show(rd);
33    evas_object_show(ic);
34    rdg = rd;
35
36    ic = elm_icon_add(win);
37    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
38    elm_icon_file_set(ic, buf, NULL);
39    elm_icon_resizable_set(ic, 0, 0);
40
41    rd = elm_radio_add(win);
42    elm_radio_state_value_set(rd, 1);
43    elm_radio_group_add(rd, rdg);
44    elm_object_text_set(rd, "Icon no scale");
45    elm_object_part_content_set(rd, "icon", ic);
46    elm_box_pack_end(bx, rd);
47    evas_object_show(rd);
48    evas_object_show(ic);
49
50    rd = elm_radio_add(win);
51    elm_radio_state_value_set(rd, 2);
52    elm_radio_group_add(rd, rdg);
53    elm_object_text_set(rd, "Label Only");
54    elm_box_pack_end(bx, rd);
55    evas_object_show(rd);
56
57    rd = elm_radio_add(win);
58    elm_radio_state_value_set(rd, 3);
59    elm_radio_group_add(rd, rdg);
60    elm_object_text_set(rd, "Disabled");
61    elm_object_disabled_set(rd, EINA_TRUE);
62    elm_box_pack_end(bx, rd);
63    evas_object_show(rd);
64
65    ic = elm_icon_add(win);
66    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
67    elm_icon_file_set(ic, buf, NULL);
68    elm_icon_resizable_set(ic, 0, 0);
69
70    rd = elm_radio_add(win);
71    elm_radio_state_value_set(rd, 4);
72    elm_radio_group_add(rd, rdg);
73    elm_object_part_content_set(rd, "icon", ic);
74    elm_box_pack_end(bx, rd);
75    evas_object_show(rd);
76    evas_object_show(ic);
77
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_resizable_set(ic, 0, 0);
82
83    rd = elm_radio_add(win);
84    elm_radio_state_value_set(rd, 5);
85    elm_radio_group_add(rd, rdg);
86    elm_object_part_content_set(rd, "icon", ic);
87    elm_object_disabled_set(rd, EINA_TRUE);
88    elm_box_pack_end(bx, rd);
89    evas_object_show(rd);
90    evas_object_show(ic);
91
92    elm_radio_value_set(rdg, 2);
93
94    evas_object_show(win);
95 }
96 #endif