--- lbbs/include/menu.h 2005/03/19 13:34:20 1.3 +++ lbbs/include/menu.h 2025/04/30 09:18:19 1.10 @@ -1,9 +1,9 @@ /*************************************************************************** - menu.h - description - ------------------- - begin : Wed Mar 16 2004 - copyright : (C) 2005 by Leaflet - email : leaflet@leafok.com + menu.h - description + ------------------- + begin : Wed Mar 16 2004 + copyright : (C) 2005 by Leaflet + email : leaflet@leafok.com ***************************************************************************/ /*************************************************************************** @@ -15,37 +15,44 @@ * * ***************************************************************************/ -#define MAX_MENUITEM_LENGTH 50 -#define MAX_MENUITEMS 30 -#define MAX_MENUNAME_LENGTH 20 -#define MAX_MENUACTION_LENGTH 20 -#define MAX_MENUTITLE_LENGTH 50 -#define MAX_MENUS 256 -#define MAX_MENU_DEPTH 50 +#ifndef _MENU_H_ +#define _MENU_H_ -struct _menu_item { +#define MAX_MENUITEM_LENGTH 50 +#define MAX_MENUITEMS 30 +#define MAX_MENUNAME_LENGTH 256 +#define MAX_MENUACTION_LENGTH 20 +#define MAX_MENUTITLE_LENGTH 50 +#define MAX_MENUS 256 +#define MAX_MENU_DEPTH 50 + +struct _menu_item +{ int row, col, r_row, r_col; char action[MAX_MENUACTION_LENGTH]; int submenu; - int priv, display; + int priv, level, display; char name[MAX_MENUNAME_LENGTH]; char text[MAX_MENUITEM_LENGTH]; }; typedef struct _menu_item MENU_ITEM; -struct _menu_title { - int row, col; +struct _menu_title +{ + int row, col, show; char text[MAX_MENUTITLE_LENGTH]; }; typedef struct _menu_title MENU_TITLE; -struct _menu_screen { - int row, col; +struct _menu_screen +{ + int row, col, show; char filename[256]; }; typedef struct _menu_screen MENU_SCREEN; -struct _menu { +struct _menu +{ char name[MAX_MENUNAME_LENGTH]; MENU_TITLE title; MENU_SCREEN screen; @@ -54,12 +61,30 @@ struct _menu { }; typedef struct _menu MENU; -struct _menu_set { +struct _menu_set +{ + char conf_file[256]; MENU *p_menu[MAX_MENUS]; MENU *p_menu_select[MAX_MENU_DEPTH]; int menu_count; int menu_select_depth; }; typedef struct _menu_set MENU_SET; - + extern MENU_SET bbs_menu; + +extern int load_menu(MENU_SET *p_menu_set, const char *conf_file); + +extern void unload_menu(MENU_SET *p_menu_set); + +extern int reload_menu(MENU_SET *p_menu_set); + +extern int menu_control(MENU_SET *p_menu_set, int key); + +extern int display_menu(MENU *p_menu); + +extern int display_current_menu(MENU_SET *p_menu_set); + +extern MENU *get_menu(MENU_SET *p_menu_set, const char *menu_name); + +#endif //_MENU_H_