[access] move mouse postion if an object has a highlight by highlight_cycle(); not...
[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 static void
7 _on_done(void *data,
8         Evas_Object *obj,
9         void *event_info)
10 {
11    elm_exit();
12 }
13
14 EAPI_MAIN int
15 elm_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
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);
43
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);
53
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);
60
61    evas_object_show(win);
62
63    elm_run();
64    elm_shutdown();
65
66    return 0;
67 }
68 ELM_MAIN()