aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/examples/datetime_example.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/elementary/src/examples/datetime_example.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/libraries/elementary/src/examples/datetime_example.c b/libraries/elementary/src/examples/datetime_example.c
new file mode 100644
index 0000000..9b443fe
--- /dev/null
+++ b/libraries/elementary/src/examples/datetime_example.c
@@ -0,0 +1,69 @@
1//Compile with:
2//gcc -g datetime_example.c -o datetime_example `pkg-config --cflags --libs elementary`
3
4#include <Elementary.h>
5
6static void
7_on_done(void *data,
8 Evas_Object *obj,
9 void *event_info)
10{
11 elm_exit();
12}
13
14EAPI_MAIN int
15elm_main(int argc, char *argv[])
16{
17 Evas_Object *win, *bg, *bx, *datetime;
18
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);
22
23 bg = elm_bg_add(win);
24 elm_win_resize_object_add(win, bg);
25 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
26 evas_object_show(bg);
27
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);
32 evas_object_show(bx);
33 evas_object_size_hint_min_set(bx, 360, 200);
34
35 //datetime showing only DATE
36 datetime = elm_datetime_add(bx);
37 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
38 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
39 elm_datetime_field_visible_set(datetime, ELM_DATETIME_HOUR, EINA_FALSE);
40 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MINUTE, EINA_FALSE);
41 elm_datetime_field_visible_set(datetime, ELM_DATETIME_AMPM, EINA_FALSE);
42 elm_box_pack_end(bx, datetime);
43 evas_object_show(datetime);
44
45 //datetime showing only TIME
46 datetime = elm_datetime_add(bx);
47 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
49 elm_datetime_field_visible_set(datetime, ELM_DATETIME_YEAR, EINA_FALSE);
50 elm_datetime_field_visible_set(datetime, ELM_DATETIME_MONTH, EINA_FALSE);
51 elm_datetime_field_visible_set(datetime, ELM_DATETIME_DATE, EINA_FALSE);
52 elm_box_pack_end(bx, datetime);
53 evas_object_show(datetime);
54
55 //datetime showing both DATE and TIME
56 datetime = elm_datetime_add(bx);
57 evas_object_size_hint_weight_set(datetime, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58 evas_object_size_hint_align_set(datetime, EVAS_HINT_FILL, 0.5);
59 elm_box_pack_end(bx, datetime);
60 evas_object_show(datetime);
61
62 evas_object_show(win);
63
64 elm_run();
65 elm_shutdown();
66
67 return 0;
68}
69ELM_MAIN()