Commit Graph

5 Commits

Author SHA1 Message Date
Marcel Hollerbach 837528201f efl_ui_format: make this usable with the standard behaviour of accessors
a accessor is never delivering a value, only the pointer to a value.
This makes format working with accessors for list array carray.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10909
2019-12-18 21:45:45 +01:00
Xavi Artigas 22b329d2f4 efl_ui_format: fix some more harmless Coverity warnings
1403023 Unchecked return value
1403024 Unchecked return value
1403026 Unchecked return value

If the eina value conversion fails the default value (0) will be used, which is already a good default.
ERRs have been added so the developer has a hint of what is happening.
2019-09-16 18:10:09 +02:00
Taehyub Kim d53e46d76f efl_ui_format: add null checking codes for eina_strftime in _do_format_string function
Summary: efl_ui_format: add null checking codes for eina_strftime in _do_format_string function

Reviewers: kimcinoo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9735
2019-08-26 14:52:28 +09:00
Boris Faure cdb920ab08 get rid of shadow variables
Summary: gl: add some EINA_FALLTHROUGH

Reviewers: #reviewers, zmike

Reviewed By: zmike

Subscribers: zmike, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9525
2019-08-08 17:18:46 -04:00
Xavi Artigas e776f5f0d7 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.
2019-07-04 19:38:20 +02:00