Rockbox mail archive
Subject: Re: my next crazy idea... rework the menu system
Re: my next crazy idea... rework the menu system
OK, well, I've started figuring out how to store everything and I
think this is OK for a first go.
enum {
MT_MENU = 0,
MT_FUNCTION_CALL, /* used when the standard code wont work */
MT_SETTING_BOOL,
MT_SETTING_INT, /* int with min,max */
MT_SETTING_CHOICE, /* int where you have X choices, e.g replay mode */
} menu_item_type;
struct menu_item {
enum menu_item_type type;
union {
struct menu_item **submenu; /* used with MT_MENU */
/* this may have to be changed, but doing it this way does
save some space */
struct { /* used with MT_SETTING_* */
void (*function)(int); /* int typecast to bool for BOOL options */
const struct opt_items** options; /* MT_SETTING_INT only */
void (*formatter)(char*, int, int, const char*); /*
MT_SETTING_INT only */
void *variable; /* typecast to whatever we need */
} options;
bool (*function)(void); /* used with MT_FUNCTION_CALL */
};
const char *title;
};
so, hopefully we will be able to do something like
static const struct menu_item main_menu = {MT_MENU, {&sound_menu,
&playback_menu, &...}, STR(LANG_MAIN_MENU};
Oh, the text file is not needed... I was just testing you all :D
Received on 2006-08-23
Page was last modified "Jan 10 2012" The Rockbox Crew
|