Files
player/Project/Src/MyWin/Window/mywin_button.h
2025-07-06 18:46:13 +08:00

33 lines
967 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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