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_Object_Item *ds_it = event_info;
11 printf("Equinox: %s\n", elm_diskselector_item_label_get(ds_it));
15 _disk_next(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info)
17 Elm_Object_Item *next_ds_it, *prev_ds_it, *ds_it = event_info;
18 prev_ds_it = elm_diskselector_item_prev_get(ds_it);
19 next_ds_it = elm_diskselector_item_next_get(ds_it);
20 printf("Prev: %s, Next: %s\n",
21 elm_diskselector_item_label_get(prev_ds_it),
22 elm_diskselector_item_label_get(next_ds_it));
26 _print_disk_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
28 Elm_Object_Item *ds_it = event_info;
29 printf("Selected label: %s\n", elm_diskselector_item_label_get(ds_it));
33 _disk_create(Evas_Object *win, Eina_Bool round)
35 Elm_Object_Item *ds_it;
38 di = elm_diskselector_add(win);
40 elm_diskselector_item_append(di, "January", NULL, NULL, NULL);
41 elm_diskselector_item_append(di, "February", NULL, _disk_next, NULL);
42 elm_diskselector_item_append(di, "March", NULL, _disk_sel, NULL);
43 elm_diskselector_item_append(di, "April", NULL, NULL, NULL);
44 elm_diskselector_item_append(di, "May", NULL, NULL, NULL);
45 elm_diskselector_item_append(di, "June", NULL, NULL, NULL);
46 elm_diskselector_item_append(di, "July", NULL, NULL, NULL);
47 ds_it = elm_diskselector_item_append(di, "August", NULL, NULL, NULL);
48 elm_diskselector_item_append(di, "September", NULL, _disk_sel, NULL);
49 elm_diskselector_item_append(di, "October", NULL, NULL, NULL);
50 elm_diskselector_item_append(di, "November", NULL, NULL, NULL);
51 elm_diskselector_item_append(di, "December", NULL, NULL, NULL);
53 elm_diskselector_item_selected_set(ds_it, EINA_TRUE);
54 elm_diskselector_round_set(di, round);
60 test_diskselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
62 Evas_Object *win, *bg, *bx, *disk, *ic;
63 Elm_Object_Item *ds_it;
67 char *month_list[] = {
75 win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC);
76 elm_win_title_set(win, "Disk Selector");
77 elm_win_autodel_set(win, EINA_TRUE);
80 elm_win_resize_object_add(win, bg);
81 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
85 bx = elm_box_add(win);
86 elm_win_resize_object_add(win, bx);
87 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
88 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
91 disk = _disk_create(win, EINA_TRUE);
92 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
94 elm_box_pack_end(bx, disk);
95 evas_object_show(disk);
96 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
97 ds_it = elm_diskselector_selected_item_get(disk);
98 elm_diskselector_item_selected_set(ds_it, EINA_FALSE);
100 disk = _disk_create(win, EINA_FALSE);
101 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
102 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
103 elm_box_pack_end(bx, disk);
104 evas_object_show(disk);
105 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
106 ds_it = elm_diskselector_first_item_get(disk);
107 ds_it = elm_diskselector_item_next_get(ds_it);
108 elm_diskselector_item_selected_set(ds_it, EINA_TRUE);
110 disk = _disk_create(win, EINA_FALSE);
111 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
112 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
113 elm_box_pack_end(bx, disk);
114 evas_object_show(disk);
115 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
116 elm_diskselector_side_label_length_set(disk, 4);
118 disk = elm_diskselector_add(win);
119 ic = elm_icon_add(win);
120 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
121 elm_icon_file_set(ic, buf, NULL);
122 elm_icon_scale_set(ic, 1, 1);
123 elm_diskselector_item_append(disk, "Sunday", ic, NULL, NULL);
124 elm_diskselector_item_append(disk, "Monday", NULL, NULL, NULL);
125 elm_diskselector_item_append(disk, "Tuesday", NULL, NULL, NULL);
126 elm_diskselector_item_append(disk, "Wednesday", NULL, NULL, NULL);
127 elm_diskselector_item_append(disk, "Thursday", NULL, NULL, NULL);
128 elm_diskselector_item_append(disk, "Friday", NULL, NULL, NULL);
129 elm_diskselector_item_append(disk, "Saturday", NULL, NULL, NULL);
130 elm_diskselector_round_set(disk, EINA_TRUE);
131 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
132 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
133 elm_box_pack_end(bx, disk);
134 evas_object_show(disk);
135 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
137 disk = elm_diskselector_add(win);
138 ic = elm_icon_add(win);
139 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
140 elm_icon_file_set(ic, buf, NULL);
141 elm_icon_scale_set(ic, 1, 1);
142 elm_diskselector_item_append(disk, "머리스타일", ic, NULL, NULL);
143 elm_diskselector_item_append(disk, "プロが伝授する", NULL, NULL, NULL);
144 elm_diskselector_item_append(disk, "生上访要求政府", NULL, NULL, NULL);
145 elm_diskselector_item_append(disk, "English", NULL, NULL, NULL);
146 elm_diskselector_item_append(disk, "والشريعة", NULL, NULL, NULL);
147 elm_diskselector_item_append(disk, "עִבְרִית", NULL, NULL, NULL);
148 elm_diskselector_item_append(disk, "Grüßen", NULL, NULL, NULL);
149 elm_diskselector_round_set(disk, EINA_TRUE);
150 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
151 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
152 elm_box_pack_end(bx, disk);
153 evas_object_show(disk);
154 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
156 // displayed item number setting example
157 disk = elm_diskselector_add(win);
158 elm_diskselector_display_item_num_set(disk, 5);
159 printf("Number of Items in DiskSelector : %d\n",
160 elm_diskselector_display_item_num_get(disk));
162 for (idx = 0; idx < (int)(sizeof(month_list) / sizeof(month_list[0])); idx++)
164 ds_it = elm_diskselector_item_append(disk, month_list[idx], NULL, NULL,
168 elm_diskselector_item_selected_set(ds_it, EINA_TRUE);
169 elm_diskselector_round_set(disk, EINA_TRUE);
170 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
171 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
172 elm_box_pack_end(bx, disk);
173 evas_object_show(disk);
174 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
176 // displayed item number setting example
177 disk = elm_diskselector_add(win);
178 elm_diskselector_display_item_num_set(disk, 7);
179 printf("Number of Items in DiskSelector : %d\n",
180 elm_diskselector_display_item_num_get(disk));
182 for (idx = 1; idx < 31; idx++)
184 snprintf(date, sizeof(date), "%d", idx);
185 ds_it = elm_diskselector_item_append(disk, date, NULL, NULL, NULL);
188 elm_diskselector_item_selected_set(ds_it, EINA_TRUE);
189 elm_diskselector_round_set(disk, EINA_TRUE);
190 evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
191 evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
192 elm_box_pack_end(bx, disk);
193 evas_object_show(disk);
194 evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
196 evas_object_resize(win, 320, 480);
197 evas_object_show(win);