2 # include "elementary_config.h"
5 #include <Elementary.h>
6 #ifndef ELM_LIB_QUICKLAUNCH
9 unsigned int state; /* What state we are testing */
10 Evas_Object *box; /* Used in set_api_state */
12 typedef struct _api_data api_data;
25 typedef enum _api_state api_state;
28 set_api_state(api_data *api)
30 const Eina_List *items = elm_box_children_get(api->box);
31 Evas_Object *ck = eina_list_nth(items, 0);
32 if (!eina_list_count(items))
35 /* use elm_box_children_get() to get list of children */
37 { /* Put all api-changes under switch */
39 elm_clock_show_seconds_set(ck, EINA_FALSE);
42 case CLOCK_SHOW_AM_PM:
43 elm_clock_show_am_pm_set(ck, EINA_TRUE);
47 elm_clock_show_seconds_set(ck, EINA_TRUE);
51 elm_clock_edit_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT);
55 elm_clock_edit_set(ck, ELM_CLOCK_EDIT_DEFAULT);
56 elm_clock_edit_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT);
60 elm_clock_edit_set(ck, ELM_CLOCK_EDIT_ALL);
63 case CLOCK_EDIT_ALL_ARMY:
64 elm_clock_show_am_pm_set(ck, EINA_FALSE);
76 _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
77 { /* Will add here a SWITCH command containing code to modify test-object */
78 /* in accordance a->state value. */
82 printf("clicked event on API Button: api_state=<%d>\n", a->state);
85 sprintf(str, "Next API function (%u)", a->state);
86 elm_object_text_set(obj, str);
87 elm_object_disabled_set(obj, a->state == API_STATE_LAST);
91 _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
97 test_clock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
99 Evas_Object *win, *bx, *ck, *bt, *bxx;
100 unsigned int digedit;
101 api_data *api = calloc(1, sizeof(api_data));
103 win = elm_win_util_standard_add("clock", "Clock");
104 elm_win_autodel_set(win, EINA_TRUE);
105 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
107 bxx = elm_box_add(win);
108 elm_win_resize_object_add(win, bxx);
109 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
110 evas_object_show(bxx);
112 bx = elm_box_add(bxx);
113 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
115 evas_object_show(bx);
117 bt = elm_button_add(bxx);
118 elm_object_text_set(bt, "Next API function");
119 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
120 elm_box_pack_end(bxx, bt);
121 elm_object_disabled_set(bt, EINA_TRUE);
122 evas_object_show(bt);
124 elm_box_pack_end(bxx, bx);
126 ck = elm_clock_add(bx);
127 elm_box_pack_end(bx, ck);
128 evas_object_show(ck);
130 ck = elm_clock_add(bx);
131 elm_clock_show_am_pm_set(ck, EINA_TRUE);
132 elm_box_pack_end(bx, ck);
133 elm_clock_time_set(ck, 17, 25, 0);
134 evas_object_show(ck);
136 ck = elm_clock_add(bx);
137 elm_clock_show_seconds_set(ck, EINA_TRUE);
138 elm_box_pack_end(bx, ck);
139 evas_object_show(ck);
141 ck = elm_clock_add(bx);
142 elm_clock_show_seconds_set(ck, EINA_TRUE);
143 elm_clock_show_am_pm_set(ck, EINA_TRUE);
144 elm_box_pack_end(bx, ck);
145 elm_clock_time_set(ck, 11, 59, 57);
146 evas_object_show(ck);
148 ck = elm_clock_add(bx);
149 elm_clock_show_seconds_set(ck, EINA_TRUE);
150 elm_clock_show_am_pm_set(ck, EINA_FALSE);
151 elm_clock_time_set(ck, 23, 59, 57);
152 elm_box_pack_end(bx, ck);
153 evas_object_show(ck);
155 ck = elm_clock_add(bx);
156 elm_clock_edit_set(ck, EINA_TRUE);
157 elm_clock_show_seconds_set(ck, EINA_TRUE);
158 elm_clock_show_am_pm_set(ck, EINA_TRUE);
159 elm_clock_time_set(ck, 10, 11, 12);
160 elm_box_pack_end(bx, ck);
161 evas_object_show(ck);
163 ck = elm_clock_add(bx);
164 elm_clock_show_seconds_set(ck, EINA_TRUE);
165 elm_clock_edit_set(ck, EINA_TRUE);
166 digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
167 elm_clock_edit_mode_set(ck, digedit);
168 elm_box_pack_end(bx, ck);
169 elm_clock_time_set(ck, 0, 0, 0);
170 evas_object_show(ck);
172 evas_object_show(win);
176 _edit_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
178 Evas_Object *ck = data;
180 if (!elm_clock_edit_get(ck))
182 elm_object_text_set(obj, "Done");
183 elm_clock_edit_set(ck, EINA_TRUE);
186 elm_object_text_set(obj, "Edit");
187 elm_clock_edit_set(ck, EINA_FALSE);
191 _hmode_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
193 Evas_Object *ck = data;
195 if (!elm_clock_show_am_pm_get(ck))
197 elm_object_text_set(obj, "24h");
198 elm_clock_show_am_pm_set(ck, EINA_TRUE);
201 elm_object_text_set(obj, "12h");
202 elm_clock_show_am_pm_set(ck, EINA_FALSE);
206 test_clock2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
208 Evas_Object *win, *bx, *hbx, *ck, *bt, *bxx;
209 api_data *api = calloc(1, sizeof(api_data));
211 win = elm_win_util_standard_add("clock2", "Clock 2");
212 elm_win_autodel_set(win, EINA_TRUE);
213 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
215 bxx = elm_box_add(win);
216 elm_win_resize_object_add(win, bxx);
217 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
218 evas_object_show(bxx);
220 bx = elm_box_add(bxx);
221 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
223 evas_object_show(bx);
225 bt = elm_button_add(bxx);
226 elm_object_text_set(bt, "Next API function");
227 evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
228 elm_box_pack_end(bxx, bt);
229 elm_object_disabled_set(bt, api->state == API_STATE_LAST);
230 evas_object_show(bt);
232 elm_box_pack_end(bxx, bx);
234 ck = elm_clock_add(bx);
235 elm_clock_time_set(ck, 0, 15, 3);
236 elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_DEFAULT);
237 elm_clock_show_seconds_set(ck, EINA_TRUE);
238 elm_clock_show_am_pm_set(ck, EINA_TRUE);
239 elm_box_pack_end(bx, ck);
240 evas_object_show(ck);
242 hbx = elm_box_add(bx);
243 evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
244 elm_box_horizontal_set(hbx, EINA_TRUE);
245 elm_box_pack_end(bx, hbx);
246 evas_object_show(hbx);
248 bt = elm_button_add(hbx);
249 elm_object_text_set(bt, "Edit");
250 evas_object_smart_callback_add(bt, "clicked", _edit_bt_clicked, ck);
251 elm_box_pack_end(hbx, bt);
252 evas_object_show(bt);
254 bt = elm_button_add(hbx);
255 elm_object_text_set(bt, "24h");
256 evas_object_smart_callback_add(bt, "clicked", _hmode_bt_clicked, ck);
257 elm_box_pack_end(hbx, bt);
258 evas_object_show(bt);
260 evas_object_show(win);
264 test_clock3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
266 Evas_Object *win, *bx, *ck, *lb;
268 win = elm_win_util_standard_add("clock3", "Clock 3");
269 elm_win_autodel_set(win, EINA_TRUE);
271 bx = elm_box_add(win);
272 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
273 elm_win_resize_object_add(win, bx);
274 evas_object_show(bx);
276 lb = elm_label_add(win);
277 elm_object_text_set(lb,
278 "Check time updates for an user mouse button hold."
280 evas_object_size_hint_weight_set(lb, 0.0, 0.0);
281 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
282 elm_box_pack_end(bx, lb);
283 evas_object_show(lb);
285 ck = elm_clock_add(win);
286 elm_clock_show_seconds_set(ck, 1);
287 elm_clock_edit_set(ck, EINA_TRUE);
288 elm_clock_first_interval_set(ck, 0.4);
289 elm_box_pack_end(bx, ck);
290 evas_object_show(ck);
292 ck = elm_clock_add(win);
293 elm_clock_show_seconds_set(ck, 1);
294 elm_clock_edit_set(ck, EINA_TRUE);
295 elm_clock_first_interval_set(ck, 1.2);
296 elm_box_pack_end(bx, ck);
297 evas_object_show(ck);
299 ck = elm_clock_add(win);
300 elm_clock_show_seconds_set(ck, 1);
301 elm_clock_edit_set(ck, EINA_TRUE);
302 elm_clock_first_interval_set(ck, 2.0);
303 elm_box_pack_end(bx, ck);
304 evas_object_show(ck);
306 evas_object_show(win);