tizen 2.4 release
[framework/uifw/elementary.git] / src / examples / datetime_example.c
1 //Compile with:
2 //gcc -g datetime_example.c -o datetime_example `pkg-config --cflags --libs elementary`
3
4 #include <Elementary.h>
5
6 EAPI_MAIN int
7 elm_main(int argc, char *argv[])
8 {
9    Evas_Object *win, *bx, *datetime;
10
11    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
12
13    win = elm_win_util_standard_add("Datetime", "Datetime");
14    elm_win_autodel_set(win, EINA_TRUE);
15
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);
20    evas_object_show(bx);
21
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);
31
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);
41
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);
48
49    evas_object_show(win);
50
51    elm_run();
52
53    return 0;
54 }
55 ELM_MAIN()