2 * Simple Elementary's <b>clock widget</b> example, illustrating its
5 * See stdout/stderr for output. Compile with:
8 * gcc -g `pkg-config --cflags --libs elementary` clock_example.c -o clock_example
12 #include <Elementary.h>
14 # include "elementary_config.h"
20 _on_done(void *data __UNUSED__,
21 Evas_Object *obj __UNUSED__,
22 void *event_info __UNUSED__)
28 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
30 Evas_Object *win, *bg, *bx, *ck;
33 win = elm_win_add(NULL, "clock", ELM_WIN_BASIC);
34 elm_win_title_set(win, "Clock Example");
35 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
38 elm_win_resize_object_add(win, bg);
39 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42 bx = elm_box_add(win);
43 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 elm_win_resize_object_add(win, bx);
47 /* pristine (no seconds, military time) */
48 ck = elm_clock_add(win);
49 elm_box_pack_end(bx, ck);
53 ck = elm_clock_add(win);
54 elm_clock_show_am_pm_set(ck, EINA_TRUE);
55 elm_box_pack_end(bx, ck);
58 /* with seconds and custom time */
59 ck = elm_clock_add(win);
60 elm_clock_show_seconds_set(ck, EINA_TRUE);
61 elm_clock_time_set(ck, 10, 11, 12);
62 elm_box_pack_end(bx, ck);
65 /* in edition mode, with seconds, custom time and am/pm set */
66 ck = elm_clock_add(win);
67 elm_clock_edit_set(ck, EINA_TRUE);
68 elm_clock_show_seconds_set(ck, EINA_TRUE);
69 elm_clock_show_am_pm_set(ck, EINA_TRUE);
70 elm_clock_time_set(ck, 10, 11, 12);
71 elm_box_pack_end(bx, ck);
74 /* in edition mode, with seconds, but only some digits editable */
75 ck = elm_clock_add(win);
76 elm_clock_show_seconds_set(ck, EINA_TRUE);
77 elm_clock_edit_set(ck, EINA_TRUE);
78 digedit = ELM_CLOCK_HOUR_UNIT | ELM_CLOCK_MIN_UNIT | ELM_CLOCK_SEC_UNIT;
79 elm_clock_digit_edit_set(ck, digedit);
80 elm_box_pack_end(bx, ck);
83 evas_object_show(win);