2 //gcc -g datetime_example.c -o datetime_example `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
15 elm_main(int argc, char *argv[])
17 Evas_Object *win, *bg, *bx, *datetime;
19 win = elm_win_add(NULL, "Datetime", ELM_WIN_BASIC);
20 elm_win_title_set(win, "Datetime");
21 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
24 elm_win_resize_object_add(win, bg);
25 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
28 bx = elm_box_add(win);
29 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
30 elm_win_resize_object_add(win, bx);
31 elm_box_horizontal_set(bx, EINA_FALSE);
34 //datetime showing only DATE
35 datetime = elm_datetime_add(bx);
36 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
37 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
38 elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE);
39 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE);
40 elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE);
41 elm_box_pack_end(bx, datetime);
42 evas_object_show(datetime);
44 //datetime showing only TIME
45 datetime = elm_datetime_add(bx);
46 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
47 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
48 elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE);
49 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE);
50 elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE);
51 elm_box_pack_end(bx, datetime);
52 evas_object_show(datetime);
54 //datetime showing both DATE and TIME
55 datetime = elm_datetime_add(bx);
56 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
58 elm_box_pack_end(bx, datetime);
59 evas_object_show(datetime);
61 evas_object_show(win);