-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathSimpleMenu.h
68 lines (57 loc) · 2.32 KB
/
SimpleMenu.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
60
61
62
63
64
65
66
67
68
#ifndef SimpleMenu_h
#define SimpleMenu_h
#if ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#include <wiring.h>
#endif
class SimpleMenu
{
public:
SimpleMenu(int _numberMenuItems, SimpleMenu *_submenus); //defult
SimpleMenu(void (*_CallBack)());
SimpleMenu(bool (*_ListCallBack)(int index), void (*_CallBack)());
SimpleMenu(bool (*_ListCallBack)(int index), SimpleMenu *_submenus);
SimpleMenu(String _name,int _numberMenuItems, SimpleMenu *_submenus); //sub menu
SimpleMenu(String _name,int *_value); //Value menu
SimpleMenu(String _name,int *_value, int _min, int _max); //Value menu with min and max
SimpleMenu(String _name, void (*_CallBack)()); //function menu
SimpleMenu(String _name, bool (*_ListCallBack)(int index), SimpleMenu *_submenus); //List menu with function
SimpleMenu(String _name, bool (*_ListCallBack)(int index), void (*_CallBack)()); //List menu with function
void begin();
void begin(void (*_displayCallBack)(SimpleMenu *_menu));
void begin(void (*_displayCallBack)(SimpleMenu *_menu),void (*_valueCallBack)(SimpleMenu *_menu));
void begin(SimpleMenu *_Top,void (*_displayCallBack)(SimpleMenu *_menu),void (*_valueCallBack)(SimpleMenu *_menu));
void setFunctions(void (*_displayCallBack)(SimpleMenu *_menu),void (*_valueCallBack)(SimpleMenu *_menu));
void home();
void select();
void back();
void returned();
void up();
void down();
void index(int _index);
SimpleMenu *next();
SimpleMenu *next(int index);
int getValue();
bool hasValue();
int getIndex();
void print();
String name;
bool selectMenu = false;
int menuLocation = 0;
private:
SimpleMenu *Top_menu = NULL;
int numberMenuItems;
SimpleMenu *submenus = NULL;
SimpleMenu *subListmenus = NULL;
int *value = NULL;
void (*CallBack) () = NULL;
bool (*ListCallBack)(int index) = NULL;
void (*displayCallBack)(SimpleMenu *_menu) = NULL;
void (*valueCallBack)(SimpleMenu *_menu) = NULL;
int min;
int max;
bool minMaxSet = false;
};
#endif