Files
player/Project/Src/MyWin/Window/mywin_button.h

60 lines
878 B
C
Raw Permalink Normal View History

2025-06-27 00:32:57 +08:00
#ifndef MYWIN_BUTTON_H__
#define MYWIN_BUTTON_H__
//定义按键按下的消息
#define BUTTON_PRESSED 0x00000001
//按钮继承自MYWIN框架
typedef struct
{
WIN_WindowStruct win;
int press; //按钮状态
char *key; //按钮上显示
void (*pressShortFun)(void *ptr);//按钮短按之后调用
void *shortFunPtr;//短按调用函数的参数
}WIN_ButtonStruct;
//在堆中创建一个按钮
WIN_ButtonStruct *WIN_CreatButton (WIN_WindowStruct *base,
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
int x,int y,int x_size,int y_size);
//设置按键的字符
void BUTTON_SetKeyString (WIN_ButtonStruct *button,char *key);
//默认绘制函数
void BUTTON_DefaultPaint (WIN_ButtonStruct *button);
//默认消息处理函数
void BUTTON_DefaultMsgLoop (WIN_ButtonStruct *button,WIN_MsgStruct *msg);
#endif