11 #ifndef _RUNTIME_MENUITEM_H_
12 #define _RUNTIME_MENUITEM_H_
18 #ifndef RANDOM_ID_START
19 #define RANDOM_ID_START 30000
82 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
85 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
87 void copyValue(
char* buffer,
int bufferSize)
const {
92 int getRuntimeId()
const {
return int(
id); }
94 uint8_t getNumberOfParts()
const {
return noOfParts; }
95 void copyRuntimeName(
char* buffer,
int bufferSize)
const { renderFn((
RuntimeMenuItem*)
this, itemPosition,
RENDERFN_NAME, buffer, bufferSize);}
97 uint8_t getNumberOfRows()
const {
return noOfParts; }
98 uint8_t getItemPosition()
const {
return itemPosition; }
100 void setNumberOfRows(uint8_t rows) {
184 void setChild(
MenuItem* firstChildItem) { this->child = firstChildItem; }
187 #define LIST_PARENT_ITEM_POS 0xff
200 enum ListMode: uint8_t { CUSTOM_RENDER, RAM_ARRAY, FLASH_ARRAY };
202 const char*
const* dataArray;
204 ListMode listMode = CUSTOM_RENDER;
214 ListMode getListMode()
const {
return listMode;}
215 bool isActingAsParent()
const {
return itemPosition == LIST_PARENT_ITEM_POS; }
216 uint8_t getActiveIndex()
const {
return activeItem; }
217 void setActiveIndex(uint8_t idx) {
221 const char*
const* getDataArray() {
return dataArray; }
236 :
RuntimeMenuItem(rtInfo, isPgm, type, renderFn, 0, numberOfParts, next) {
239 uint8_t beginMultiEdit();
241 int changeEditBy(
int amt);
247 int getCurrentRange()
const {
251 void stopMultiEdit();
253 int getPartValueAsInt()
const {
257 bool valueChanged(
int newVal);
261 #define ALLOWABLE_CHARS_ENCODER_SIZE 94
313 void setPasswordField(
bool pwd) {
314 this->passwordField = pwd;
321 return this->passwordField;
334 void setTextValue(
const char* text,
bool silent =
false);
363 void initTextItem(
const char* initialData);
386 void setPart(
int part, uint8_t newValue) { data[part] = newValue; }
387 uint8_t* underlyingArray() {
return data; }
441 void setIpAddress(
const char* source);
456 void setIpPart(uint8_t part, uint8_t newVal);
465 this->hours = this->minutes = this->seconds = this->hundreds = 0;
467 TimeStorage(uint8_t hours, uint8_t minutes, uint8_t seconds = 0, uint8_t hundreds = 0) {
469 this->minutes = minutes;
470 this->seconds = seconds;
471 this->hundreds = hundreds;
491 year = day = month = 0;
542 enum DateFormatOption { DD_MM_YYYY, MM_DD_YYYY, YYYY_MM_DD };
545 static char separator;
546 static DateFormatOption dateFormatMode;
580 dateFormatMode = fmt;
587 return dateFormatMode;
592 void setDate(
DateStorage newDate) { data = newDate; }
594 void setDateFromString(
const char *dateText);
624 #define RENDERING_CALLBACK_NAME_INVOKE(fnName, parent, namepgm, eepromPosition, invoke) \
625 const char fnName##Pgm[] PROGMEM = namepgm; \
626 int fnName(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int buffSize) { \
628 case RENDERFN_NAME: \
629 safeProgCpy(buffer, fnName##Pgm, buffSize); \
631 case RENDERFN_INVOKE: \
632 invokeIfSafe(invoke, item); \
634 case RENDERFN_EEPROM_POS: \
635 return eepromPosition; \
637 return parent(item, row, mode, buffer, buffSize); \
651 #define RENDERING_CALLBACK_NAME_OVERRIDDEN(fnName, customFn, namepgm, eepromPosition) \
652 const char fnName##Pgm[] PROGMEM = namepgm; \
653 int fnName(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int buffSize) { \
655 case RENDERFN_NAME: \
656 if(customFn(item, row, mode, buffer, buffSize) == false) { \
657 safeProgCpy(buffer, fnName##Pgm, buffSize); \
660 case RENDERFN_EEPROM_POS: \
661 return eepromPosition; \
663 return customFn(item, row, mode, buffer, buffSize); \
Definition: RuntimeMenuItem.h:377
Definition: RuntimeMenuItem.h:485
Definition: RuntimeMenuItem.h:463
A series of utilities that used throughout tcMenu.