Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9
Fork of Menu by
Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9
Diff: Navigator.h
- Revision:
- 4:67097127da6c
- Parent:
- 3:cfc36b42ae75
- Child:
- 5:91b1bc68290b
--- a/Navigator.h Thu Jan 01 22:27:30 2015 +0000 +++ b/Navigator.h Thu Jan 01 23:00:06 2015 +0000 @@ -4,30 +4,51 @@ #include "mbed.h" #include "Menu.h" #include "TextLCD.h" -//#include "RPG.h" + +class Navigator +{ +private: + + int bottom; // the index of the last item of current menu + int cursorPos; // what selection the cursor points to + int cursorLine; // what line of the lcd the cursor is on. 1 = first line, 2 = second line + +public: + Navigator(Menu *, TextLCD_Base *); + Menu *activeMenu; // the current menu - can change when RPG is pushed on selection with child menu + + TextLCD_Base *lcd; + + /** no longer used! + * + */ + void poll(); // no longer needed! -class Navigator { - private: - - public: - Navigator(Menu *, /*RPG &,*/ TextLCD_Base *); - Menu *activeMenu; // the current menu - can change when RPG is pushed on selection with child menu -// RPG rpg; - TextLCD_Base *lcd; - - bool lastButton, button; - int direction; // 1 = CW, -1 = CCW - - int bottom; // the index of the last item of current menu - int cursorPos; // what selection the cursor points to - int cursorLine; // what line of the lcd the cursor is on. 1 = first line, 2 = second line - - void poll(); // repeatedly call this function to determine if RPG is being used - void moveUp(); - void moveDown(); - void select(); - void printMenu(); - void printCursor(); + /** Move up one line in menu + * call this method when user moves up one line + * can be triggered by RPG or Button (PinDetect) + */ + void moveUp(); + + /** Move down one line in menu + * call this method when user moves down one line + * can be triggered by RPG or Button (PinDetect) + */ + void moveDown(); + + /** User presses Select Button + * call this method when user wans to select an item + * can be triggered by RPG or Button (PinDetect) + */ + void select(); + + /** print the menu on LCD + */ + void printMenu(); + + /** print cursor on the beginning of line + */ + void printCursor(); }; -#endif \ No newline at end of file +#endif \ No newline at end of file