summaryrefslogtreecommitdiff
path: root/unsorted
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2018-05-15 19:59:45 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2018-05-15 20:03:20 +0900
commit7ce001084a71637836fe0413e20a1dfd49060d72 (patch)
tree59319ec8ae473fa5ec9c949ddfdb1beb6117edf5 /unsorted
parent93d75b47c91123dec160efde623f7a49cf80c76c (diff)
examples: Fix slider cxx example based on Efl.Ui.Slider
Unlike Elm_Slider, Efl.Ui.Slider does not support text_set, format_cb_set, and format_string_set. To support Efl.Ui.Slider, slider cxx example is modified.
Diffstat (limited to 'unsorted')
-rw-r--r--unsorted/elementary/slider_cxx_example.cc17
1 files changed, 0 insertions, 17 deletions
diff --git a/unsorted/elementary/slider_cxx_example.cc b/unsorted/elementary/slider_cxx_example.cc
index 3a63e158..d7ed3e0e 100644
--- a/unsorted/elementary/slider_cxx_example.cc
+++ b/unsorted/elementary/slider_cxx_example.cc
@@ -26,7 +26,6 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
26 bx.pack_end(sl); 26 bx.pack_end(sl);
27 27
28 efl::ui::Slider sl2(instantiate, win); 28 efl::ui::Slider sl2(instantiate, win);
29 sl2.text_set("Counter");
30 efl::ui::Image ic(instantiate, win); 29 efl::ui::Image ic(instantiate, win);
31 ic.icon_set("home"); 30 ic.icon_set("home");
32 ic.scalable_set(false, false); 31 ic.scalable_set(false, false);
@@ -49,13 +48,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
49 bx.pack_end(sl3); 48 bx.pack_end(sl3);
50 49
51 efl::ui::Slider sl4(instantiate, win); 50 efl::ui::Slider sl4(instantiate, win);
52 sl4.format_string_set("%1.0f units");
53 sl4.range_min_max_set(0, 100); 51 sl4.range_min_max_set(0, 100);
54 sl4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5); 52 sl4.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
55 bx.pack_end(sl4); 53 bx.pack_end(sl4);
56 54
57 efl::ui::Slider sl5(instantiate, win); 55 efl::ui::Slider sl5(instantiate, win);
58 sl5.indicator().format_string_set("%1.0f rabbit(s)");
59 sl5.range_min_max_set(0, 100); 56 sl5.range_min_max_set(0, 100);
60 sl5.range_step_set(1); 57 sl5.range_step_set(1);
61 sl5.direction_set(EFL_UI_DIR_UP); 58 sl5.direction_set(EFL_UI_DIR_UP);
@@ -66,25 +63,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
66 efl::ui::Slider sl6(instantiate, win); 63 efl::ui::Slider sl6(instantiate, win);
67 sl6.direction_set(EFL_UI_DIR_HORIZONTAL); 64 sl6.direction_set(EFL_UI_DIR_HORIZONTAL);
68 sl6.range_min_max_set(0, 10); 65 sl6.range_min_max_set(0, 10);
69 auto format_cb = std::bind([](
70 efl::eina::strbuf_wrapper& sb,
71 efl::eina::value_view const& value) {
72 try {
73 int d = int(efl::eina::get<double>(value));
74 if (d >= 2) sb.append_printf("%d things", d);
75 else if (!d) sb.append("nothing");
76 else sb.append("one thing");
77 } catch (std::system_error const&) {
78 sb.append(value.to_string());
79 } }, _1, _2);
80 sl6.format_cb_set(format_cb);
81 sl6.hint_align_set(0.5, EFL_GFX_SIZE_HINT_FILL); 66 sl6.hint_align_set(0.5, EFL_GFX_SIZE_HINT_FILL);
82 sl6.hint_weight_set(0, EFL_GFX_SIZE_HINT_EXPAND); 67 sl6.hint_weight_set(0, EFL_GFX_SIZE_HINT_EXPAND);
83 bx.pack_end(sl6); 68 bx.pack_end(sl6);
84 69
85 efl::ui::Slider sl7(instantiate, win); 70 efl::ui::Slider sl7(instantiate, win);
86 sl7.format_string_set("%1.3f units");
87// sl7.indicator_format_function_set(indicator_format, indicator_free);
88 sl7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5); 71 sl7.hint_align_set(EFL_GFX_SIZE_HINT_FILL, 0.5);
89 bx.pack_end(sl7); 72 bx.pack_end(sl7);
90 73