2 //gcc -g datetime_example.c -o datetime_example `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
7 elm_main(int argc, char *argv[])
9 Evas_Object *win, *bx, *datetime;
11 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
13 win = elm_win_util_standard_add("Datetime", "Datetime");
14 elm_win_autodel_set(win, EINA_TRUE);
16 bx = elm_box_add(win);
17 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
18 elm_win_resize_object_add(win, bx);
19 elm_box_horizontal_set(bx, EINA_FALSE);
22 //datetime showing only DATE
23 datetime = elm_datetime_add(bx);
24 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
25 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
26 elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE);
27 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE);
28 elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE);
29 elm_box_pack_end(bx, datetime);
30 evas_object_show(datetime);
32 //datetime showing only TIME
33 datetime = elm_datetime_add(bx);
34 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
35 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
36 elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE);
37 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE);
38 elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE);
39 elm_box_pack_end(bx, datetime);
40 evas_object_show(datetime);
42 //datetime showing both DATE and TIME
43 datetime = elm_datetime_add(bx);
44 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
45 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
46 elm_box_pack_end(bx, datetime);
47 evas_object_show(datetime);
49 evas_object_show(win);