cxx: Added examples and tutorial for C++ binding
[platform/upstream/elementary.git] / src / examples / calendar_cxx_example_04.cc
1 #include <Elementary.hh>
2
3 #define SECS_DAY 86400
4
5 EAPI_MAIN int
6 elm_main (int argc, char *argv[])
7 {
8    struct tm selected_time;
9    time_t current_time;
10
11    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
12
13    ::elm::win_standard win;
14    win.title_set("Calendar Day Selection Example");
15    win.autohide_set(true);
16
17    ::elm::box bx(efl::eo::parent = win);
18    bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
19    win.resize_object_add(bx);
20    bx.visible_set(true);
21
22    ::elm::calendar cal(efl::eo::parent = win);
23    cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
24    cal.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
25    cal.select_mode_set(ELM_CALENDAR_SELECT_MODE_NONE);
26    cal.visible_set(true);
27    bx.pack_end(cal);
28
29    ::elm::calendar cal2(efl::eo::parent = win);
30    cal2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31    cal2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
32    current_time = time(NULL) +2 * SECS_DAY;
33    localtime_r(&current_time, &selected_time);
34    cal2.selected_time_set(&selected_time);
35    cal2.visible_set(true);
36    bx.pack_end(cal2);
37
38    win.visible_set(true);
39
40    elm_run();
41    return 0;
42 }
43 ELM_MAIN()