summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/examples/elementary/calendar_cxx_example_01.cc27
-rw-r--r--src/examples/elementary/calendar_cxx_example_02.cc51
-rw-r--r--src/examples/elementary/calendar_cxx_example_03.cc34
-rw-r--r--src/examples/elementary/calendar_cxx_example_04.cc35
-rw-r--r--src/examples/elementary/calendar_cxx_example_05.cc15
-rw-r--r--src/examples/elementary/clock_cxx_example.cc53
-rw-r--r--src/examples/elementary/toolbar_cxx_example_01.cc7
-rw-r--r--src/lib/elementary/efl_ui_calendar.eo2
8 files changed, 94 insertions, 130 deletions
diff --git a/src/examples/elementary/calendar_cxx_example_01.cc b/src/examples/elementary/calendar_cxx_example_01.cc
index 89e0de873e..4e24fff699 100644
--- a/src/examples/elementary/calendar_cxx_example_01.cc
+++ b/src/examples/elementary/calendar_cxx_example_01.cc
@@ -5,27 +5,20 @@
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; 15 auto win = efl::ui::Win(instantiate);
14 16 win.text_set("Calendar Creation Example");
15 efl::ui::Win win(instantiate);
16 //win.title_set("Calendar Creation Example");
17 win.autohide_set(true); 17 win.autohide_set(true);
18 18
19 ::elm::Calendar cal(instantiate, win); 19 auto cal = efl::ui::Calendar(instantiate, win);
20 //cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 20 win.content_set(cal);
21 cal.eo_cxx::efl::Gfx::size_set({134,134});
22 //win.resize_object_add(cal);
23 cal.visible_set(true);
24
25 win.eo_cxx::efl::Gfx::size_set({134,134});
26 win.visible_set(true);
27 21
28 elm_run(); 22 win.size_set({320,320});
29 return 0;
30} 23}
31ELM_MAIN() 24EFL_MAIN()
diff --git a/src/examples/elementary/calendar_cxx_example_02.cc b/src/examples/elementary/calendar_cxx_example_02.cc
index ebc095de2a..6027b1658d 100644
--- a/src/examples/elementary/calendar_cxx_example_02.cc
+++ b/src/examples/elementary/calendar_cxx_example_02.cc
@@ -6,38 +6,41 @@
6#include <Efl.hh> 6#include <Efl.hh>
7#include <Elementary.hh> 7#include <Elementary.hh>
8 8
9static char * 9using efl::eo::instantiate;
10_format_month_year(struct tm *format_time) 10
11// FIXME: Function callbacks need a lot of love in C++
12static void
13_format_cb(void *data EINA_UNUSED, Eina_Strbuf *str, const Eina_Value value)
11{ 14{
12 char buf[32]; 15 if (::eina_value_type_get(&value) != ::EINA_VALUE_TYPE_TM)
13 if (!strftime(buf, sizeof(buf), "%b %y", format_time)) return NULL; 16 {
14 return strdup(buf); 17 // FIXME: val.to_string()
18 char *convert = ::eina_value_to_string(&value);
19 eina_strbuf_append(str, convert);
20 free(convert);
21 }
22 else
23 {
24 struct tm time;
25 eina_value_get(&value, &time);
26 eina_strbuf_append_strftime(str, "%b. %y", &time);
27 }
15} 28}
16 29
17EAPI_MAIN int 30static void
18elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) 31efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
19{ 32{
20 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 33 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
21 34
22 using efl::eo::instantiate;
23
24 efl::ui::Win win(instantiate); 35 efl::ui::Win win(instantiate);
25 //win.title_set("Calendar Layout Formatting Example"); 36 win.text_set("Calendar Layout Formatting Example");
26 win.autohide_set(true); 37 win.autohide_set(true);
27 38
28 ::elm::Calendar cal(instantiate, win); 39 auto cal = efl::ui::Calendar(instantiate, win);
29 //cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 40 win.content_set(cal);
30 //win.resize_object_add(cal);
31
32 cal.format_function_set(_format_month_year);
33 // cal.weekdays_names_set(weekdays);
34
35 cal.eo_cxx::efl::Gfx::size_set({125,134});
36 win.eo_cxx::efl::Gfx::size_set({125,134});
37 cal.visible_set(true);
38 win.visible_set(true);
39 41
40 elm_run(); 42 // FIXME: Function cb doesn't work (C++ variant)
41 return 0; 43 cal.format_cb_set(_format_cb);
44 ::efl_ui_format_cb_set(cal._eo_ptr(), NULL, _format_cb, NULL);
42} 45}
43ELM_MAIN() 46EFL_MAIN()
diff --git a/src/examples/elementary/calendar_cxx_example_03.cc b/src/examples/elementary/calendar_cxx_example_03.cc
index 672e6319f9..c780987f48 100644
--- a/src/examples/elementary/calendar_cxx_example_03.cc
+++ b/src/examples/elementary/calendar_cxx_example_03.cc
@@ -5,35 +5,27 @@
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 Efl_Time min, max; 13 Efl_Time min = {}, max = {};
12 14
13 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 15 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
14 16
15 using efl::eo::instantiate;
16
17 efl::ui::Win win(instantiate);
18 //win.title_set("Calendar Min/Max Year Example");
19 win.autohide_set(true);
20
21 elm::Calendar cal(instantiate, win);
22
23 min.tm_year = 2020 - 1900; 17 min.tm_year = 2020 - 1900;
24 max.tm_year = 2022 - 1900; 18 max.tm_year = 2022 - 1900;
25 19
26 //cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 20 auto win = efl::ui::Win(instantiate);
27 //win.resize_object_add(cal); 21 win.text_set("Calendar Min/Max Year Example");
22 win.autohide_set(true);
23
24 auto cal = efl::ui::Calendar(instantiate, win);
25 win.content_set(cal);
28 cal.date_min_set(min); 26 cal.date_min_set(min);
29 cal.date_max_set(max); 27 cal.date_max_set(max);
30 cal.visible_set(true);
31
32 cal.eo_cxx::efl::Gfx::size_set({140,140});
33 win.eo_cxx::efl::Gfx::size_set({140,140});
34 win.visible_set(true);
35 28
36 elm_run(); 29 win.size_set({320,320});
37 return 0;
38} 30}
39ELM_MAIN() 31EFL_MAIN()
diff --git a/src/examples/elementary/calendar_cxx_example_04.cc b/src/examples/elementary/calendar_cxx_example_04.cc
index 0b6b21a35f..e0983268f8 100644
--- a/src/examples/elementary/calendar_cxx_example_04.cc
+++ b/src/examples/elementary/calendar_cxx_example_04.cc
@@ -3,36 +3,34 @@
3#include "elementary_config.h" 3#include "elementary_config.h"
4#endif 4#endif
5 5
6#warning This example can't be implemented with EO APIs... FIXME
7
6#include <Elementary.hh> 8#include <Elementary.hh>
7 9
10using efl::eo::instantiate;
11
8#define SECS_DAY 86400 12#define SECS_DAY 86400
9 13
10EAPI_MAIN int 14static void
11elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED) 15efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
12{ 16{
13 struct tm selected_time; 17 struct tm selected_time;
14 time_t current_time; 18 time_t current_time;
15 19
16 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 20 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
17 21
18 using efl::eo::instantiate;
19
20 efl::ui::Win win(instantiate); 22 efl::ui::Win win(instantiate);
21 //win.title_set("Calendar Day Selection Example"); 23 win.text_set("Calendar Day Selection Example");
22 win.autohide_set(true); 24 win.autohide_set(true);
23 25
24 ::efl::ui::Box bx(instantiate, win); 26 ::efl::ui::Box bx(instantiate, win);
25 //bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 27 win.content_set(bx);
26 //win.resize_object_add(bx); 28
27 bx.eo_cxx::efl::Gfx::size_set({700,700}); 29#if 0
28 bx.visible_set(true); 30
29 31 ::efl::ui::Calendar cal(instantiate, win);
30 ::elm::Calendar cal(instantiate, win);
31 // cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32 // cal.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
33 cal.select_mode_set(ELM_CALENDAR_SELECT_MODE_NONE); 32 cal.select_mode_set(ELM_CALENDAR_SELECT_MODE_NONE);
34 cal.eo_cxx::efl::Gfx::size_set({125,135}); 33 cal.eo_cxx::efl::Gfx::size_set({125,135});
35 cal.visible_set(true);
36 //bx.pack_end(cal); no matching function for call to ‘efl::ui::Box::pack_end(elm::Calendar&)’ 34 //bx.pack_end(cal); no matching function for call to ‘efl::ui::Box::pack_end(elm::Calendar&)’
37 //candidate: bool eo_cxx::efl::pack::Linear::pack_end(Efl_Gfx*) const 35 //candidate: bool eo_cxx::efl::pack::Linear::pack_end(Efl_Gfx*) const
38 // inline bool eo_cxx::efl::pack::Linear::pack_end(Efl_Gfx * subobj_) const 36 // inline bool eo_cxx::efl::pack::Linear::pack_end(Efl_Gfx * subobj_) const
@@ -44,13 +42,10 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
44 localtime_r(&current_time, &selected_time); 42 localtime_r(&current_time, &selected_time);
45 // cal2.selected_time_set(&selected_time); 43 // cal2.selected_time_set(&selected_time);
46 cal2.eo_cxx::efl::Gfx::size_set({125,135}); 44 cal2.eo_cxx::efl::Gfx::size_set({125,135});
47 cal2.visible_set(true);
48 //bx.pack_end(cal2); 45 //bx.pack_end(cal2);
49 46
50 win.eo_cxx::efl::Gfx::size_set({500,560}); 47#endif
51 win.visible_set(true);
52 48
53 elm_run(); 49 win.size_set({500,560});
54 return 0;
55} 50}
56ELM_MAIN() 51EFL_MAIN()
diff --git a/src/examples/elementary/calendar_cxx_example_05.cc b/src/examples/elementary/calendar_cxx_example_05.cc
index 3f6332e530..f5185eff45 100644
--- a/src/examples/elementary/calendar_cxx_example_05.cc
+++ b/src/examples/elementary/calendar_cxx_example_05.cc
@@ -3,6 +3,8 @@
3#include "elementary_config.h" 3#include "elementary_config.h"
4#endif 4#endif
5 5
6#warning This example can't be implemented with EO APIs... FIXME
7
6#include <Elementary.hh> 8#include <Elementary.hh>
7 9
8EAPI_MAIN int 10EAPI_MAIN int
@@ -13,13 +15,12 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
13 using efl::eo::instantiate; 15 using efl::eo::instantiate;
14 16
15 efl::ui::Win win(instantiate); 17 efl::ui::Win win(instantiate);
16 //win.title_set("Calendar Getters Example"); 18 win.text_set("Calendar Getters Example");
17 win.autohide_set(true); 19 win.autohide_set(true);
18 20
19 elm::Calendar cal(instantiate, win); 21 efl::ui::Calendar cal(instantiate, win);
20 //cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 22 win.content_set(cal);
21 //win.resize_object_add(cal); 23 cal.size_set({135,135});
22 cal.eo_cxx::efl::Gfx::size_set({135,135});
23 24
24 // auto print_cal_info = std::bind([] (::elm::Calendar obj) 25 // auto print_cal_info = std::bind([] (::elm::Calendar obj)
25 // { 26 // {
@@ -48,10 +49,8 @@ elm_main (int argc EINA_UNUSED, char **argv EINA_UNUSED)
48 // } , std::placeholders::_1 ); 49 // } , std::placeholders::_1 );
49 50
50 // cal.callback_changed_add(print_cal_info); 51 // cal.callback_changed_add(print_cal_info);
51 cal.visible_set(true);
52 52
53 win.eo_cxx::efl::Gfx::size_set({135,135}); 53 win.size_set({135,135});
54 win.visible_set(true);
55 54
56 elm_run(); 55 elm_run();
57 return 0; 56 return 0;
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()
diff --git a/src/examples/elementary/toolbar_cxx_example_01.cc b/src/examples/elementary/toolbar_cxx_example_01.cc
index f194221d19..12548e046d 100644
--- a/src/examples/elementary/toolbar_cxx_example_01.cc
+++ b/src/examples/elementary/toolbar_cxx_example_01.cc
@@ -5,8 +5,9 @@
5#include "config.h" 5#include "config.h"
6#endif 6#endif
7 7
8#warning This example requires yet unfinished EO APIs
9
8#include <Elementary.hh> 10#include <Elementary.hh>
9#include <Evas.hh>
10 11
11EAPI int 12EAPI int
12elm_main(int argc, char* argv[]) 13elm_main(int argc, char* argv[])
@@ -25,6 +26,8 @@ elm_main(int argc, char* argv[])
25 }); 26 });
26 27
27 win_1.autodel_set(true); 28 win_1.autodel_set(true);
29
30#if 0
28 win_1.eo_cxx::efl::Gfx::size_set({320, 300}); 31 win_1.eo_cxx::efl::Gfx::size_set({320, 300});
29 32
30 efl::ui::Box box_1(instantiate, win_1); 33 efl::ui::Box box_1(instantiate, win_1);
@@ -128,6 +131,8 @@ elm_main(int argc, char* argv[])
128 }); 131 });
129 132
130 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_5, _item_5_selected_cb); 133 efl::eolian::event_add(efl::ui::Selectable::selected_event, item_5, _item_5_selected_cb);
134
135#endif
131 136
132 elm_run(); 137 elm_run();
133 return 0; 138 return 0;
diff --git a/src/lib/elementary/efl_ui_calendar.eo b/src/lib/elementary/efl_ui_calendar.eo
index f1afa05f04..43d4508516 100644
--- a/src/lib/elementary/efl_ui_calendar.eo
+++ b/src/lib/elementary/efl_ui_calendar.eo
@@ -1,7 +1,5 @@
1import efl_types; 1import efl_types;
2 2
3type Efl_Ui_Calendar_Format_Cb: __undefined_type; [[Elementary calendar format callback type]]
4
5enum Efl.Ui.Calendar.Weekday 3enum Efl.Ui.Calendar.Weekday
6{ 4{
7 [[A weekday 5 [[A weekday