summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-07-02 14:40:06 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-07-04 19:38:20 +0200
commite776f5f0d7b6292d32c29ccb4fffe3f20063d53d (patch)
tree0191eda9933ca930e90078fc9a35762b4b71538a /src/examples
parent87cfde51d3e143260a1b431f9c14d30536b549ce (diff)
downloadefl-e776f5f0d7b6292d32c29ccb4fffe3f20063d53d.tar.gz
Efl.Ui.Format revamp
This class helps widgets which contain a numerical value and must display it, like Progressbar (units label), Spin, Spin_Button, Slider (both units and popup labels, in legacy), Tags (when in shrunk mode) or Calendar (year_month label). Previously this was a mix of interface and mixin: widgets had to support setting a formatting func, and the mixin offered support for formatting strings, by setting an internal formatting func. On top of that, the spinner widget supported "special values", a list of values that should be shown as certain strings instead. This has now been simplified and unified: Widgets including this mixin can use the formatted_value_get() method which accepts an Eina_Value and returns a string. Thats's it. The mixin adds three properties to the widget (format_values, format_func and format_string) which users can use to tailor formatting. The widget does not need to know which method has been used, it just retrieves the resulting string. This removes a lot of duplicated widget code, and adds functionality which was missing before. For example, all widgets support passing a list of values now. Widgets must implement the apply_formatted_value() method so they are notified of changes in the format and they can redraw anything they need. Tests have been added to the Elementary Spec suite for all cases. Legacy widgets behavior has not been modified, although a few needed some code changes.
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/elementary/calendar_cxx_example_02.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/examples/elementary/calendar_cxx_example_02.cc b/src/examples/elementary/calendar_cxx_example_02.cc
index 60fb796bf1..e666ae844a 100644
--- a/src/examples/elementary/calendar_cxx_example_02.cc
+++ b/src/examples/elementary/calendar_cxx_example_02.cc
@@ -26,17 +26,19 @@ struct appData
auto wcal(cal._get_wref());
// FIXME: How does one figure out the argument types for the function?
- auto cb_a = std::bind([=](
+ auto cb_a = std::bind([](
efl::eina::strbuf_wrapper& sb,
- efl::eina::value_view const& value) {
+ efl::eina::value_view const& value) -> bool {
try {
sb.append_strftime("%b. %y", efl::eina::get<tm>(value));
} catch (std::system_error const&) {
sb.append(value.to_string());
}
std::cout << "Month: " << std::string(sb) << std::endl;
+ return true;
}, _1, _2);
- cal.format_cb_set(cb_a);
+ // FIXME XAR: I broke this and I do not know how to fix it
+ // cal.format_func_set(cb_a);
}
void destroy() {