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 Peihsun Yeh

Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9

Files at this revision

API Documentation at this revision

Comitter:
pyeh9
Date:
Tue Mar 05 21:24:37 2013 +0000
Parent:
1:84d263c8932d
Child:
3:cfc36b42ae75
Commit message:
Second version - with comments

Changed in this revision

Navigator.cpp Show annotated file Show diff for this revision Revisions of this file
Navigator.h Show annotated file Show diff for this revision Revisions of this file
Selection.h Show annotated file Show diff for this revision Revisions of this file
--- a/Navigator.cpp	Tue Mar 05 20:33:27 2013 +0000
+++ b/Navigator.cpp	Tue Mar 05 21:24:37 2013 +0000
@@ -7,6 +7,9 @@
     cursorLine = 1;
     button = 0;
     lastButton = 0;
+    
+    printMenu();
+    printCursor();
 }
 
 void Navigator::printMenu()
--- a/Navigator.h	Tue Mar 05 20:33:27 2013 +0000
+++ b/Navigator.h	Tue Mar 05 21:24:37 2013 +0000
@@ -10,25 +10,23 @@
     private: 
                
     public:
-        //Navigator(Menu &, RPG &, TextLCD &);
-        Navigator(Menu *root, RPG &, TextLCD *lcd);
-        Menu *activeMenu;
+        Navigator(Menu *, RPG &, TextLCD *);
+        Menu *activeMenu; // the current menu - can change when RPG is pushed on selection with child menu
         RPG rpg;
         TextLCD *lcd; 
         
         bool lastButton, button;
-        int direction;
+        int direction;  // 1 = CW, -1 = CCW
         
-        int bottom;
-        int cursorPos; // what selection the cursor points to
+        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();
+        void poll();    // repeatedly call this function to determine if RPG is being used
         void moveUp();
         void moveDown();
         void printMenu();
         void printCursor();
-        void update();
 };
 
 #endif 
\ No newline at end of file
--- a/Selection.h	Tue Mar 05 20:33:27 2013 +0000
+++ b/Selection.h	Tue Mar 05 21:24:37 2013 +0000
@@ -9,14 +9,13 @@
     private:
         
     public:
-        void (*fun)(); // pointer to a function to execute 
-        char* selText; // selection text
-        int pos; // selection position
+        void (*fun)();   // pointer to a function to execute 
+        char* selText;   // selection text
+        int pos;         // selection position
         Menu *childMenu; 
         
         Selection(void (*)(), int, Menu *, char *); 
-        
-        //debug functions 
+         
 };
 
 #endif 
\ No newline at end of file