|
1 | 1 |
|
2 | 2 | #ifndef TCLIBRARYDEV_TCMENUBUILDER_H |
3 | 3 | #define TCLIBRARYDEV_TCMENUBUILDER_H |
| 4 | +#include "EditableLargeNumberMenuItem.h" |
4 | 5 | #include "EepromAbstraction.h" |
5 | 6 | #include "MenuItems.h" |
6 | 7 | #include "RuntimeMenuItem.h" |
7 | 8 |
|
| 9 | +class LargeFixedNumber; |
8 | 10 | class TcMenuBuilder; |
9 | 11 | struct RgbColor32; |
10 | 12 | class MenuManager; |
@@ -459,7 +461,7 @@ class TcMenuBuilder { |
459 | 461 | * @param name The display name for the menu item. |
460 | 462 | * @param eepromPosition The EEPROM storage position for persisting the value, or -1 if not stored in EEPROM. |
461 | 463 | * @param flags The flags specifying visibility, read-only status, and other properties of the menu item. |
462 | | - * @param initial The initial value for the IP address storage. |
| 464 | + * @param ipInitial The initial value for the IP address storage. |
463 | 465 | * @param callbackFn The callback function invoked when the menu item is selected or updated. |
464 | 466 | * @return Reference to the current instance of TcMenuBuilder to allow method chaining. |
465 | 467 | */ |
@@ -506,8 +508,8 @@ class TcMenuBuilder { |
506 | 508 | * |
507 | 509 | * This method facilitates the setup of a scrollable choice menu item that allows the user to select |
508 | 510 | * a value from a list of predefined choices. The ScrollChoiceBuilder returned by this method enables |
509 | | - * further customization before the item is finalized and integrated into the menu structure. When you've configured |
510 | | - * it make sure you call `endItem()` to finalize the menu item and add it to the menu structure. |
| 511 | + * further customization before the item is finalized and integrated into the menu structure. When you've finished |
| 512 | + * configuring it, make sure you call `endItem()` to finalize the menu item and add it to the menu structure. |
511 | 513 | * |
512 | 514 | * @code |
513 | 515 | * builder.scrollChoiceBuilder(myId, "Choice Menu", myRomLocation, NoMenuFlags) |
@@ -559,7 +561,7 @@ class TcMenuBuilder { |
559 | 561 | * @param eepromPosition for dynamic set to ROM_SAVE or DONT_SAVE, for legacy mode use an eeprom address. |
560 | 562 | * @param alphaChannel Boolean flag indicating whether the alpha channel is supported. |
561 | 563 | * @param flags Additional configuration flags for the menu item. |
562 | | - * @param initial The initial color value of type `RgbColor32` for the menu item. |
| 564 | + * @param initial The initial color value, for example, `RgbColor32(255, 0, 0)` for red. |
563 | 565 | * @param callbackFn A function pointer for the menu item callback, invoked on user interaction. |
564 | 566 | * @return A reference to the current `TcMenuBuilder` instance to allow for method chaining. |
565 | 567 | */ |
@@ -634,6 +636,43 @@ class TcMenuBuilder { |
634 | 636 | */ |
635 | 637 | TcMenuBuilder& listItemRtCustom(menuid_t id, const char *name, uint16_t numberOfRows, RuntimeRenderingFn rtRenderFn, MenuFlags flags, MenuCallbackFn callbackFn = nullptr); |
636 | 638 |
|
| 639 | + /** |
| 640 | + * Adds a large number menu item to the menu structure. This is used for numeric values with a significant number of digits, |
| 641 | + * including fractional parts, such as financial or scientific fields. The total and fractional places control the format |
| 642 | + * and precision of the number. |
| 643 | + * |
| 644 | + * When you edit a large number, the editing occurs one digit at a time, allowing for precise control over the number's value, |
| 645 | + * even when there's a large number of digits. |
| 646 | + * |
| 647 | + * @param id The unique identifier for the menu item. |
| 648 | + * @param name The display name of the menu item. |
| 649 | + * @param eepromPosition The EEPROM position for storing the large number value. |
| 650 | + * @param num The large fixed number, for example, `LargeFixedNumber(10, 4, 98765, 1234)` is 10.4 digits representing "98765.1234". |
| 651 | + * @param allowNegative Whether negative numbers are allowed in the large number. |
| 652 | + * @param flags Additional flags to control visibility, read-only status, or other properties of the menu item. |
| 653 | + * @param callbackFn An optional callback function that is triggered when the value changes. |
| 654 | + * @return A reference to the builder, allowing method chaining. |
| 655 | + */ |
| 656 | + TcMenuBuilder& largeNumberItem(menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber& num, |
| 657 | + bool allowNegative, MenuFlags flags, MenuCallbackFn callbackFn = nullptr); |
| 658 | + |
| 659 | + /** |
| 660 | + * Advanced construction case, adds a customized large number menu item with a renderFn callback to specialize how |
| 661 | + * it is displayed and processed. For regular large numbers use the standard method "largeNumber". |
| 662 | + * |
| 663 | + * @param id The unique identifier for the menu item. |
| 664 | + * @param name The display name of the menu item. |
| 665 | + * @param eepromPosition The EEPROM position for storing the large number value. |
| 666 | + * @param num The large fixed number, for example, `LargeFixedNumber(10, 4, 98765, 1234)` is 10.4 digits representing "98765.1234". |
| 667 | + * @param allowNegative Whether negative numbers are allowed in the large number. |
| 668 | + * @param renderFn The function used to render the list item's contents dynamically at runtime. |
| 669 | + * @param flags Additional flags to control visibility, read-only status, or other properties of the menu item. |
| 670 | + * @param callbackFn An optional callback function that is triggered when the value changes. |
| 671 | + * @return A reference to the builder, allowing method chaining. |
| 672 | + */ |
| 673 | + TcMenuBuilder& largeNumberRtCustom(menuid_t id, const char *name, EepromPosition eepromPosition, const LargeFixedNumber& num, |
| 674 | + bool allowNegative, RuntimeRenderingFn renderFn, MenuFlags flags, MenuCallbackFn callbackFn = nullptr); |
| 675 | + |
637 | 676 | /** |
638 | 677 | * Add an item to the menu that allows for authentication using EEPROM storage. This item is read-only and displays |
639 | 678 | * authentication status. When the authentication status changes, the provided callback function is invoked. |
@@ -672,7 +711,7 @@ class TcMenuBuilder { |
672 | 711 | * If the current menu has no parent, it returns a reference to the root TcMenuBuilder instance. |
673 | 712 | * This allows chaining and continuation of the menu-building process. |
674 | 713 | * |
675 | | - * @return A reference to the parent TcMenuBuilder instance, or the root builder instance if no parent exists. |
| 714 | + * @return A reference to the parent TcMenuBuilder instance or the root builder instance if no parent exists. |
676 | 715 | */ |
677 | 716 | TcMenuBuilder& endSub(); |
678 | 717 |
|
|
0 commit comments