39 lines
959 B
C
39 lines
959 B
C
#ifndef MYWIN_POPUP_H__
|
|
#define MYWIN_POPUP_H__
|
|
|
|
// 弹出式菜单
|
|
|
|
// 定义条目最大数目
|
|
#define POPUP_ITEM_MAXNUM 10
|
|
|
|
// 定义条目最大长度
|
|
#define POPUP_ITEM_MAXLEN 50
|
|
|
|
typedef struct {
|
|
WIN_WindowStruct win;
|
|
int index;
|
|
char items[POPUP_ITEM_MAXNUM][POPUP_ITEM_MAXLEN];
|
|
int itemNum;
|
|
int y_step;
|
|
} WIN_PopupStruct;
|
|
|
|
WIN_PopupStruct *WIN_CreatPopup(WIN_WindowStruct *base,
|
|
void (*msgLoop)(struct _WIN_WindowStruct *win,
|
|
WIN_MsgStruct *msg),
|
|
int x, int y, int x_size, int y_size);
|
|
|
|
// 添加条目
|
|
void POPUP_AddItem(WIN_PopupStruct *popup, char *item);
|
|
|
|
// 默认绘制函数
|
|
void POPUP_DefaultPaint(WIN_PopupStruct *popup);
|
|
|
|
// 默认消息处理函数
|
|
void POPUP_DefaultMsgLoop(WIN_PopupStruct *popup, WIN_MsgStruct *msg);
|
|
|
|
// 在指定位置弹出菜单
|
|
int POPUP_SelectItem(WIN_WindowStruct *base, char **item, int itemNum, int x,
|
|
int y);
|
|
|
|
#endif
|