tcMenu
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TcMenuBuilder Class Reference

A builder class to create and configure a hierarchical menu structure. More...

#include <TcMenuBuilder.h>

Public Member Functions

 TcMenuBuilder (SubMenuItem *root, TcMenuBuilder *parent=nullptr)
 
 TcMenuBuilder (const TcMenuBuilder &)=default
 
TcMenuBuilderoperator= (const TcMenuBuilder &)=default
 
TcMenuBuilderusingDynamicEEPROMStorage ()
 
TcMenuBuilderfloatItem (menuid_t id, const char *name, EepromPosition eepromPosition, uint16_t decimalPlaces, MenuFlags flags, float initial=0.0F, MenuCallbackFn callbackFn=nullptr)
 Adds a float menu item to the current menu structure.
 
TcMenuBuilderactionItem (menuid_t id, const char *name, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Adds an action menu item to the current menu structure.
 
TcMenuBuilderboolItem (menuid_t id, const char *name, EepromPosition eepromPosition, BooleanNaming naming, MenuFlags flags, bool initial=false, MenuCallbackFn callbackFn=nullptr)
 Creates and configures a boolean menu item to be added to the menu structure.
 
AnalogItemBuilder analogBuilder (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, uint16_t initialValue=0, MenuCallbackFn callbackFn=nullptr)
 Creates and configures an analog menu item as part of the menu structure.
 
TcMenuBuilderenumItem (menuid_t id, const char *name, EepromPosition eepromPosition, const char **enumEntries, uint16_t numEntries, MenuFlags flags, uint16_t value=0, MenuCallbackFn callbackFn=nullptr)
 Adds an enumerated menu item to the menu structure.
 
TcMenuBuilder subMenu (menuid_t id, const char *name, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Creates a submenu item with the specified attributes and integrates it into the menu hierarchy.
 
TcMenuBuildertextItem (menuid_t id, const char *name, EepromPosition eepromPosition, uint16_t textLength, MenuFlags flags, const char *initial="", MenuCallbackFn callbackFn=nullptr)
 Adds a text menu item to the menu structure.
 
TcMenuBuildertextCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, uint16_t textLength, RuntimeRenderingFn renderFn, MenuFlags flags, const char *initial="", MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderipAddressItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderipAddressItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, IpAddressStorage ipInitial, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderipAddressCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, RuntimeRenderingFn renderFn, IpAddressStorage ipInitial, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuildertimeItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MultiEditWireType timeFormat, const TimeStorage &timeStorage, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuildertimeItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MultiEditWireType timeFormat, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuildertimeItemCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, const TimeStorage &timeStorage, RuntimeRenderingFn renderFn, MenuFlags flags, MultiEditWireType timeFormat, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderdateItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, DateStorage initial, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderdateItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderdateItemCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, DateStorage initial, RuntimeRenderingFn renderFn, MenuCallbackFn callbackFn=nullptr)
 
ScrollChoiceBuilder scrollChoiceBuilder (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, uint16_t initial=0, MenuCallbackFn callbackFn=nullptr)
 Creates and preconfigures a ScrollChoiceBuilder to define a scrollable choice menu item.
 
TcMenuBuilderrgb32Item (menuid_t id, const char *name, EepromPosition eepromPosition, bool alphaChannel, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Configures and adds a 32-bit RGB menu item to the menu structure.
 
TcMenuBuilderrgb32Item (menuid_t id, const char *name, EepromPosition eepromPosition, bool alphaChannel, MenuFlags flags, const RgbColor32 &initial, MenuCallbackFn callbackFn=nullptr)
 Adds an RGB32 menu item to the current menu being built.
 
TcMenuBuilderrgb32CustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, bool alphaChannel, RuntimeRenderingFn renderFn, MenuFlags flags, const RgbColor32 &initial, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderlistItemRam (menuid_t id, const char *name, uint16_t numberOfRows, const char **arrayOfItems, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Adds a list menu item to the menu structure with content stored in RAM.
 
TcMenuBuilderlistItemFlash (menuid_t id, const char *name, uint16_t numberOfRows, const char **arrayOfItems, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Adds a list menu item to the menu structure with content stored in FLASH.
 
TcMenuBuilderlistItemRtCustom (menuid_t id, const char *name, uint16_t numberOfRows, RuntimeRenderingFn rtRenderFn, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 Adds a runtime custom list item to the menu structure.
 
TcMenuBuilderlargeNumberItem (menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber &num, bool allowNegative, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuilderlargeNumberRtCustom (menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber &num, bool allowNegative, RuntimeRenderingFn renderFn, MenuFlags flags, MenuCallbackFn callbackFn=nullptr)
 
TcMenuBuildereepromAuthenticationItem (menuid_t id, const char *name, MenuFlags flags, MenuCallbackFn onAuthChanged=nullptr)
 
TcMenuBuilderremoteConnectivityMonitor (menuid_t id, const char *name, MenuFlags flags)
 
TcMenuBuilderappendCustomItem (MenuItem *itemToAdd)
 
TcMenuBuilderendSub ()
 Ends the current submenu context and returns to the parent menu.
 
AllMenuInfoTypesfillInAnyInfo (menuid_t id, const char *name, int eeprom, int maxVal, MenuCallbackFn callback_fn)
 Fills in an AnyInfoReserve structure with the provided menu item information.
 
void putAtEndOfSub (MenuItem *toAdd) const
 
MenuItemgetRootItem () const
 

Detailed Description

A builder class to create and configure a hierarchical menu structure.

This class provides a fluent API to define and organize menu items such as actions, text items, numeric items, submenus, and other specialized items. It maintains a tree-like structure of menu components, where each menu may have submenus or other related items.

The class ensures the correct organization of menu items within containers using a parent-child hierarchy. It supports a wide range of menu item types, allowing for customization of behavior, storage, and rendering.

Note
Because menu creation happens at runtime, this builder cannot use PROGMEM storage for menu data, resulting in increased RAM memory usage compared to compile-time menu definition approaches. All menu structures, strings, and metadata must be allocated in RAM. For most menus, even on large AVR boards such as MEGA2560 the difference is negligible. However, you can still use the legacy static way if your case requires it.

Member Function Documentation

◆ usingDynamicEEPROMStorage()

TcMenuBuilder & TcMenuBuilder::usingDynamicEEPROMStorage ( )

This is now the recommended way to store menu structures in EEPROM. It allows for dynamic menu configurations without the need for compile-time menu definitions, which can be beneficial for applications with changing menu requirements or frequent updates. If you use this mode to enable eeprom storage for an item simply use "ROM_SAVE" or "DONT_SAVE" in the eeprom position.

◆ floatItem()

TcMenuBuilder & TcMenuBuilder::floatItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
uint16_t  decimalPlaces,
MenuFlags  flags,
float  initial = 0.0F,
MenuCallbackFn  callbackFn = nullptr 
)

Adds a float menu item to the current menu structure.

Float items in TcMenu are read only, for editable numeric items see "analogBuilder" and "largeNumberItem".

This method configures and adds a floating-point menu item with specified properties, such as the number of decimal places and an initial value. The float item is integrated within the parent menu hierarchy during the build process. Additional behavior and display attributes can be controlled using the provided flags and callback function.

See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/float-menu-item/
Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
decimalPlacesThe number of decimal places to display for the float value.
flagsFlags to control specific display and behavior properties of the menu item.
initialThe initial float value of the menu item.
callbackFnA callback function that is invoked when the menu item is interacted with.
Returns
Reference to the current instance of TcMenuBuilder to allow chaining additional builders.

◆ actionItem()

TcMenuBuilder & TcMenuBuilder::actionItem ( menuid_t  id,
const char *  name,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds an action menu item to the current menu structure.

Action items are menu items that trigger a callback function when selected. They are typically used for executing specific actions or commands within the menu system.

See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/action-menu-item/
Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
flagsFlags to control specific display and behavior properties of the menu item.
callbackFnA callback function that is invoked when the menu item is interacted with.
Returns
Reference to the current instance of TcMenuBuilder to allow chaining additional builders.

◆ boolItem()

TcMenuBuilder & TcMenuBuilder::boolItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
BooleanNaming  naming,
MenuFlags  flags,
bool  initial = false,
MenuCallbackFn  callbackFn = nullptr 
)

Creates and configures a boolean menu item to be added to the menu structure.

This method allows the user to define the attributes of a boolean menu item, including its identifier, display name, EEPROM storage position, naming convention, flags, initial state, and callback function. The resulting menu item is integrated into the menu system and linked to its parent container.

See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/boolean-menu-item/
Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
namingThe naming convention to use for boolean states (e.g., ON/OFF, YES/NO).
flagsThe menu flags that define item properties and behaviors.
initialThe initial state of the boolean item (true or false).
callbackFnThe function to be called when the item's value changes.
Returns
A reference to the TcMenuBuilder, allowing for method chaining.

◆ analogBuilder()

AnalogItemBuilder TcMenuBuilder::analogBuilder ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
MenuFlags  flags,
uint16_t  initialValue = 0,
MenuCallbackFn  callbackFn = nullptr 
)

Creates and configures an analog menu item as part of the menu structure.

This method initializes an analog menu item with provided attributes such as ID, name, EEPROM position, flags, initial value, and a callback function. It adds the item to the current menu structure and returns an AnalogItemBuilder for further configuration. The pattern for using this is:

builder.analogBuilder(myId, "Analog1", ROM_SAVE, NoMenuFlags)
.offset(10)
.divisor(100)
.step(1)
.maxValue(100)
.unit("V")
.endItem() // <<== return back to building menu items
boolItem(....)
TcMenuBuilder & boolItem(menuid_t id, const char *name, EepromPosition eepromPosition, BooleanNaming naming, MenuFlags flags, bool initial=false, MenuCallbackFn callbackFn=nullptr)
Creates and configures a boolean menu item to be added to the menu structure.
Definition TcMenuBuilder.cpp:148
See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/analog-menu-item/
Parameters
idThe unique identifier for the analog menu item.
nameThe display name for the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
flagsConfiguration flags defining the item's behavior and properties.
initialValueThe initial value of the analog item.
callbackFnThe callback function invoked when the menu item value changes.
Returns
AnalogItemBuilder to configure the analog item, call "endItem()" once done to finalize and return to menu building.

◆ enumItem()

TcMenuBuilder & TcMenuBuilder::enumItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
const char **  enumEntries,
uint16_t  numEntries,
MenuFlags  flags,
uint16_t  value = 0,
MenuCallbackFn  callbackFn = nullptr 
)

Adds an enumerated menu item to the menu structure.

This method allows the creation of an enumerated menu item, where the user can select one value from a predefined list of options. The options are represented as an array of string identifiers, providing a set number of choices for the menu item.

See also
https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/enum-menu-item/

In the example we first create an array globally (IE outside any function), then we use that array later to build the menu item:

// 1. globally define a array of strings
const char enumArray[] = { "Hello", "World" };
// 2. use the array to create an item
tcMenuBuilder.enumItem(myId, "Greeting", myPositionInRom, enumArray, 2, 0, nullptr);
Parameters
idThe unique identifier for the menu item.
nameThe text label of the menu item, displayed in the menu interface.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
enumEntriesAn array of strings representing the enumeration choices for the menu item.
numEntriesThe total number of entries in the enumeration array.
flagsThe configuration flags for the menu item, specifying additional behaviors or properties.
valueThe default or initial selected value of the enumerated menu item, represented as an index.
callbackFnThe function to call when the menu item is selected or its value changes.
Returns
A reference to the current instance of TcMenuBuilder for chaining additional menu item declarations

◆ subMenu()

TcMenuBuilder TcMenuBuilder::subMenu ( menuid_t  id,
const char *  name,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Creates a submenu item with the specified attributes and integrates it into the menu hierarchy.

This method allows the creation of a submenu within the current menu structure by providing its unique ID, name, flags, and callback function. A back menu item will also be added, this becomes the title for the submenu when it is on display, and so it is the first item in the submenu.

Once you call this method, you're in a new stacked MenuBuilder that is building for that submenu. To exit this submenu you call endSub which takes you back to the previous level.

Parameters
idThe unique identifier for the submenu item.
nameThe display name of the submenu item.
flagsFlags that specify the attributes and behavior settings for the submenu item.
callbackFnA function pointer for the callback executed when the submenu item is activated.
Returns
A new instance of TcMenuBuilder that represents the new submenu item, allowing for further configuration or chaining operations.

◆ textItem()

TcMenuBuilder & TcMenuBuilder::textItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
uint16_t  textLength,
MenuFlags  flags,
const char *  initial = "",
MenuCallbackFn  callbackFn = nullptr 
)

Adds a text menu item to the menu structure.

This method creates and configures a text menu item with the specified parameters. The text item is used to store and edit textual data in the menu. The method allocates the necessary resources and integrates the created item with the menu hierarchy.

https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/editabletext-menu-item/

Parameters
idThe unique identifier of the menu item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
textLengthThe maximum length of the text that the item can hold.
flagsThe configuration flags that define the item's behavior and state.
initialThe initial text value assigned to the menu item.
callbackFnThe callback function triggered when the item's value changes.
Returns
A reference to the current instance of TcMenuBuilder to enable method chaining.

◆ textCustomRt()

TcMenuBuilder & TcMenuBuilder::textCustomRt ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
uint16_t  textLength,
RuntimeRenderingFn  renderFn,
MenuFlags  flags,
const char *  initial = "",
MenuCallbackFn  callbackFn = nullptr 
)

Advanced build option for override of the regular text component for advanced cases, for example editing values that need customization such as editing hex values for example.

Parameters
idthe ID of the item
namethe name of the item
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
textLengthThe length of the text to be edited.
renderFnThe callback function that will customize the control. Consult documentation for details.
flagsThe configuration flags that define the item's behavior and state.
initialthe initial value, optional.
callbackFnThe callback function triggered when the item's value changes.
Returns

◆ ipAddressItem() [1/2]

TcMenuBuilder & TcMenuBuilder::ipAddressItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds an IP address menu item to the menu structure. This item allows the user to interact with and configure an IP address.

Parameters
idThe unique identifier for this menu item.
nameThe display name for this menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
flagsThe configuration flags that define the item's behavior and state.
callbackFnAn optional callback function triggered when the menu item is changed.
Returns
Reference to the TcMenuBuilder instance to allow for method chaining.

◆ ipAddressItem() [2/2]

TcMenuBuilder & TcMenuBuilder::ipAddressItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
MenuFlags  flags,
IpAddressStorage  ipInitial,
MenuCallbackFn  callbackFn = nullptr 
)

Adds an IP Address type menu item to the menu structure being built. The IP Address menu item allows users to configure or display an IP address directly within the menu.

Parameters
idThe unique identifier for the menu item.
nameThe display name for the menu item.
eepromPositionThe EEPROM storage position for persisting the value, or -1 if not stored in EEPROM.
flagsThe flags specifying visibility, read-only status, and other properties of the menu item.
ipInitialThe initial value for the IP address storage.
callbackFnThe callback function invoked when the menu item is selected or updated.
Returns
Reference to the current instance of TcMenuBuilder to allow method chaining.

◆ ipAddressCustomRt()

TcMenuBuilder & TcMenuBuilder::ipAddressCustomRt ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
MenuFlags  flags,
RuntimeRenderingFn  renderFn,
IpAddressStorage  ipInitial,
MenuCallbackFn  callbackFn = nullptr 
)

