2 //gcc -g `pkg-config --cflags --libs elementary` datetime_example.c -o datetime_example
4 #include <Elementary.h>
6 # include "elementary_config.h"
12 _on_done(void *data __UNUSED__,
13 Evas_Object *obj __UNUSED__,
14 void *event_info __UNUSED__)
20 elm_main(int argc __UNUSED__, char *argv[] __UNUSED__)
22 Evas_Object *win, *bg, *bx, *datetime;
24 win = elm_win_add(NULL, "Datetime", ELM_WIN_BASIC);
25 elm_win_title_set(win, "Datetime");
26 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
29 elm_win_resize_object_add(win, bg);
30 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
33 bx = elm_box_add(win);
34 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
35 elm_win_resize_object_add(win, bx);
36 elm_box_horizontal_set(bx, EINA_FALSE);
38 evas_object_size_hint_min_set(bx, 360, 200);
40 //datetime showing only DATE
41 datetime = elm_datetime_add(bx);
42 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
43 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
44 elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE);
45 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE);
46 elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE);
47 elm_box_pack_end(bx, datetime);
48 evas_object_show(datetime);
50 //datetime showing only TIME
51 datetime = elm_datetime_add(bx);
52 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
54 elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE);
55 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE);
56 elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE);
57 elm_box_pack_end(bx, datetime);
58 evas_object_show(datetime);
60 //datetime showing both DATE and TIME
61 datetime = elm_datetime_add(bx);
62 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
63 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
64 elm_box_pack_end(bx, datetime);
65 evas_object_show(datetime);
67 evas_object_show(win);