-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I tried to rename methods from up/down/left/right into specific for item, something like more 'domain specific': - `changeScreen` for `ItemBack` and `ItemSubMenu` insted of `enter`. - `commitCharEdit` for `ItemInputCharset` instead of `enter`. ![image](https://github.com/user-attachments/assets/a91cdd94-7092-4543-88cd-a3fde4a5a19c) Also signature of `process` simplified and instead of `Context` pass only `LcdMenu` and char. All required dependencies (display and current screen) can be obtained from menu. Also true/false result for process method is controlled inside process method. Also simplified repeated if's Also need somehow separate value update and draw. --------- Co-authored-by: Thomas Forntoh <[email protected]>
- Loading branch information
1 parent
6995f6e
commit 830fbf4
Showing
15 changed files
with
475 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
@startuml | ||
' https://www.plantuml.com/plantuml/uml/ | ||
|
||
hide empty members | ||
left to right direction | ||
|
||
class MenuItem { | ||
#const char* text | ||
+const char* getText() | ||
+void setText(const char* text) | ||
#virtual bool process(LcdMenu* menu, const unsigned char command) | ||
#const void draw(DisplayInterface* display) | ||
#virtual void draw(DisplayInterface* display, uint8_t row) | ||
} | ||
|
||
class ItemBack { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void changeScreen(LcdMenu* menu) | ||
} | ||
|
||
class ItemSubMenu { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void changeScreen(LcdMenu* menu) | ||
} | ||
|
||
class ItemToggle { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void toggle(DisplayInterface* display) | ||
} | ||
|
||
class ItemCommand { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void executeCommand() | ||
} | ||
|
||
class ItemInput { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void up(DisplayInterface* display) | ||
#void down(DisplayInterface* display) | ||
#void enter(DisplayInterface* display) | ||
#void back(DisplayInterface* display) | ||
#void left(DisplayInterface* display) | ||
#void right(DisplayInterface* display) | ||
#void backspace(DisplayInterface* display) | ||
#void typeChar(DisplayInterface* display, const unsigned char command) | ||
#void clear(DisplayInterface* display) | ||
} | ||
|
||
class ItemInputCharset { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void initCharEdit() | ||
#void abortCharEdit(DisplayInterface* display) | ||
#void commitCharEdit(DisplayInterface* display) | ||
#void showNextChar(DisplayInterface* display) | ||
#void showPreviousChar(DisplayInterface* display) | ||
} | ||
|
||
class ItemList { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
#void selectPrevious(DisplayInterface* display) | ||
#void selectNext(DisplayInterface* display) | ||
} | ||
|
||
class ItemProgress { | ||
#bool process(LcdMenu* menu, const unsigned char command) override | ||
.. | ||
+void increment() | ||
+void decrement() | ||
} | ||
|
||
class EditMode as "???" { | ||
} | ||
|
||
note bottom of EditMode : Someone who holds edit mode | ||
|
||
ItemBack -u-|> MenuItem | ||
ItemSubMenu -u-|> MenuItem | ||
ItemToggle -u-|> MenuItem | ||
ItemCommand -u-|> MenuItem | ||
EditMode -u-|> MenuItem | ||
ItemList -u-|> EditMode | ||
ItemProgress -u-|> EditMode | ||
ItemInput -u-|> EditMode | ||
ItemInputCharset -u-|> ItemInput | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.