-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmenu.h
68 lines (49 loc) · 1.48 KB
/
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
60
61
62
63
64
65
66
67
68
#ifndef _MENU_H
#define _MENU_H
#include <Arduino.h>
typedef struct {
char name[21];
byte value;
} menuItem;
class menu
{
public:
/* Constructor: pagesize (rows), maximum menu item count */
menu(byte, byte);
/* Frees menuItems memory */
~menu(void);
/* Adds or updates a menu item (based on unique value) */
void setItem(char[], byte);
void setItem_P(const char *, byte);
/* Appends text to an existing menu item */
void appendItem(char[], byte);
void appendItem_P(const char *, byte);
/* Set selected by specifying index */
void setSelected(byte);
/* Select by menu item value */
void setSelectedByValue(byte);
/* Get selected menu item index */
byte getSelected(void);
/* Update _topItem based on selection and pageSize */
boolean refreshDisp(void);
/* Get specified row's menu item text based on _topItem and _pageSize */
void getVisibleRow(byte, char[]);
/* Get menu item text for currently selected item */
char* getSelectedRow(char[]);
/* Get the value for the currently selected menu item */
byte getValue(void);
/* Get the cursor position based on current selection, _topItem and _pageSize */
byte getCursor(void);
/* Get total number of defined menu items */
byte getItemCount(void);
/* Get menu item index based on specified menu item value */
byte getIndexByValue(byte);
private:
byte _pageSize,
_maxOpts,
_itemCount,
_selected,
_topItem;
menuItem *_menuItems;
};
#endif