ItemWidget

Functions

template<typename ...Ts>
inline MenuItem *ITEM_WIDGET(const char *text, typename ItemWidget<Ts...>::CallbackType callback, BaseWidgetValue<Ts>*... widgetPtrs)

Create an ItemWidget object.

Parameters:
  • text – the text of the item

  • callback – reference to callback function to call when the value of the item is changed

  • widgetPtrs – pointers to the widgets associated with this item

template<size_t... Is>
struct index_sequence
template<size_t N, size_t... Is>
struct make_index_sequence
#include <ItemWidget.h>

Custom implementation of index_sequence and make_index_sequence for C++11 compatibility on Arduino.

This template struct generates a compile-time sequence of integers, which is useful for template metaprogramming. The implementation is necessary because the standard library’s std::index_sequence and std::make_index_sequence are not available in C++11, which is commonly used in Arduino projects.

Template Parameters:
  • N – The size of the sequence to generate.

  • Is – The sequence of integers generated so far.

template<size_t... Is>
struct make_index_sequence<0, Is...>

Public Types

using type = index_sequence<Is...>
template<typename ...Ts>
class ItemWidget : public BaseItemManyWidgets

Public Types

using CallbackType = void (*)(Ts...)

Public Functions

inline ItemWidget(const char *text, BaseWidgetValue<Ts>*... widgetPtrs, CallbackType callback = nullptr)
inline void setValues(Ts... values)

Protected Functions

inline virtual void handleCommit() override
template<size_t... Is>
inline void invokeCallback(index_sequence<Is...>)

Protected Attributes

CallbackType callback = nullptr

Private Functions

template<size_t... Is>
inline void setValuesImpl(index_sequence<Is...>, Ts... values)