79 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
82 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
84 void copyValue(
char* buffer,
int bufferSize)
const {
85 renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_VALUE, buffer, bufferSize);
88 void runCallback()
const { renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_INVOKE,
nullptr, 0); }
89 [[nodiscard]]
int getRuntimeId()
const {
return int(
id); }
90 [[nodiscard]]
int getRuntimeEeprom()
const {
return renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_EEPROM_POS,
nullptr, 0); }
91 [[nodiscard]] uint8_t getNumberOfParts()
const {
return noOfParts; }
92 void copyRuntimeName(
char* buffer,
int bufferSize)
const { renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_NAME, buffer, bufferSize);}
94 [[nodiscard]] uint8_t getNumberOfRows()
const {
return noOfParts; }
95 [[nodiscard]] uint8_t getItemPosition()
const {
return itemPosition; }
97 void setNumberOfRows(uint8_t rows) {
195class ListRuntimeMenuItem :
public RuntimeMenuItem {
197 enum ListMode: uint8_t { CUSTOM_RENDER, RAM_ARRAY, FLASH_ARRAY };
199 const char*
const* dataArray;
201 ListMode listMode = CUSTOM_RENDER;
203 ListRuntimeMenuItem(
const AnyMenuInfo*
info,
int numberOfRows,
const char*
const* array, ListMode listMode,
MenuItem* next =
nullptr,
bool isPgm = INFO_LOCATION_PGM);
207 RuntimeMenuItem* getChildItem(
int pos);
208 RuntimeMenuItem* asParent();
209 RuntimeMenuItem* asBackMenu();
211 [[nodiscard]] ListMode getListMode()
const {
return listMode;}
212 [[nodiscard]]
bool isActingAsParent()
const {
return itemPosition == LIST_PARENT_ITEM_POS; }
213 [[nodiscard]] uint8_t getActiveIndex()
const {
return activeItem; }
214 void setActiveIndex(uint8_t idx) {
218 const char*
const* getDataArray() {
return dataArray; }
227class EditableMultiPartMenuItem :
public RuntimeMenuItem {
230 : RuntimeMenuItem(type,
id, renderFn, 0, numberOfParts, next) {
233 : RuntimeMenuItem(rtInfo, isPgm, type, renderFn, 0, numberOfParts, next) {
236 uint8_t beginMultiEdit();
238 int changeEditBy(
int amt);
244 [[nodiscard]]
int getCurrentRange()
const {
245 return renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_GETRANGE,
nullptr, 0);
248 void stopMultiEdit();
250 [[nodiscard]]
int getPartValueAsInt()
const {
251 return renderFn((RuntimeMenuItem*)
this, itemPosition,
RENDERFN_GETPART,
nullptr, 0);
254 bool valueChanged(
int newVal);
374class IpAddressStorage {
378 explicit IpAddressStorage(
const char* address);
379 IpAddressStorage(uint8_t p1, uint8_t p2, uint8_t p3, uint8_t p4);
380 IpAddressStorage(
const IpAddressStorage& other) =
default;
381 IpAddressStorage& operator=(
const IpAddressStorage& other) =
default;
383 void setPart(
int part, uint8_t newValue) { data[part] = newValue; }
384 uint8_t* underlyingArray() {
return data; }
460 this->hours = this->minutes = this->seconds = this->hundreds = 0;
462 TimeStorage(uint8_t hours, uint8_t minutes, uint8_t seconds = 0, uint8_t hundreds = 0) {
464 this->minutes = minutes;
465 this->seconds = seconds;
466 this->hundreds = hundreds;
468 TimeStorage(
const TimeStorage& other) =
default;
469 TimeStorage& operator=(
const TimeStorage& other) =
default;
535class DateFormattedMenuItem :
public EditableMultiPartMenuItem {
537 enum DateFormatOption { DD_MM_YYYY, MM_DD_YYYY, YYYY_MM_DD };
540 static char separator;
541 static DateFormatOption dateFormatMode;
544 : EditableMultiPartMenuItem(
MENUTYPE_DATE,
id, 3, renderFn, next), data(1, 1, 2020) {}
547 : EditableMultiPartMenuItem(
MENUTYPE_DATE,
id, 3, renderFn, next), data(initial) {}
550 : EditableMultiPartMenuItem(
info, isPgm,
MENUTYPE_DATE, 3, renderFn, next), data(initial) {}
575 dateFormatMode = fmt;
582 return dateFormatMode;
585 [[nodiscard]]
DateStorage getDate()
const {
return data; }
587 void setDate(DateStorage newDate) { data = newDate; }
589 void setDateFromString(
const char *dateText);
591 DateStorage* getUnderlyingData() {
return &data; }