Custom menu
Fork of Menu by
Navigator.h@4:396eff5be1a1, 2015-03-03 (annotated)
- Committer:
- LeoHsueh
- Date:
- Tue Mar 03 03:57:46 2015 +0000
- Revision:
- 4:396eff5be1a1
- Parent:
- 3:3fceb6ff921e
Fix to use FunctionPointer.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pyeh9 | 1:84d263c8932d | 1 | #ifndef NAVIGATOR_H |
pyeh9 | 1:84d263c8932d | 2 | #define NAVIGATOR_H |
pyeh9 | 1:84d263c8932d | 3 | |
pyeh9 | 1:84d263c8932d | 4 | #include "mbed.h" |
pyeh9 | 1:84d263c8932d | 5 | #include "Menu.h" |
pyeh9 | 1:84d263c8932d | 6 | #include "TextLCD.h" |
pyeh9 | 1:84d263c8932d | 7 | |
LeoHsueh | 3:3fceb6ff921e | 8 | class Navigator { |
pyeh9 | 1:84d263c8932d | 9 | public: |
LeoHsueh | 3:3fceb6ff921e | 10 | Navigator(Menu *root, TextLCD *lcd); |
LeoHsueh | 3:3fceb6ff921e | 11 | |
LeoHsueh | 3:3fceb6ff921e | 12 | void printMenu(); |
pyeh9 | 1:84d263c8932d | 13 | |
LeoHsueh | 3:3fceb6ff921e | 14 | void actionNone(); |
LeoHsueh | 3:3fceb6ff921e | 15 | void actionUp(); |
LeoHsueh | 3:3fceb6ff921e | 16 | void actionDown(); |
LeoHsueh | 3:3fceb6ff921e | 17 | void actionBack(); |
LeoHsueh | 3:3fceb6ff921e | 18 | void actionEnter(); |
LeoHsueh | 3:3fceb6ff921e | 19 | void actionHome(); |
LeoHsueh | 3:3fceb6ff921e | 20 | |
LeoHsueh | 3:3fceb6ff921e | 21 | private: |
LeoHsueh | 3:3fceb6ff921e | 22 | |
LeoHsueh | 3:3fceb6ff921e | 23 | typedef enum { |
LeoHsueh | 3:3fceb6ff921e | 24 | none, up, down, back, enter, home |
LeoHsueh | 3:3fceb6ff921e | 25 | } Status; |
LeoHsueh | 3:3fceb6ff921e | 26 | |
LeoHsueh | 3:3fceb6ff921e | 27 | Menu *root; |
LeoHsueh | 3:3fceb6ff921e | 28 | TextLCD *_lcd; |
LeoHsueh | 3:3fceb6ff921e | 29 | |
LeoHsueh | 3:3fceb6ff921e | 30 | /// the current menu can change when RPG is pushed on selection with child menu |
LeoHsueh | 3:3fceb6ff921e | 31 | Menu *activeMenu; |
LeoHsueh | 3:3fceb6ff921e | 32 | |
LeoHsueh | 3:3fceb6ff921e | 33 | ///The last action |
LeoHsueh | 3:3fceb6ff921e | 34 | Status _lastAction; |
LeoHsueh | 3:3fceb6ff921e | 35 | ///which selection the cursor points to |
LeoHsueh | 3:3fceb6ff921e | 36 | uint16_t cursorPos; |
pyeh9 | 1:84d263c8932d | 37 | }; |
pyeh9 | 1:84d263c8932d | 38 | |
LeoHsueh | 3:3fceb6ff921e | 39 | #endif |