You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
792 B
38 lines
792 B
5 years ago
|
/**
|
||
|
* TODO file description
|
||
|
*
|
||
|
* Created on 2020/01/05.
|
||
|
*/
|
||
|
|
||
|
#ifndef REFLOWER_SCENE_MENU_H
|
||
|
#define REFLOWER_SCENE_MENU_H
|
||
|
|
||
|
#define MENUITEM_LABEL_LEN 30
|
||
|
|
||
|
struct MenuItem {
|
||
|
char label[MENUITEM_LABEL_LEN];
|
||
|
uint32_t tag;
|
||
|
};
|
||
|
|
||
|
struct MenuScene;
|
||
|
|
||
|
typedef struct SceneEvent (*MenuScene_onSelect_t)(struct MenuScene *scene);
|
||
|
|
||
|
struct MenuScene {
|
||
|
struct Scene base;
|
||
|
// items array
|
||
|
struct MenuItem *items;
|
||
|
// items count
|
||
|
size_t items_len;
|
||
|
// Vertical scroll offset (how many steps is the topmost item moved above the screen)
|
||
|
int32_t scroll_up;
|
||
|
// Selected item number
|
||
|
int32_t selected;
|
||
|
// selection handler
|
||
|
MenuScene_onSelect_t onSelect;
|
||
|
};
|
||
|
|
||
|
struct MenuScene *NewScene_Menu(struct MenuItem *items, size_t items_len);
|
||
|
|
||
|
#endif //REFLOWER_SCENE_MENU_H
|