11 #ifndef _RUNTIME_MENUITEM_H_
12 #define _RUNTIME_MENUITEM_H_
18 #define RANDOM_ID_START 50000
80 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
83 uint8_t itemPosition, uint8_t numberOfRows,
MenuItem* next =
nullptr);
85 void copyValue(
char* buffer,
int bufferSize)
const {
90 int getRuntimeId()
const {
return int(
id); }
92 uint8_t getNumberOfParts()
const {
return noOfParts; }
93 void copyRuntimeName(
char* buffer,
int bufferSize)
const { renderFn((
RuntimeMenuItem*)
this, itemPosition,
RENDERFN_NAME, buffer, bufferSize);}
95 uint8_t getNumberOfRows()
const {
return noOfParts; }
96 uint8_t getItemPosition()
const {
return itemPosition; }
98 void setNumberOfRows(uint8_t rows) {
182 void setChild(
MenuItem* firstChildItem) { this->child = firstChildItem; }
185 #define LIST_PARENT_ITEM_POS 0xff
198 enum ListMode: uint8_t { CUSTOM_RENDER, RAM_ARRAY, FLASH_ARRAY };
200 const char*
const* dataArray;
202 ListMode listMode = CUSTOM_RENDER;
212 ListMode getListMode()
const {
return listMode;}
213 bool isActingAsParent()
const {
return itemPosition == LIST_PARENT_ITEM_POS; }
214 uint8_t getActiveIndex()
const {
return activeItem; }
215 void setActiveIndex(uint8_t idx) {
219 const char*
const* getDataArray() {
return dataArray; }
234 :
RuntimeMenuItem(rtInfo, isPgm, type, renderFn, 0, numberOfParts, next) {
237 uint8_t beginMultiEdit();
239 int changeEditBy(
int amt);
245 int getCurrentRange()
const {
249 void stopMultiEdit();
251 int getPartValueAsInt()
const {
255 bool valueChanged(
int newVal);
259 #define ALLOWABLE_CHARS_ENCODER_SIZE 94
311 void setPasswordField(
bool pwd) {
312 this->passwordField = pwd;
319 return this->passwordField;
332 void setTextValue(
const char* text,
bool silent =
false);
361 void initTextItem(
const char* initialData);
384 void setPart(
int part, uint8_t newValue) { data[part] = newValue; }
385 uint8_t* underlyingArray() {
return data; }
439 void setIpAddress(
const char* source);
454 void setIpPart(uint8_t part, uint8_t newVal);
463 this->hours = this->minutes = this->seconds = this->hundreds = 0;
465 TimeStorage(uint8_t hours, uint8_t minutes, uint8_t seconds = 0, uint8_t hundreds = 0) {
467 this->minutes = minutes;
468 this->seconds = seconds;
469 this->hundreds = hundreds;
489 year = day = month = 0;
540 enum DateFormatOption { DD_MM_YYYY, MM_DD_YYYY, YYYY_MM_DD };
543 static char separator;
544 static DateFormatOption dateFormatMode;
578 dateFormatMode = fmt;
585 return dateFormatMode;
590 void setDate(
DateStorage newDate) { data = newDate; }
592 void setDateFromString(
const char *dateText);
622 #define RENDERING_CALLBACK_NAME_INVOKE(fnName, parent, namepgm, eepromPosition, invoke) \
623 const char fnName##Pgm[] PROGMEM = namepgm; \
624 int fnName(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int buffSize) { \
626 case RENDERFN_NAME: \
627 safeProgCpy(buffer, fnName##Pgm, buffSize); \
629 case RENDERFN_INVOKE: \
630 invokeIfSafe(invoke, item); \
632 case RENDERFN_EEPROM_POS: \
633 return eepromPosition; \
635 return parent(item, row, mode, buffer, buffSize); \
649 #define RENDERING_CALLBACK_NAME_OVERRIDDEN(fnName, customFn, namepgm, eepromPosition) \
650 const char fnName##Pgm[] PROGMEM = namepgm; \
651 int fnName(RuntimeMenuItem* item, uint8_t row, RenderFnMode mode, char* buffer, int buffSize) { \
653 case RENDERFN_NAME: \
654 if(customFn(item, row, mode, buffer, buffSize) == false) { \
655 safeProgCpy(buffer, fnName##Pgm, buffSize); \
658 case RENDERFN_EEPROM_POS: \
659 return eepromPosition; \
661 return customFn(item, row, mode, buffer, buffSize); \
Definition: RuntimeMenuItem.h:375
Definition: RuntimeMenuItem.h:483
Definition: RuntimeMenuItem.h:461
A series of utilities that used throughout tcMenu.