tcMenu
Loading...
Searching...
No Matches
RuntimeMenuItem.h File Reference

Contains definitions of menu items that can be fully defined at runtime with no need for prog mem structures. More...

Go to the source code of this file.

Classes

class  RuntimeMenuItem
class  BackMenuItem
class  SubMenuItem
class  ListRuntimeMenuItem
class  EditableMultiPartMenuItem
class  TextMenuItem
class  IpAddressStorage
class  IpAddressMenuItem
struct  TimeStorage
struct  DateStorage
class  TimeFormattedMenuItem
class  DateFormattedMenuItem

Enumerations

enum  MultiEditWireType : uint8_t {
  EDITMODE_PLAIN_TEXT = 0 , EDITMODE_IP_ADDRESS = 1 , EDITMODE_TIME_24H = 2 , EDITMODE_TIME_12H = 3 ,
  EDITMODE_TIME_HUNDREDS_24H = 4 , EDITMODE_GREGORIAN_DATE = 5 , EDITMODE_TIME_DURATION_SECONDS = 6 , EDITMODE_TIME_DURATION_HUNDREDS = 7 ,
  EDITMODE_TIME_24H_HHMM = 8 , EDITMODE_TIME_12H_HHMM = 9
}

Functions

menuid_t nextRandomId ()
int textItemRenderFn (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
int ipAddressRenderFn (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
int backSubItemRenderFn (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
int timeItemRenderFn (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
int dateItemRenderFn (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
int findPositionInEditorSet (char ch)
int defaultRtListCallback (RuntimeMenuItem *item, uint8_t row, RenderFnMode mode, char *buffer, int bufferSize)
long parseIntUntilSeparator (const char *ptr, int &offset, size_t maxDigits=10)
void invokeIfSafe (MenuCallbackFn cb, MenuItem *pItem)

Detailed Description

Contains definitions of menu items that can be fully defined at runtime with no need for prog mem structures.

Enumeration Type Documentation

◆ MultiEditWireType

enum MultiEditWireType : uint8_t

Defines the filter that should be applied to values of multi edit menu items on the UI

Enumerator
EDITMODE_PLAIN_TEXT 

plain text - zero terminated text data

EDITMODE_IP_ADDRESS 

an ipV4 address

EDITMODE_TIME_24H 

a time in the 24 hour clock HH:MM:SS

EDITMODE_TIME_12H 

a time in the 12 hour clock HH:MM:SS[AM/PM]

EDITMODE_TIME_HUNDREDS_24H 

a time in the 24 hour clock with hundreds HH:MM:SS.ss

EDITMODE_GREGORIAN_DATE 

a date in gregorian format, see DateFormattedMenuItem for global locale formatting

EDITMODE_TIME_DURATION_SECONDS 

a duration that optionally shows hours when needed, to the second

EDITMODE_TIME_DURATION_HUNDREDS 

a duration that optionally shows hours when needed, to the hundredth of second

EDITMODE_TIME_24H_HHMM 

a time in the 24 hour clock HH:MM

EDITMODE_TIME_12H_HHMM 

a time in the 12 hour clock HH:MM[AM/PM]

Function Documentation

◆ nextRandomId()

menuid_t nextRandomId ( )

For items that dont need to have the same id each time (such as back menu items), we just randomly give them an ID

◆ textItemRenderFn()

int textItemRenderFn ( RuntimeMenuItem * item,
uint8_t row,
RenderFnMode mode,
char * buffer,
int bufferSize )

This is the standard renderering function used for editable text items, for use with TextMenuItem

◆ ipAddressRenderFn()

int ipAddressRenderFn ( RuntimeMenuItem * item,
uint8_t row,
RenderFnMode mode,
char * buffer,
int bufferSize )

This is the standard rendering function used for editable IP addresses, for use with IpAddressMenuItem

◆ backSubItemRenderFn()

int backSubItemRenderFn ( RuntimeMenuItem * item,
uint8_t row,
RenderFnMode mode,
char * buffer,
int bufferSize )

The default rendering function for back menu items

◆ timeItemRenderFn()

int timeItemRenderFn ( RuntimeMenuItem * item,
uint8_t row,
RenderFnMode mode,
char * buffer,
int bufferSize )

The default rendering function for time menu items

◆ dateItemRenderFn()

int dateItemRenderFn ( RuntimeMenuItem * item,
uint8_t row,
RenderFnMode mode,
char * buffer,
int bufferSize )

The default rendering function for time menu items

◆ findPositionInEditorSet()

int findPositionInEditorSet ( char ch)

helper function for text items that finds the position of a char in the allowable set of editable chars

finds the position of the character in the editor set

Parameters
chthe character to find.
Returns
the location in the allowable chars

◆ parseIntUntilSeparator()

long parseIntUntilSeparator ( const char * ptr,
int & offset,
size_t maxDigits = 10 )

Utility function to parse a string from a given offset to obtain an integer

Parameters
ptrthe pointer to the text
offseta ref to an integer that starts as the offset and is updated
Returns
the integer that was obtain before a non digit was found

◆ invokeIfSafe()

void invokeIfSafe ( MenuCallbackFn cb,
MenuItem * pItem )
inline

Invokes a menu callback if it is safe to do so

Parameters
cbcallback to make
idmenuId