Advanced construction/build option. Adds a custom IP address menu item to the menu using the provided parameters. This method allows customization of properties such as the menu ID, display name, EEPROM storage position, flags, initial IP address, and an optional callback function.

Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromPositionThe EEPROM storage position for the value of this item.
flagsAdditional menu flags controlling visibility, read-only status, etc.
renderFnThe callback function that will customize the control. Consult documentation for details.
ipInitialThe initial value for the IP address to be displayed or stored.
callbackFn(Optional) A callback function invoked when the menu item is interacted with. Defaults to nullptr if not provided.
Returns
A reference to the TcMenuBuilder for further modification or chaining of method calls.

◆ scrollChoiceBuilder()

ScrollChoiceBuilder TcMenuBuilder::scrollChoiceBuilder ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
MenuFlags  flags,
uint16_t  initial = 0,
MenuCallbackFn  callbackFn = nullptr 
)

Creates and preconfigures a ScrollChoiceBuilder to define a scrollable choice menu item.

This method facilitates the setup of a scrollable choice menu item that allows the user to select a value from a list of predefined choices. The ScrollChoiceBuilder returned by this method enables further customization before the item is finalized and integrated into the menu structure. When you've finished configuring it, make sure you call endItem() to finalize the menu item and add it to the menu structure.

builder.scrollChoiceBuilder(myId, "Choice Menu", myRomLocation, NoMenuFlags)
.fromRomChoices(romArrayLocation, numItems, fixedItemSize);
.cachingEepromValues()
.endItem(); <<== return back to building menu items
.boolItem(...)
Parameters
idThe unique identifier for the menu item.
nameThe display name for the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
flagsFlag options defining the item's behavior and characteristics.
initialThe index of the initial choice to display (default is 0).
callbackFnThe callback function to be triggered on value changes (default is nullptr).
Returns
ScrollChoiceBuilder to configure the item, call "commit()" once done to finalize and return to menu building.

