181 lines
4.8 KiB
C
181 lines
4.8 KiB
C
#ifndef MYWIN_H__
|
||
#define MYWIN_H__
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//窗口管理器初始化
|
||
int WIN_Init (void);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/*******************获取和设置环境变量********************/
|
||
|
||
//返回窗口环境变量
|
||
WIN_Struct *WIN_GetWinStruct (void);
|
||
|
||
//设置窗口运行回调函数
|
||
void *WIN_SetRunCallBack (void (*callback)(void));
|
||
|
||
//阻塞窗口运行结束时设置返回值
|
||
void WIN_SetBlockWinReturn (int ret,void *data,int datasize);
|
||
|
||
//获取阻塞窗口的数据
|
||
int WIN_GetBlockWinReturn (int *ret,void *buff,int buffsize);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/*********************输入输出接口函数**********************/
|
||
|
||
//获取外部数据指针,这个函数在窗口应用中调用
|
||
void *WIN_GetExtData (u32 *datasize);
|
||
|
||
//放置外部数据到窗口,这个函数在其他线程或中断中调用
|
||
int WIN_PlaceExtData (void *data,u32 size);
|
||
|
||
//设置在指定窗口运行的函数,返回0,成功
|
||
//这个函数用于在窗口线程之外通知窗口调用函数
|
||
int WIN_RunInWindow(const char *title,void (*fun)(void *ptr),void *ptr);
|
||
|
||
//运行消息中的函数 ,返回0,成功
|
||
//这个函数在窗口消息循环中接收到运行消息后调用
|
||
int WIN_RunMsgFunction(WIN_MsgStruct *msg);
|
||
|
||
|
||
|
||
|
||
|
||
/**************************窗口操作函数**********************************/
|
||
|
||
//返回基础窗口指针
|
||
WIN_WindowStruct *WIN_GetBaseWindow(void);
|
||
|
||
//返回最后一次运行的窗口
|
||
WIN_WindowStruct *WIN_GetCurrentWindow(void);
|
||
|
||
//在堆中创建一个窗口,返回窗口的指针
|
||
WIN_WindowStruct *WIN_CreatWindow(WIN_WindowStruct *base,
|
||
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
|
||
int x,int y,int x_size,int y_size);
|
||
|
||
//创建已经实例化的窗口,返回1,创建成功
|
||
int WIN_CreatWindowExt(WIN_WindowStruct *win,WIN_WindowStruct *base,
|
||
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
|
||
int x,int y,int x_size,int y_size);
|
||
|
||
//销毁一个窗口,资源回收
|
||
void WIN_DeleteWindow (WIN_WindowStruct *win);
|
||
|
||
//将指定窗口设置为置顶,返回1添加成功
|
||
int WIN_SetAsTopWin (WIN_WindowStruct *win);
|
||
|
||
//窗口取消置顶,返回1成功
|
||
int WIN_ResetAsTopWin (WIN_WindowStruct *win);
|
||
|
||
//根据指定id号获取窗口指针
|
||
WIN_WindowStruct *WIN_GetWindowStructById (WIN_WindowStruct *win,u32 id);
|
||
|
||
//从子窗口列表中删除指定窗口
|
||
int WIN_DelFromChidList (WIN_WindowStruct *win,WIN_WindowStruct *chidWin);
|
||
|
||
//添加窗口到子窗口列表中
|
||
int WIN_AddToChidList (WIN_WindowStruct *win,WIN_WindowStruct *chidWin);
|
||
|
||
//判断目标窗口是不是子窗口,是返回1
|
||
int WIN_CheckChidWin (WIN_WindowStruct *win,WIN_WindowStruct *chid);
|
||
|
||
//通过指定的坐标找到顶端可见的窗口,没找到返回0
|
||
WIN_WindowStruct *WIN_FindTopWinByPos (WIN_WindowStruct *win,int x,int y);
|
||
|
||
//找到顶端可控窗口
|
||
WIN_WindowStruct *WIN_FindTopWin(WIN_WindowStruct *win);
|
||
|
||
//把指定子窗口设置为最高
|
||
int WIN_SetChidWinTop (WIN_WindowStruct *win,WIN_WindowStruct *chidWin);
|
||
|
||
//找到指定窗口在屏幕上的坐标和大小
|
||
void WIN_GetWinPosOnLcd (WIN_WindowStruct *win,int *x,int *y,int *x_size,int *y_size);
|
||
|
||
//返回两个窗口的共同父窗口,没有共同父窗口返回0
|
||
WIN_WindowStruct *WIN_FindPrent (WIN_WindowStruct *win1,WIN_WindowStruct *win2);
|
||
|
||
//设置无效区矩形,此矩形会被限制在窗口无效区之内
|
||
void WIN_SetWinInvalidRect (WIN_WindowStruct *win,RECT_Struct *r);
|
||
|
||
//获取当前窗口无效区矩形
|
||
void WIN_GetWinInvalidRect (WIN_WindowStruct *win,RECT_Struct *r);
|
||
|
||
//设置窗口标题
|
||
void WIN_SetWinTitle (WIN_WindowStruct *win,char *title);
|
||
|
||
//根据窗口标题找到窗口指针
|
||
WIN_WindowStruct *WIN_GetWinByTitle (WIN_WindowStruct *win,char *title);
|
||
|
||
//查找win是否被遮挡,是,返回1
|
||
int WIN_FindBlock(WIN_WindowStruct *win);
|
||
|
||
//屏蔽和接触屏蔽子窗口的按键和键盘消息
|
||
int WIN_SetChildWinkeyShield (WIN_WindowStruct *win,int power);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/**************************窗口绘制相关******************************/
|
||
|
||
//根据窗口坐标设置LCD的活动窗口,所有绘制操作都在这个窗口之内
|
||
void WIN_EnterPaint (WIN_WindowStruct *win);
|
||
|
||
//在窗口绘制时,判断需不需要绘制顶端窗口
|
||
void WIN_TopWinPaint (WIN_WindowStruct *win);
|
||
|
||
//窗口默认的绘制函数
|
||
void WIN_DefaultPaint (WIN_WindowStruct *win);
|
||
|
||
//绘制背景
|
||
void WIN_PaintBackGround (WIN_WindowStruct *win);
|
||
|
||
//设置页面的背景图片
|
||
void WIN_SetBackPic (WIN_WindowStruct *win);
|
||
|
||
//设置页面的背景图片路径
|
||
void WIN_SetBackPicPath (WIN_WindowStruct *win,char *path);
|
||
|
||
//设置页面的画背景函数
|
||
void *WIN_SetBackFun (WIN_WindowStruct *win,void (*fun)(void));
|
||
|
||
//设置前景色
|
||
void WIN_SetColor (WIN_WindowStruct *win,u32 color);
|
||
|
||
//设置背景色
|
||
void WIN_SetBkColor (WIN_WindowStruct *win,u32 bkcolor);
|
||
|
||
//显示窗口
|
||
void WIN_ShowWindow (WIN_WindowStruct *win);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#endif
|
||
|
||
|