44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
#ifndef MYWIN_WORKING_H__
|
|
#define MYWIN_WORKING_H__
|
|
|
|
#include "mywin_inc.h"
|
|
|
|
typedef struct {
|
|
WIN_WindowStruct win;
|
|
uint32_t rectColor;
|
|
uint32_t txtColor;
|
|
int time_id1;
|
|
int time_id2;
|
|
WIN_WorkFunStruct *work; // 工作结构体
|
|
int ret; // 工作函数的返回值
|
|
void (*break_fun)(void *ptr); // 线程退出函数
|
|
void *ptr; // 线程退出函数的参数
|
|
void (*get_progress)(int *now, int *all); // 用于获取进度的函数
|
|
char msg[50];
|
|
char msg_draw[100];
|
|
int msg_h_index;
|
|
} WIN_WorkingStruct;
|
|
|
|
WIN_WorkingStruct *WIN_CreatWorking(
|
|
WIN_WindowStruct *base,
|
|
void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg), int x,
|
|
int y, int x_size, int y_size);
|
|
|
|
// 默认绘制函数
|
|
void WORKING_DefaultPaint(WIN_WorkingStruct *working);
|
|
|
|
// 默认消息处理函数
|
|
void WORKING_DefaultMsgLoop(WIN_WorkingStruct *working, WIN_MsgStruct *msg);
|
|
|
|
// 显示提示框并进行操作,返回值是操作的返回值
|
|
int WORKING_DoWork(WIN_WindowStruct *base, char *msg, int (*fun)(void *),
|
|
void *ptr);
|
|
|
|
// 显示提示框并进行操作,返回值是操作的返回值
|
|
// 这个函数可以指定优先级,并且可以手动退出,可以获取线程进度
|
|
int WORKING_DoWorkPro(WIN_WindowStruct *base, char *msg, int (*fun)(void *),
|
|
void *ptr, void (*break_fun)(void *), void *b_ptr,
|
|
void (*get_progress)(int *now, int *all), uint8_t pro);
|
|
|
|
#endif
|