◆ rgb32Item() [1/2]

TcMenuBuilder & TcMenuBuilder::rgb32Item ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
bool  alphaChannel,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Configures and adds a 32-bit RGB menu item to the menu structure.

This method enables the creation of a menu item that represents a 32-bit RGB color value. The color can optionally include an alpha channel for transparency. The item properties, such as identifier, display name, EEPROM storage position, and associated flags, are defined during configuration. The color item's state can be modified or retrieved via callback functions.

Parameters
idThe unique menu identifier for this item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
alphaChannelIndicates if an alpha channel (transparency) is included in the RGB color representation.
flagsCustom attributes or behaviors associated with the menu item, defined using the MenuFlags type.
callbackFnA function callback invoked during menu value changes or actions.
Returns
A reference to the current instance of the TcMenuBuilder for further configuration.

◆ rgb32Item() [2/2]

TcMenuBuilder & TcMenuBuilder::rgb32Item ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
bool  alphaChannel,
MenuFlags  flags,
const RgbColor32 initial,
MenuCallbackFn  callbackFn = nullptr 
)

Adds an RGB32 menu item to the current menu being built.

This method allows for the creation and integration of a 32-bit RGB color menu item into the menu hierarchy. The item supports optional alpha channel functionality and can be initialized with a provided starting color value. Configurable flags and a callback function define the behavior and interactions of the item. The method uses the fluent interface pattern, returning a reference to the current TcMenuBuilder instance for chaining further menu additions.

