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 | |
| TcMenuBuilder & | operator= (const TcMenuBuilder &)=default |
| TcMenuBuilder & | usingDynamicEEPROMStorage () |
| 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. | |
| TcMenuBuilder & | actionItem (menuid_t id, const char *name, MenuFlags flags, MenuCallbackFn callbackFn=nullptr) |
| Adds an action menu item to the current menu structure. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| TcMenuBuilder & | textCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, uint16_t textLength, RuntimeRenderingFn renderFn, MenuFlags flags, const char *initial="", MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | ipAddressItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | ipAddressItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, IpAddressStorage ipInitial, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | ipAddressCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, RuntimeRenderingFn renderFn, IpAddressStorage ipInitial, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | timeItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MultiEditWireType timeFormat, const TimeStorage &timeStorage, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | timeItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MultiEditWireType timeFormat, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | timeItemCustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, const TimeStorage &timeStorage, RuntimeRenderingFn renderFn, MenuFlags flags, MultiEditWireType timeFormat, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | dateItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, DateStorage initial, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | dateItem (menuid_t id, const char *name, EepromPosition eepromPosition, MenuFlags flags, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | dateItemCustomRt (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. | |
| 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. | |
| 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. | |
| TcMenuBuilder & | rgb32CustomRt (menuid_t id, const char *name, EepromPosition eepromPosition, bool alphaChannel, RuntimeRenderingFn renderFn, MenuFlags flags, const RgbColor32 &initial, MenuCallbackFn callbackFn=nullptr) |
| 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. | |
| 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. | |
| 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. | |
| TcMenuBuilder & | largeNumberItem (menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber &num, bool allowNegative, MenuFlags flags, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | largeNumberRtCustom (menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber &num, bool allowNegative, RuntimeRenderingFn renderFn, MenuFlags flags, MenuCallbackFn callbackFn=nullptr) |
| TcMenuBuilder & | eepromAuthenticationItem (menuid_t id, const char *name, MenuFlags flags, MenuCallbackFn onAuthChanged=nullptr) |
| TcMenuBuilder & | remoteConnectivityMonitor (menuid_t id, const char *name, MenuFlags flags) |
| TcMenuBuilder & | appendCustomItem (MenuItem *itemToAdd) |
| TcMenuBuilder & | endSub () |
| Ends the current submenu context and returns to the parent menu. | |
| AllMenuInfoTypes * | 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. | |
| void | putAtEndOfSub (MenuItem *toAdd) const |
| MenuItem * | getRootItem () const |
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.
| 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.
| 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| decimalPlaces | The number of decimal places to display for the float value. |
| flags | Flags to control specific display and behavior properties of the menu item. |
| initial | The initial float value of the menu item. |
| callbackFn | A callback function that is invoked when the menu item is interacted with. |
| 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| flags | Flags to control specific display and behavior properties of the menu item. |
| callbackFn | A callback function that is invoked when the menu item is interacted with. |
| 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| naming | The naming convention to use for boolean states (e.g., ON/OFF, YES/NO). |
| flags | The menu flags that define item properties and behaviors. |
| initial | The initial state of the boolean item (true or false). |
| callbackFn | The function to be called when the item's value changes. |
TcMenuBuilder, allowing for method chaining. | 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:
| id | The unique identifier for the analog menu item. |
| name | The display name for the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| flags | Configuration flags defining the item's behavior and properties. |
| initialValue | The initial value of the analog item. |
| callbackFn | The callback function invoked when the menu item value changes. |
| 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.
In the example we first create an array globally (IE outside any function), then we use that array later to build the menu item:
| id | The unique identifier for the menu item. |
| name | The text label of the menu item, displayed in the menu interface. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| enumEntries | An array of strings representing the enumeration choices for the menu item. |
| numEntries | The total number of entries in the enumeration array. |
| flags | The configuration flags for the menu item, specifying additional behaviors or properties. |
| value | The default or initial selected value of the enumerated menu item, represented as an index. |
| callbackFn | The function to call when the menu item is selected or its value changes. |
| 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.
| id | The unique identifier for the submenu item. |
| name | The display name of the submenu item. |
| flags | Flags that specify the attributes and behavior settings for the submenu item. |
| callbackFn | A function pointer for the callback executed when the submenu item is activated. |
TcMenuBuilder that represents the new submenu item, allowing for further configuration or chaining operations. | 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.
| id | The unique identifier of the menu item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| textLength | The maximum length of the text that the item can hold. |
| flags | The configuration flags that define the item's behavior and state. |
| initial | The initial text value assigned to the menu item. |
| callbackFn | The callback function triggered when the item's value changes. |
TcMenuBuilder to enable method chaining. | 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.
| id | the ID of the item |
| name | the name of the item |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| textLength | The length of the text to be edited. |
| renderFn | The callback function that will customize the control. Consult documentation for details. |
| flags | The configuration flags that define the item's behavior and state. |
| initial | the initial value, optional. |
| callbackFn | The callback function triggered when the item's value changes. |
| 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.
| id | The unique identifier for this menu item. |
| name | The display name for this menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| flags | The configuration flags that define the item's behavior and state. |
| callbackFn | An optional callback function triggered when the menu item is changed. |
| 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.
| id | The unique identifier for the menu item. |
| name | The display name for the menu item. |
| eepromPosition | The EEPROM storage position for persisting the value, or -1 if not stored in EEPROM. |
| flags | The flags specifying visibility, read-only status, and other properties of the menu item. |
| ipInitial | The initial value for the IP address storage. |
| callbackFn | The callback function invoked when the menu item is selected or updated. |
| 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eepromPosition | The EEPROM storage position for the value of this item. |
| flags | Additional menu flags controlling visibility, read-only status, etc. |
| renderFn | The callback function that will customize the control. Consult documentation for details. |
| ipInitial | The 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. |
| 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.
| id | The unique identifier for the menu item. |
| name | The display name for the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| flags | Flag options defining the item's behavior and characteristics. |
| initial | The index of the initial choice to display (default is 0). |
| callbackFn | The callback function to be triggered on value changes (default is nullptr). |
| 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.
| id | The unique menu identifier for this item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| alphaChannel | Indicates if an alpha channel (transparency) is included in the RGB color representation. |
| flags | Custom attributes or behaviors associated with the menu item, defined using the MenuFlags type. |
| callbackFn | A function callback invoked during menu value changes or actions. |
TcMenuBuilder for further configuration. | 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.
| id | The unique identifier for the RGB32 menu item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| alphaChannel | Boolean flag indicating whether the alpha channel is supported. |
| flags | Additional configuration flags for the menu item. |
| initial | The initial color value, for example, RgbColor32(255, 0, 0) for red. |
| callbackFn | A function pointer for the menu item callback, invoked on user interaction. |
TcMenuBuilder instance to allow for method chaining. | 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.
| id | The unique identifier for the RGB32 menu item. |
| name | The display name of the menu item. |
| eepromPosition | for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
| alphaChannel | Boolean flag indicating whether the alpha channel is supported. |
| renderFn | The custom rendering function for the RGB menu item. Consult the documentation |
| flags | Additional configuration flags for the menu item. |
| initial | The initial color value of type RgbColor32 for the menu item. |
| callbackFn | A function pointer for the menu item callback, invoked on user interaction. |
TcMenuBuilder instance to allow for method chaining. | 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/
| id | The unique identifier for the menu item. |
| name | The name of the menu item, displayed in the menu. |
| numberOfRows | The total number of rows (entries) in the list. |
| arrayOfItems | An array of C-strings containing the list entries. These must be stored in RAM. |
| flags | Additional configuration flags for the menu item. |
| callbackFn | A callback function invoked when interaction with the menu item occurs. |
| 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/
| id | The unique identifier for the menu item. |
| name | The name of the menu item, displayed in the menu. |
| numberOfRows | The total number of rows (entries) in the list. |
| arrayOfItems | An array of C-strings containing the list entries. These must be stored in FLASH. |
| flags | Additional configuration flags for the menu item. |
| callbackFn | A callback function invoked when interaction with the menu item occurs. |
| 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/
| id | The unique ID of the menu item. |
| name | The name (or label) of the menu item. |
| numberOfRows | The number of rows that the list item can display. |
| flags | Additional configuration flags for the menu item. |
| rtRenderFn | The function used to render the list item's contents dynamically at runtime. |
| callbackFn | The callback function that is invoked when the item is interacted with. |
TcMenuBuilder instance, allowing method chaining. | 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eepromPosition | The EEPROM position for storing the large number value. |
| num | The large fixed number, for example, LargeFixedNumber(10, 4, 98765, 1234) is 10.4 digits representing "98765.1234". |
| allowNegative | Whether negative numbers are allowed in the large number. |
| flags | Additional flags to control visibility, read-only status, or other properties of the menu item. |
| callbackFn | An optional callback function that is triggered when the value changes. |
| 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".
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eepromPosition | The EEPROM position for storing the large number value. |
| num | The large fixed number, for example, LargeFixedNumber(10, 4, 98765, 1234) is 10.4 digits representing "98765.1234". |
| allowNegative | Whether negative numbers are allowed in the large number. |
| renderFn | The function used to render the list item's contents dynamically at runtime. |
| flags | Additional flags to control visibility, read-only status, or other properties of the menu item. |
| callbackFn | An optional callback function that is triggered when the value changes. |
| 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.
| id | The unique ID of the menu item. |
| name | The name (or label) of the menu item. |
| flags | Menu flags to configure the item's behavior. |
| onAuthChanged | Optional callback function invoked when authentication status changes. |
TcMenuBuilder instance, allowing method chaining. | 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.
| id | The unique ID of the menu item. |
| name | The name (or label) of the menu item. |
| flags | Menu flags to configure the item's behavior. |
TcMenuBuilder instance, allowing method chaining. | 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.
| itemToAdd | the item to append to the menu hierarchy. The item must not be deallocated after addition! |
| 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.
| 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.
| id | The unique identifier for the menu item. |
| name | The display name of the menu item. |
| eeprom | The EEPROM position for persisting the menu item's state, or -1 if not using EEPROM. |
| maxVal | The maximum value for the menu item (interpretation depends on item type). |
| callback_fn | A callback function that will be triggered when the menu item is interacted with, or nullptr if no callback is needed. |