# HG changeset patch # User ulion # Date 1196594090 0 # Node ID 1b3dabc8c2b81b05f458d747901f2e88f4c7d590 # Parent 21d672c608ef03b24e6799846098e159e117c7dd Add type info to menu_t, now we can get the menu name and the type name of menu. diff -r 21d672c608ef -r 1b3dabc8c2b8 libmenu/menu.c --- a/libmenu/menu.c Sat Dec 01 16:31:49 2007 +0000 +++ b/libmenu/menu.c Sun Dec 02 11:14:50 2007 +0000 @@ -46,12 +46,12 @@ NULL }; -typedef struct menu_def_st { +struct menu_def_st { char* name; menu_info_t* type; void* cfg; char* args; -} menu_def_t; +}; static struct MPContext *menu_ctx = NULL; static menu_def_t* menu_list = NULL; @@ -220,6 +220,7 @@ m->priv_st = &(menu_list[i].type->priv_st); m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg); m->ctx = menu_ctx; + m->type = &menu_list[i]; if(menu_list[i].type->open(m,menu_list[i].args)) return m; if(m->priv) diff -r 21d672c608ef -r 1b3dabc8c2b8 libmenu/menu.h --- a/libmenu/menu.h Sat Dec 01 16:31:49 2007 +0000 +++ b/libmenu/menu.h Sun Dec 02 11:14:50 2007 +0000 @@ -2,6 +2,8 @@ struct menu_priv_s; typedef struct menu_s menu_t; +typedef struct menu_def_st menu_def_t; + struct menu_s { struct MPContext *ctx; void (*draw)(menu_t* menu,mp_image_t* mpi); @@ -13,6 +15,7 @@ int show; // Draw it ? int cl; // Close request (user sent a close cmd or menu_t* parent; + menu_def_t *type; }; typedef struct menu_info_s {