Parameters
idThe unique identifier for the RGB32 menu item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
alphaChannelBoolean flag indicating whether the alpha channel is supported.
flagsAdditional configuration flags for the menu item.
initialThe initial color value, for example, RgbColor32(255, 0, 0) for red.
callbackFnA function pointer for the menu item callback, invoked on user interaction.
Returns
A reference to the current TcMenuBuilder instance to allow for method chaining.

◆ rgb32CustomRt()

TcMenuBuilder & TcMenuBuilder::rgb32CustomRt ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
bool  alphaChannel,
RuntimeRenderingFn  renderFn,
MenuFlags  flags,
const RgbColor32 initial,
MenuCallbackFn  callbackFn = nullptr 
)

Advanced construction/build case for RGB items where you need to override the menu in a custom way. This is normally used when you want to customize the rendering or behavior of the RGB menu item beyond the standard options.

Parameters
idThe unique identifier for the RGB32 menu item.
nameThe display name of the menu item.
eepromPositionfor dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address.
alphaChannelBoolean flag indicating whether the alpha channel is supported.
renderFnThe custom rendering function for the RGB menu item. Consult the documentation
flagsAdditional configuration flags for the menu item.
initialThe initial color value of type RgbColor32 for the menu item.
callbackFnA function pointer for the menu item callback, invoked on user interaction.
Returns
A reference to the current TcMenuBuilder instance to allow for method chaining.

