summaryrefslogtreecommitdiff
path: root/src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-07-16 16:32:56 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-07-18 18:57:09 -0300
commit88f12935278c9d3547da96b74e525402e2efd3f0 (patch)
treea8f88a8050a2936d28d5ce7d3ee6217816aad953 /src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc
parentac8975a73f90c07dfa6f9587b72cfde1e6014bdb (diff)
eolian-cxx: Added examples.
Added complex types, callbacks and events examples.
Diffstat (limited to 'src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc')
-rw-r--r--src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc b/src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc
new file mode 100644
index 0000000000..4efff00923
--- /dev/null
+++ b/src/examples/eolian_cxx/eolian_cxx_callbacks_01.cc
@@ -0,0 +1,58 @@
1#include <iostream>
2#include <thread>
3#include <cassert>
4#include <sstream>
5
6#ifdef HAVE_CONFIG_H
7# include <config.h>
8#endif
9
10#include <Eo.h>
11#include <Ecore.h>
12#include <Evas.h>
13#include <Ecore_Evas.h>
14
15#include <Eina.hh>
16#include <Eo.hh>
17#include <Ecore.hh>
18#include <Evas.hh>
19
20#include <ecore_poll.eo.hh>
21
22namespace efl { namespace ecore {
23using ::ecore_poller;
24} }
25
26void
27example_callbacks()
28{
29 int count = 0;
30 efl::ecore::ecore_poller poller
31 (ECORE_POLLER_CORE, 1,
32 [&count, &poller]
33 {
34 if (++count == 5)
35 {
36 std::cout << std::endl;
37 ecore_main_loop_quit();
38 return false;
39 }
40 poller.interval_set(2*poller.interval_get());
41 std::cout << "."<< std::flush;
42 return true;
43 });
44 ::ecore_main_loop_begin();
45}
46
47int main()
48{
49 efl::eina::eina_init eina_;
50 efl::eo::eo_init eo_;
51 efl::ecore::ecore_init ecore_;
52
53 std::cerr << "[+] Running EFL++ example: Callbacks" << std::endl;
54 example_callbacks();
55
56 return 0;
57}
58