Multilevel menus working with key repeat
This commit is contained in:
@@ -60,6 +60,12 @@
|
||||
|
||||
#define MENU_SEL_RECT_RADIUS 5
|
||||
|
||||
#define MENU_STACK_SIZE 4
|
||||
#define MENU_ITEM_SIZE 10
|
||||
|
||||
typedef struct Menu_s Menu_t;
|
||||
typedef int (*MenuHandler_t)(Menu_t *menu);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MENU_ID_NONE = 0,
|
||||
@@ -75,8 +81,44 @@ typedef struct MENU_ITEM_s
|
||||
uint32_t * pMonoIcon; // bitmap
|
||||
char text[MENU_MAX_STRING_LENGTH];
|
||||
MenuItemId_t id;
|
||||
int (*handler)(Menu_t *menu);
|
||||
|
||||
} MENU_ITEM_t;
|
||||
} MenuItem_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MENU_OK = 0,
|
||||
MENU_HOME,
|
||||
MENU_EXIT
|
||||
} MenuExitCode_t;
|
||||
|
||||
struct Menu_s
|
||||
{
|
||||
MenuHandler_t handler;
|
||||
bool init;
|
||||
bool draw;
|
||||
int selected;
|
||||
MenuItem_t items[MENU_ITEM_SIZE];
|
||||
int itemCount;
|
||||
int displayIndex;
|
||||
int exitCode;
|
||||
int nextRepeat;
|
||||
uint32_t longPress;
|
||||
|
||||
};
|
||||
|
||||
typedef struct MenuData_s
|
||||
{
|
||||
int stackCount;
|
||||
Menu_t menuStack[MENU_STACK_SIZE];
|
||||
Menu_t *currentMenu;
|
||||
|
||||
} MenuData_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
bool exitToMainScreen;
|
||||
} MENU_t;
|
||||
|
||||
|
||||
void Menu_init(void);
|
||||
|
||||
Reference in New Issue
Block a user