/** * TODO file description * * Created on 2020/01/05. */ #ifndef REFLOWER_SCENE_MENU_H #define REFLOWER_SCENE_MENU_H #include #include #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; // Extra field for the instance's private use. void *private; }; struct MenuScene *NewScene_Menu(struct MenuItem *items, size_t items_len); #endif //REFLOWER_SCENE_MENU_H