summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2015-01-05 15:47:52 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-01-05 19:55:09 -0200
commitacdda9f5500173558ad6aa7680f2a72aa92dbabe (patch)
treef9651d9024960a989e020c5bb8061ced1745125e
parentfd301fbf8cb6838f49d4856bdb599d0cfb232b95 (diff)
cxx: Update examples to handle eina::optional types used by the new C++ wrappersdevs/felipealmeida/quit_last_hidden_policy
-rw-r--r--src/examples/box_cxx_example_02.cc8
-rw-r--r--src/examples/button_cxx_example_01.cc14
-rw-r--r--src/examples/hoversel_cxx_example_01.cc2
-rw-r--r--src/examples/icon_cxx_example_01.cc4
4 files changed, 14 insertions, 14 deletions
diff --git a/src/examples/box_cxx_example_02.cc b/src/examples/box_cxx_example_02.cc
index ecfb9eb05..273130fcb 100644
--- a/src/examples/box_cxx_example_02.cc
+++ b/src/examples/box_cxx_example_02.cc
@@ -107,10 +107,10 @@ elm_main(int argc, char *argv[])
107 { 107 {
108 elm_button btn ( efl::eo::parent = *box ); 108 elm_button btn ( efl::eo::parent = *box );
109 btn.text_set("elm.text", "I do nothing"); 109 btn.text_set("elm.text", "I do nothing");
110 efl::eina::list<evas::object> childrens(box->children_get()); 110 efl::eina::optional<efl::eina::list<evas::object> > childrens(box->children_get());
111 if (!childrens.empty()) 111 if (childrens && !childrens->empty())
112 { 112 {
113 box->pack_after(btn, childrens.front()); 113 box->pack_after(btn, childrens->front());
114 } 114 }
115 else 115 else
116 box->pack_end(btn); 116 box->pack_end(btn);
@@ -135,7 +135,7 @@ elm_main(int argc, char *argv[])
135 elm_button btn = efl::eo::downcast<elm_button>(obj); 135 elm_button btn = efl::eo::downcast<elm_button>(obj);
136 tdata.box.lock()->unpack(btn); 136 tdata.box.lock()->unpack(btn);
137 btn.position_set(0, 50); 137 btn.position_set(0, 50);
138 btn.color_set(128, 64, 0, 128); 138 btn.object::color_set(128, 64, 0, 128);
139 }, std::placeholders::_1) 139 }, std::placeholders::_1)
140 ; 140 ;
141 141
diff --git a/src/examples/button_cxx_example_01.cc b/src/examples/button_cxx_example_01.cc
index adc8df5f5..1a59c886c 100644
--- a/src/examples/button_cxx_example_01.cc
+++ b/src/examples/button_cxx_example_01.cc
@@ -64,20 +64,20 @@ elm_main(int argc, char *argv[])
64 { 64 {
65 ::elm_button b(eo_ref(ci._eo_ptr())); 65 ::elm_button b(eo_ref(ci._eo_ptr()));
66 std::string::size_type ptr; 66 std::string::size_type ptr;
67 std::string lbl = b.text_get("elm.text"); 67 efl::eina::optional<std::string> lbl = b.text_get("elm.text");
68 68
69 ptr = lbl.find(":"); 69 ptr = lbl->find(":");
70 ptr += 2; 70 ptr += 2;
71 double t = std::stod(lbl.substr(ptr)); 71 double t = std::stod(lbl->substr(ptr));
72 72
73 if (lbl.compare(0,7,"Initial") != 0) 73 if (lbl->compare(0,7,"Initial") != 0)
74 { 74 {
75 up.autorepeat_initial_timeout_set(t); 75 up.autorepeat_initial_timeout_set(t);
76 down.autorepeat_initial_timeout_set(t); 76 down.autorepeat_initial_timeout_set(t);
77 left.autorepeat_initial_timeout_set(t); 77 left.autorepeat_initial_timeout_set(t);
78 right.autorepeat_initial_timeout_set(t); 78 right.autorepeat_initial_timeout_set(t);
79 } 79 }
80 else if (lbl.compare(0,3,"Gap") != 0) 80 else if (lbl->compare(0,3,"Gap") != 0)
81 { 81 {
82 up.autorepeat_gap_timeout_set(t); 82 up.autorepeat_gap_timeout_set(t);
83 down.autorepeat_gap_timeout_set(t); 83 down.autorepeat_gap_timeout_set(t);
@@ -140,8 +140,8 @@ elm_main(int argc, char *argv[])
140 if (!icon_still) 140 if (!icon_still)
141 { 141 {
142 ::elm_icon obj(efl::eo::parent = mid); 142 ::elm_icon obj(efl::eo::parent = mid);
143 evas::object icon_still = mid.content_unset("icon"); 143 efl::eina::optional<evas::object> icon_still = mid.content_unset("icon");
144 icon_still.visibility_set(false); 144 icon_still->visibility_set(false);
145 obj.standard_set("chat"); 145 obj.standard_set("chat");
146 mid.content_set("icon", obj); 146 mid.content_set("icon", obj);
147 } 147 }
diff --git a/src/examples/hoversel_cxx_example_01.cc b/src/examples/hoversel_cxx_example_01.cc
index d76009843..4f4d53e16 100644
--- a/src/examples/hoversel_cxx_example_01.cc
+++ b/src/examples/hoversel_cxx_example_01.cc
@@ -119,7 +119,7 @@ _print_items(void *data, Evas_Object *obj, void *event_info)
119 for (auto i : items) 119 for (auto i : items)
120 try 120 try
121 { 121 {
122 std::cout << i.part_text_get("elm.text") << std::endl; 122 std::cout << *(i.part_text_get("elm.text")) << std::endl;
123 } 123 }
124 catch (std::logic_error const&) {} 124 catch (std::logic_error const&) {}
125} 125}
diff --git a/src/examples/icon_cxx_example_01.cc b/src/examples/icon_cxx_example_01.cc
index da87ec1cd..f06992bc4 100644
--- a/src/examples/icon_cxx_example_01.cc
+++ b/src/examples/icon_cxx_example_01.cc
@@ -35,7 +35,7 @@ EAPI_MAIN int
35elm_main (int argc, char *argv[]) 35elm_main (int argc, char *argv[])
36{ 36{
37 const char *path, *group; 37 const char *path, *group;
38 std::string name; 38 efl::eina::optional<std::string> name;
39 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN); 39 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
40 40
41 ::elm_win win(elm_win_util_standard_add("icon", "Icon")); 41 ::elm_win win(elm_win_util_standard_add("icon", "Icon"));
@@ -47,7 +47,7 @@ elm_main (int argc, char *argv[])
47 47
48 icon.file_get(&path, &group); 48 icon.file_get(&path, &group);
49 name = icon.standard_get(); 49 name = icon.standard_get();
50 std::cout << "path = " << path << ", group = " << group << ", name = " << name << std::endl; 50 std::cout << "path = " << path << ", group = " << group << ", name = " << *name << std::endl;
51 51
52 icon.no_scale_set(true); 52 icon.no_scale_set(true);
53 icon.resizable_set(false, true); 53 icon.resizable_set(false, true);