1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _disk_sel(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info)
10 Elm_Diskselector_Item *it = event_info;
11 printf("Equinox: %s\n", elm_diskselector_item_label_get(it));
15 _disk_next(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info)
17 Elm_Diskselector_Item *next, *prev, *it = event_info;
18 prev = elm_diskselector_item_prev_get(it);
19 next = elm_diskselector_item_next_get(it);
20 printf("Prev: %s, Next: %s\n", elm_diskselector_item_label_get(prev),
21 elm_diskselector_item_label_get(next));
25 _print_disk_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
27 Elm_Diskselector_Item *it = event_info;
28 printf("Selected label: %s\n", elm_diskselector_item_label_get(it));
32 _disk_create(Evas_Object *win, Eina_Bool round)
34 Elm_Diskselector_Item *it;
37 di = elm_diskselector_add(win);
39 elm_diskselector_item_append(di, "January", NULL, NULL, NULL);
40 elm_diskselector_item_append(di, "February", NULL, _disk_next, NULL);
41 elm_diskselector_item_append(di, "March", NULL, _disk_sel, NULL);
42 elm_diskselector_item_append(di, "April", NULL, NULL, NULL);
43 elm_diskselector_item_append(di, "May", NULL, NULL, NULL);
44 elm_diskselector_item_append(di, "June", NULL, NULL, NULL);
45 elm_diskselector_item_append(di, "July", NULL, NULL, NULL);
46 it = elm_diskselector_item_append(di, "August", NULL, NULL, NULL);
47 elm_diskselector_item_append(di, "September", NULL, _disk_sel, NULL);
48 elm_diskselector_item_append(di, "October", NULL, NULL, NULL);
49 elm_diskselector_item_append(di, "November", NULL, NULL, NULL);
50 elm_diskselector_item_append(di, "December", NULL, NULL, NULL);
52 elm_diskselector_item_selected_set(it, EINA_TRUE);
53 elm_diskselector_round_set(di, round);
59 test_diskselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
61 Evas_Object *win, *bg, *bx, *disk, *ic;
62 Elm_Diskselector_Item *it;
66 char *month_list[] = {
74 win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC);
75 elm_win_title_set(win, "Disk Selector");
76 elm_win_autodel_set(win, 1);
79 elm_win_resize_object_add(win, bg);
80 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
81 evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
84 bx = elm_box_add(win);
85 elm_win_resize_object_add(win, bx);
86 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
87 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
90 disk = _disk_create(win, EINA_TRUE);
91 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
93 elm_box_pack_end(bx, disk);
94 evas_object_show(disk);
95 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
96 it = elm_diskselector_selected_item_get(disk);
97 elm_diskselector_item_selected_set(it, EINA_FALSE);
99 disk = _disk_create(win, EINA_FALSE);
100 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
101 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
102 elm_box_pack_end(bx, disk);
103 evas_object_show(disk);
104 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
105 it = elm_diskselector_first_item_get(disk);
106 it = elm_diskselector_item_next_get(it);
107 elm_diskselector_item_selected_set(it, EINA_TRUE);
109 disk = _disk_create(win, EINA_FALSE);
110 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
111 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
112 elm_box_pack_end(bx, disk);
113 evas_object_show(disk);
114 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
115 elm_diskselector_side_label_lenght_set(disk, 4);
117 disk = elm_diskselector_add(win);
118 ic = elm_icon_add(win);
119 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
120 elm_icon_file_set(ic, buf, NULL);
121 elm_icon_scale_set(ic, 1, 1);
122 elm_diskselector_item_append(disk, "Sunday", ic, NULL, NULL);
123 elm_diskselector_item_append(disk, "Monday", NULL, NULL, NULL);
124 elm_diskselector_item_append(disk, "Tuesday", NULL, NULL, NULL);
125 elm_diskselector_item_append(disk, "Wednesday", NULL, NULL, NULL);
126 elm_diskselector_item_append(disk, "Thursday", NULL, NULL, NULL);
127 elm_diskselector_item_append(disk, "Friday", NULL, NULL, NULL);
128 elm_diskselector_item_append(disk, "Saturday", NULL, NULL, NULL);
129 elm_diskselector_round_set(disk, EINA_TRUE);
130 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
131 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
132 elm_box_pack_end(bx, disk);
133 evas_object_show(disk);
134 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
136 disk = elm_diskselector_add(win);
137 ic = elm_icon_add(win);
138 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
139 elm_icon_file_set(ic, buf, NULL);
140 elm_icon_scale_set(ic, 1, 1);
141 elm_diskselector_item_append(disk, "머리스타일", ic, NULL, NULL);
142 elm_diskselector_item_append(disk, "プロが伝授する", NULL, NULL, NULL);
143 elm_diskselector_item_append(disk, "生上访要求政府", NULL, NULL, NULL);
144 elm_diskselector_item_append(disk, "English", NULL, NULL, NULL);
145 elm_diskselector_item_append(disk, "والشريعة", NULL, NULL, NULL);
146 elm_diskselector_item_append(disk, "עִבְרִית", NULL, NULL, NULL);
147 elm_diskselector_item_append(disk, "Grüßen", NULL, NULL, NULL);
148 elm_diskselector_round_set(disk, EINA_TRUE);
149 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
150 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
151 elm_box_pack_end(bx, disk);
152 evas_object_show(disk);
153 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
155 // displayed item number setting example
156 disk = elm_diskselector_add(win);
157 elm_diskselector_display_item_num_set(disk, 5);
159 for (idx = 0; idx < (int)(sizeof(month_list) / sizeof(month_list[0])); idx++)
161 it = elm_diskselector_item_append(disk, month_list[idx], NULL, NULL, NULL);
164 elm_diskselector_item_selected_set(it, EINA_TRUE);
165 elm_diskselector_round_set(disk, EINA_TRUE);
166 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
167 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
168 elm_box_pack_end(bx, disk);
169 evas_object_show(disk);
170 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
172 // displayed item number setting example
173 disk = elm_diskselector_add(win);
174 elm_diskselector_display_item_num_set(disk, 7);
176 for (idx = 1; idx < 31; idx++)
178 snprintf(date, sizeof(date), "%d", idx);
179 it = elm_diskselector_item_append(disk, date, NULL, NULL, NULL);
182 elm_diskselector_item_selected_set(it, EINA_TRUE);
183 elm_diskselector_round_set(disk, EINA_TRUE);
184 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
185 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
186 elm_box_pack_end(bx, disk);
187 evas_object_show(disk);
188 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
191 evas_object_resize(win, 320, 480);
192 evas_object_show(win);