30 (void)oldSetting, (
void)newSetting;
55template <setting_t N,
class Callback = EmptySelectorCallback>
83 callback.update(initialSelection, initialSelection);
84 this->
setting = initialSelection;
94 newSetting =
selectable.validateSetting(newSetting);
96 if (
get() != newSetting) {
153template <setting_t N>
uint8_t setting_t
The type used for Selectors.
Wrap
An enumeration to set the behavior of selectors that are incremented (decremented) beyond their maxim...
@ Clamp
When the maximum (minimum) setting is reached, clamp to the maximum (minimum) setting.
@ Wrap
When the maximum (minimum) setting is reached, wrap around to the minimum (maximum) setting.
#define BEGIN_CS_NAMESPACE
A super class for object that have to be updated regularly.
void increment(Wrap wrap)
Add one to the setting, wrap around or clamp, depending on the parameter, if the new setting would be...
void set(setting_t newSetting)
Select the given selection.
void decrement(Wrap wrap)
Subtract one from the setting, wrap around or clamp, depending on the parameter, if the new setting w...
void update() override
Update this updatable.
Selectable< N > & selectable
void begin() override
Initialize this updatable.
void reset()
Reset the selection to the initial selection.
GenericSelector(Selectable< N > &selectable, const Callback &callback)
Constructor.
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
SelectorBase()=default
Constructor.
setting_t setting
The selection of the selector.
setting_t get() const
Get the current selection/setting.
A Selector with an empty callback.
Selector(Selectable< N > &selectable)
Constructor.
A callback for the GenericSelector class that does nothing.
void update(setting_t oldSetting, setting_t newSetting)
Called when the setting changes.
void update()
Refresh, called periodically.