Files
ui-library-playground/Core/Inc/graphics/menu.h
Dylan Smith 6cdbe8cb11 WIP
2026-01-12 16:26:40 -05:00

32 lines
859 B
C

#ifndef MENU_H
#define MENU_H
#include "stdint.h"
#include "stdbool.h"
typedef void (*menu_callback_t)(void *args);
typedef struct
{
uint8_t *title;
bool enabled; // not enabled = grayed out, unhighlightable
menu_callback_t highlighted_callback_function;
void *highlighted_callback_function_args;
menu_callback_t selected_callback_function;
void *selected_callback_function_args;
} graphical_menu_entry_t;
typedef struct _graphical_menu_t graphical_menu_t;
struct _graphical_menu_t {
graphical_menu_t *parent_menu;
uint8_t num_entries;
graphical_menu_entry_t *entries;
};
void draw_menu(const graphical_menu_t *const menu);
void select_menu_entry(const graphical_menu_t *const menu);
uint8_t get_selected_menu_entry_idx(void);
void set_selected_menu_entry_idx(const graphical_menu_t *const menu, uint8_t idx);
#endif