summaryrefslogtreecommitdiff
path: root/src/examples/elementary/clock_cxx_example.cc
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-01 22:42:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-07 09:57:24 +0900
commit9c9278cd458422b73a3016ba056c0267d3d65bfb (patch)
tree2c5a5aa3f6d94a2f7ecd86674c59d8f95ac67108 /src/examples/elementary/clock_cxx_example.cc
parent03b22c4d7b41c2310b4c25ed7ce8543942d638d5 (diff)
cxx: Fix a few examples
- Calendar: Some examples can't be ported. Not good. - Toolbar: Needs the new API to be completed. - Clock: Crashes at runtime. Ping @felipealmeida
Diffstat (limited to 'src/examples/elementary/clock_cxx_example.cc')
-rw-r--r--src/examples/elementary/clock_cxx_example.cc53
1 files changed, 16 insertions, 37 deletions
diff --git a/src/examples/elementary/clock_cxx_example.cc b/src/examples/elementary/clock_cxx_example.cc
index bb8be2b39a..9939746468 100644
--- a/src/examples/elementary/clock_cxx_example.cc
+++ b/src/examples/elementary/clock_cxx_example.cc
@@ -5,58 +5,37 @@
5 5
6#include <Elementary.hh> 6#include <Elementary.hh>
7 7
8EAPI_MAIN int 8using efl::eo::instantiate;
9elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) 9
10static void
11efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
10{ 12{
11 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 13 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
12 14
13 using efl::eo::instantiate;
14
15 efl::ui::Win win(instantiate); 15 efl::ui::Win win(instantiate);
16 //win.title_set("Clock Example"); 16 win.text_set("Clock Example");
17 win.autohide_set(true); 17 win.autohide_set(true);
18 18
19 efl::ui::Box bx(instantiate, win); 19 efl::ui::Box bx(instantiate, win);
20 //bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 20 win.content_set(bx);
21 //win.resize_object_add(bx);
22 bx.eo_cxx::efl::Gfx::size_set({300,300});
23 bx.visible_set(true);
24 21
25 ::elm::Clock ck(instantiate, win); 22 efl::ui::Clock ck(instantiate, win);
26 bx.pack_end(ck); 23 bx.pack_end(ck);
27 ck.visible_set(true);
28 24
29 ::elm::Clock ck2(instantiate, win); 25 efl::ui::Clock ck2(instantiate, win);
30 ck2.show_am_pm_set(true); 26 ck2.format_set("%I:%M %p");
31 bx.pack_end(ck2); 27 bx.pack_end(ck2);
32 ck2.visible_set(true);
33 28
34 ::elm::Clock ck3(instantiate, win); 29 efl::ui::Clock ck3(instantiate, win);
35 ck3.show_seconds_set(true); 30 ck2.format_set("%H:%M:%S");
36 ck3.time_set(10, 11, 12); 31 ck3.time_set(Efl_Time({.tm_hour = 12, .tm_min = 42, .tm_sec = 59}));
37 bx.pack_end(ck3); 32 bx.pack_end(ck3);
38 ck3.visible_set(true); 33
39 34 efl::ui::Clock ck5(instantiate, win);
40 ::elm::Clock ck4(instantiate, win);
41 ck4.edit_set(true);
42 ck4.show_seconds_set(true);
43 ck4.show_am_pm_set(true);
44 ck4.time_set(10, 11, 12);
45 bx.pack_end(ck4);
46 ck4.visible_set(true);
47
48 ::elm::Clock ck5(instantiate, win);
49 ck5.show_seconds_set(true);
50 ck5.edit_set(true);
51 int digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT; 35 int digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
52 ck5.edit_mode_set(static_cast<Elm_Clock_Edit_Mode>(digedit)); 36 ck5.edit_mode_set(static_cast<Elm_Clock_Edit_Mode>(digedit));
53 bx.pack_end(ck5); 37 bx.pack_end(ck5);
54 ck5.visible_set(true);
55
56 win.eo_cxx::efl::Gfx::size_set({500,500});
57 win.visible_set(true);
58 38
59 elm_run(); 39 win.size_set({500,500});
60 return 0;
61} 40}
62ELM_MAIN() 41EFL_MAIN()