BaseWidgetValue

template<typename T>
class BaseWidgetValue : public BaseWidget
#include <BaseWidgetValue.h>

Base class for widget holding some value.

See also

BaseWidget

Template Parameters:

T – The type of value this widget holds

Subclassed by WidgetList< T >, WidgetRange< T >

Public Functions

inline BaseWidgetValue(const T &value, const char *format, const uint8_t cursorOffset = 0, void (*callback)(const T&) = nullptr)
inline const T &getValue() const

Retrieve current value.

inline virtual void setValue(const T &newValue)

Sets the value.

Note

You need to call LcdMenu::refresh after this method to see the changes.

Parameters:

newValue – The value to set.

~BaseWidgetValue() override = default

Protected Functions

inline virtual uint8_t draw(char *buffer, const uint8_t start) override

Draw the widget into specified buffer.

Parameters:
  • buffer – the buffer where widget will be drawn

  • start – the index where to start drawing in the buffer

virtual bool process(LcdMenu *menu, unsigned char command) override = 0

Process a command for this widget.

Parameters:
  • menu – Pointer to the menu instance

  • command – The command to process

Returns:

true if the command was handled, false otherwise

inline void handleChange()

Protected Attributes

T value
const char *format = nullptr
void (*callback)(const T&) = nullptr