Custom menu

Fork of Menu by Peihsun Yeh

Files at this revision

API Documentation at this revision

Comitter:
LeoHsueh
Date:
Tue Mar 03 03:57:46 2015 +0000
Parent:
3:3fceb6ff921e
Commit message:
Fix to use FunctionPointer.

Changed in this revision

Navigator.cpp Show annotated file Show diff for this revision Revisions of this file
Selection.cpp 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
diff -r 3fceb6ff921e -r 396eff5be1a1 Navigator.cpp
--- a/Navigator.cpp	Thu Feb 26 11:57:11 2015 +0000
+++ b/Navigator.cpp	Tue Mar 03 03:57:46 2015 +0000
@@ -53,7 +53,7 @@
 void Navigator::actionEnter() {
     if (_lastAction != enter) {
         if (activeMenu->selections[cursorPos].fun != NULL) {
-            (activeMenu->selections[cursorPos].fun)();
+            activeMenu->selections[cursorPos].fun->call();
             printMenu();
         }
         if (activeMenu->selections[cursorPos].childMenu != NULL) {
diff -r 3fceb6ff921e -r 396eff5be1a1 Selection.cpp
--- a/Selection.cpp	Thu Feb 26 11:57:11 2015 +0000
+++ b/Selection.cpp	Tue Mar 03 03:57:46 2015 +0000
@@ -2,5 +2,5 @@
 #include "Selection.h"
 #include "TextLCD.h"
 
-Selection::Selection(void (*fun)(), int position, Menu *child, const char* text) :
+Selection::Selection(FunctionPointer *fun, int position, Menu *child, const char* text) :
     fun(fun), selText(text), pos(position), childMenu(child) {}
diff -r 3fceb6ff921e -r 396eff5be1a1 Selection.h
--- a/Selection.h	Thu Feb 26 11:57:11 2015 +0000
+++ b/Selection.h	Tue Mar 03 03:57:46 2015 +0000
@@ -7,8 +7,8 @@
 
 class Selection {
     public:
-        Selection(void (*)(), int, Menu *, const char *);
-        void (*fun)();   // pointer to a function to execute 
+        Selection(FunctionPointer *fun, int, Menu *, const char *);
+        FunctionPointer *fun;   // pointer to a function to execute
         const char* selText;   // selection text
         int pos;         // selection position
         Menu *childMenu;