cxx: Added examples and tutorial for C++ binding
[platform/upstream/elementary.git] / src / examples / clock_cxx_example.cc
1 #include <Elementary.hh>
2
3 EAPI_MAIN int
4 elm_main (int argc, char *argv[])
5 {
6    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
7
8    ::elm::win_standard win;
9    win.title_set("Clock Example");
10    win.autohide_set(true);
11
12    ::elm::box bx(efl::eo::parent = win);
13    bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
14    win.resize_object_add(bx);
15    bx.visible_set(true);
16
17    ::elm::clock ck(efl::eo::parent = win);
18    bx.pack_end(ck);
19    ck.visible_set(true);
20
21    ::elm::clock ck2(efl::eo::parent = win);
22    ck2.show_am_pm_set(true);
23    bx.pack_end(ck2);
24    ck2.visible_set(true);
25
26    ::elm::clock ck3(efl::eo::parent = win);
27    ck3.show_seconds_set(true);
28    ck3.time_set(10, 11, 12);
29    bx.pack_end(ck3);
30    ck3.visible_set(true);
31
32    ::elm::clock ck4(efl::eo::parent = win);
33    ck4.edit_set(true);
34    ck4.show_seconds_set(true);
35    ck4.show_am_pm_set(true);
36    ck4.time_set(10, 11, 12);
37    bx.pack_end(ck4);
38    ck4.visible_set(true);
39
40    ::elm::clock ck5(efl::eo::parent = win);
41    ck5.show_seconds_set(true);
42    ck5.edit_set(true);
43    int digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
44    ck5.edit_mode_set(static_cast<Elm_Clock_Edit_Mode>(digedit));
45    bx.pack_end(ck5);
46    ck5.visible_set(true);
47
48    win.visible_set(true);
49
50    elm_run();
51    return 0;
52 }
53 ELM_MAIN()