#ifndef MYWIN_USER_MENU_H__ #define MYWIN_USER_MENU_H__ #include "mywin_inc.h" // 定义最长字符长度 #define MENU_TXT_MAXLEN 20 // 定义最大条目数 #define MENU_ITEM_MAXNUM 20 typedef struct { char *img; char txt[MENU_TXT_MAXLEN]; } MENU_ItemStruct; typedef struct { WIN_TouchWinStruct win; MENU_ItemStruct title; WIN_ButtonStruct *key_back; WIN_ScrollbarStruct *bar; } WIN_MenuStruct; WIN_MenuStruct *WIN_CreatMenu(WIN_WindowStruct *base, void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg), int x, int y, int x_size, int y_size); // 设置标题 void MENU_SetTitle(WIN_MenuStruct *menu, char *img, char *txt); void MENU_SetMaxItem(WIN_MenuStruct *menu, int itemNum); // 设置条目 void MENU_AddItem(WIN_MenuStruct *menu, char *img, char *txt); int MENU_GetAllItemNum(WIN_MenuStruct *menu); char *MENU_GetItem(WIN_MenuStruct *menu, int index); char *MENU_GetSelectItem(WIN_MenuStruct *menu); int MENU_GetIndex(WIN_MenuStruct *menu); // 默认绘制函数 void MENU_DefaultPaint(WIN_MenuStruct *menu); // 默认消息处理函数 void MENU_DefaultMsgLoop(WIN_MenuStruct *menu, WIN_MsgStruct *msg); #endif