2 * Simple Elementary's <b>clock widget</b> example, illustrating its
5 * See stdout/stderr for output. Compile with:
8 * gcc -g clock_example.c -o clock_example `pkg-config --cflags --libs elementary`
12 #include <Elementary.h>
15 elm_main(int argc, char **argv)
17 Evas_Object *win, *bx, *ck;
20 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
22 win = elm_win_util_standard_add("clock", "Clock Example");
23 elm_win_autodel_set(win, EINA_TRUE);
25 bx = elm_box_add(win);
26 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
27 elm_win_resize_object_add(win, bx);
30 /* pristine (no seconds, military time) */
31 ck = elm_clock_add(win);
32 elm_box_pack_end(bx, ck);
36 ck = elm_clock_add(win);
37 elm_clock_show_am_pm_set(ck, EINA_TRUE);
38 elm_box_pack_end(bx, ck);
41 /* with seconds and custom time */
42 ck = elm_clock_add(win);
43 elm_clock_show_seconds_set(ck, EINA_TRUE);
44 elm_clock_time_set(ck, 10, 11, 12);
45 elm_box_pack_end(bx, ck);
48 /* in edition mode, with seconds, custom time and am/pm set */
49 ck = elm_clock_add(win);
50 elm_clock_edit_set(ck, EINA_TRUE);
51 elm_clock_show_seconds_set(ck, EINA_TRUE);
52 elm_clock_show_am_pm_set(ck, EINA_TRUE);
53 elm_clock_time_set(ck, 10, 11, 12);
54 elm_box_pack_end(bx, ck);
57 /* in edition mode, with seconds, but only some digits editable */
58 ck = elm_clock_add(win);
59 elm_clock_show_seconds_set(ck, EINA_TRUE);
60 elm_clock_edit_set(ck, EINA_TRUE);
61 digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
62 elm_clock_edit_mode_set(ck, digedit);
63 elm_box_pack_end(bx, ck);
66 evas_object_show(win);