◆ listItemRam()

TcMenuBuilder & TcMenuBuilder::listItemRam ( menuid_t  id,
const char *  name,
uint16_t  numberOfRows,
const char **  arrayOfItems,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds a list menu item to the menu structure with content stored in RAM.

This method creates a runtime-configurable list menu item, where the items in the list and their metadata are stored in RAM. The list menu item is added as a child to the current submenu. List Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/list-menu-item/

Parameters
idThe unique identifier for the menu item.
nameThe name of the menu item, displayed in the menu.
numberOfRowsThe total number of rows (entries) in the list.
arrayOfItemsAn array of C-strings containing the list entries. These must be stored in RAM.
flagsAdditional configuration flags for the menu item.
callbackFnA callback function invoked when interaction with the menu item occurs.
Returns
A reference to the current TcMenuBuilder, allowing fluent-style chaining.

◆ listItemFlash()

TcMenuBuilder & TcMenuBuilder::listItemFlash ( menuid_t  id,
const char *  name,
uint16_t  numberOfRows,
const char **  arrayOfItems,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds a list menu item to the menu structure with content stored in FLASH.

This method creates a runtime-configurable list menu item, where the items in the list items are stored in FLASH. The list menu item is added as a child to the current submenu. List Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/list-menu-item/

Parameters
idThe unique identifier for the menu item.
nameThe name of the menu item, displayed in the menu.
numberOfRowsThe total number of rows (entries) in the list.
arrayOfItemsAn array of C-strings containing the list entries. These must be stored in FLASH.
flagsAdditional configuration flags for the menu item.
callbackFnA callback function invoked when interaction with the menu item occurs.
Returns
A reference to the current TcMenuBuilder, allowing fluent-style chaining.

◆ listItemRtCustom()

TcMenuBuilder & TcMenuBuilder::listItemRtCustom ( menuid_t  id,
const char *  name,
uint16_t  numberOfRows,
RuntimeRenderingFn  rtRenderFn,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds a runtime custom list item to the menu structure.

This method allows the addition of a list item that uses a custom runtime rendering function to dynamically determine its content. The item is read-only by default and can display multiple rows of data. List Docs - https://tcmenu.github.io/documentation/arduino-libraries/tc-menu/menu-item-types/list-menu-item/

Parameters
idThe unique ID of the menu item.
nameThe name (or label) of the menu item.
numberOfRowsThe number of rows that the list item can display.
flagsAdditional configuration flags for the menu item.
rtRenderFnThe function used to render the list item's contents dynamically at runtime.
callbackFnThe callback function that is invoked when the item is interacted with.
Returns
A reference to the current TcMenuBuilder instance, allowing method chaining.

◆ largeNumberItem()

TcMenuBuilder & TcMenuBuilder::largeNumberItem ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
const LargeFixedNumber num,
bool  allowNegative,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Adds a large number menu item to the menu structure. This is used for numeric values with a significant number of digits, including fractional parts, such as financial or scientific fields. The total and fractional places control the format and precision of the number.

When you edit a large number, the editing occurs one digit at a time, allowing for precise control over the number's value, even when there's a large number of digits.

Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromPositionThe EEPROM position for storing the large number value.
numThe large fixed number, for example, LargeFixedNumber(10, 4, 98765, 1234) is 10.4 digits representing "98765.1234".
allowNegativeWhether negative numbers are allowed in the large number.
flagsAdditional flags to control visibility, read-only status, or other properties of the menu item.
callbackFnAn optional callback function that is triggered when the value changes.
Returns
A reference to the builder, allowing method chaining.

◆ largeNumberRtCustom()

TcMenuBuilder & TcMenuBuilder::largeNumberRtCustom ( menuid_t  id,
const char *  name,
EepromPosition  eepromPosition,
const LargeFixedNumber num,
bool  allowNegative,
RuntimeRenderingFn  renderFn,
MenuFlags  flags,
MenuCallbackFn  callbackFn = nullptr 
)

Advanced construction case, adds a customized large number menu item with a renderFn callback to specialize how it is displayed and processed. For regular large numbers use the standard method "largeNumber".

Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromPositionThe EEPROM position for storing the large number value.
numThe large fixed number, for example, LargeFixedNumber(10, 4, 98765, 1234) is 10.4 digits representing "98765.1234".
allowNegativeWhether negative numbers are allowed in the large number.
renderFnThe function used to render the list item's contents dynamically at runtime.
flagsAdditional flags to control visibility, read-only status, or other properties of the menu item.
callbackFnAn optional callback function that is triggered when the value changes.
Returns
A reference to the builder, allowing method chaining.

◆ eepromAuthenticationItem()

TcMenuBuilder & TcMenuBuilder::eepromAuthenticationItem ( menuid_t  id,
const char *  name,
MenuFlags  flags,
MenuCallbackFn  onAuthChanged = nullptr 
)

Add an item to the menu that allows for authentication using EEPROM storage. This item is read-only and displays authentication status. When the authentication status changes, the provided callback function is invoked.

Parameters
idThe unique ID of the menu item.
nameThe name (or label) of the menu item.
flagsMenu flags to configure the item's behavior.
onAuthChangedOptional callback function invoked when authentication status changes.
Returns
A reference to the current TcMenuBuilder instance, allowing method chaining.

◆ remoteConnectivityMonitor()

TcMenuBuilder & TcMenuBuilder::remoteConnectivityMonitor ( menuid_t  id,
const char *  name,
MenuFlags  flags 
)

Add an item to the menu that provides remote connectivity monitoring. This item is read-only and displays connectivity status.

Parameters
idThe unique ID of the menu item.
nameThe name (or label) of the menu item.
flagsMenu flags to configure the item's behavior.
Returns
A reference to the current TcMenuBuilder instance, allowing method chaining.

◆ appendCustomItem()

TcMenuBuilder & TcMenuBuilder::appendCustomItem ( MenuItem itemToAdd)

Add an item that you've created manually, such as a custom item outside the scope of this builder. For example, if you had used the traditional static method for some complex items, you could add them using this method.

Parameters
itemToAddthe item to append to the menu hierarchy. The item must not be deallocated after addition!
Returns
A reference to the current TcMenuBuilder instance for method chaining.

◆ endSub()

TcMenuBuilder & TcMenuBuilder::endSub ( )

Ends the current submenu context and returns to the parent menu.

This method exits the current submenu level and transitions back to the parent menu context. If the current menu has no parent, it returns a reference to the root TcMenuBuilder instance. This allows chaining and continuation of the menu-building process.

Returns
A reference to the parent TcMenuBuilder instance or the root builder instance if no parent exists.

◆ fillInAnyInfo()

AllMenuInfoTypes * TcMenuBuilder::fillInAnyInfo ( menuid_t  id,
const char *  name,
int  eeprom,
int  maxVal,
MenuCallbackFn  callback_fn 
)

Fills in an AnyInfoReserve structure with the provided menu item information.

This method reserves and populates an AnyInfoReserve object with the specified menu item parameters. It is typically used internally by the builder to prepare menu item metadata before creating and registering a new menu item in the hierarchy. It is probably only useful along with custom menu item creation.

If you're creating custom menu items, then you can use this method to set up the necessary info metadata for your custom item before adding it to the menu hierarchy.

Parameters
idThe unique identifier for the menu item.
nameThe display name of the menu item.
eepromThe EEPROM position for persisting the menu item's state, or -1 if not using EEPROM.
maxValThe maximum value for the menu item (interpretation depends on item type).
callback_fnA callback function that will be triggered when the menu item is interacted with, or nullptr if no callback is needed.
Returns
A pointer to an info object containing the populated menu item information.

The documentation for this class was generated from the following files: