forked from mockendon/opengradesim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.h
59 lines (46 loc) · 981 Bytes
/
Menu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Menu.h
*
* Created on: Jun 30, 2015
* Author: David
*/
#ifndef MENU_H_
#define MENU_H_
#define USING_PROGMEM
#include "Arduino.h"
typedef boolean (*Item_Function)();
const typedef struct MenuItem_t {
char text[16];
Item_Function func;
} MenuItem;
class MenuList {
private:
MenuItem *menuItems;
uint8_t listSize;
public:
MenuItem* getItem(int aIndex);
MenuList(MenuItem* aList, uint8_t aSize) :
menuItems(aList), listSize(aSize) {
}
uint8_t getSize();
};
class Menu {
private:
boolean cancelFlag;
boolean runningFunction;
public:
MenuList *currentMenu;
int currentItemIndex;
Menu();
Menu(MenuList* aList);
void doMenu();
void setCurrentMenu(MenuList*);
boolean runFunction();
void getText(char*, int);
virtual void displayMenu() = 0;
// static virtual void menuHandler();
virtual boolean checkForCancel();
virtual int updateSelection() = 0;
virtual boolean selectionMade() = 0;
};
#endif /* MENU_H_ */