84 lines
2.0 KiB
C
84 lines
2.0 KiB
C
#ifndef MYWIN_USER_STATUS_BAR_H__
|
||
#define MYWIN_USER_STATUS_BAR_H__
|
||
|
||
#include "mywin_inc.h"
|
||
|
||
// 状态栏,继承自MYWIN框架
|
||
// 用户界面,根据具体显示用途编写,没有通用性
|
||
|
||
#include "elf.h"
|
||
|
||
// 状态栏需要的资源数据结构体
|
||
typedef struct {
|
||
uint8_t *bluetooth;
|
||
uint8_t *heart;
|
||
uint8_t *nfc;
|
||
uint8_t *betty;
|
||
} STATUSBAR_ResStruct;
|
||
|
||
// 状态参数
|
||
typedef struct {
|
||
uint32_t structType; // 结构体类型
|
||
char time[20];
|
||
char mode[100];
|
||
int mode_x; // 在字符超过显示宽度时,滚动显示x方向的偏移
|
||
char betty[10];
|
||
int blueState;
|
||
int heartState;
|
||
int nfcState;
|
||
int bettyState;
|
||
} STATUSBAR_DataStruct;
|
||
|
||
typedef struct {
|
||
app_struct *app;
|
||
RECT_Struct enter;
|
||
RECT_Struct exit;
|
||
} STATUSBAR_AppStruct;
|
||
|
||
typedef struct {
|
||
WIN_WindowStruct win;
|
||
STATUSBAR_ResStruct res; // 显示用的资源
|
||
STATUSBAR_DataStruct stat;
|
||
int img_xsize; // 图标最大横向尺寸
|
||
WIN_PicStruct pic; // 状态栏背景图片
|
||
uint32_t backColor; // 背景颜色
|
||
uint32_t color; // 前景颜色
|
||
int timerId; // 定时器id
|
||
int timerIdGet; // 用于获取时间
|
||
uint8_t sec;
|
||
|
||
int mov_start; // 移动开始
|
||
int y_size_def; // 默认的y尺寸
|
||
int dis; // 滑动方向,1,展开,0,缩小
|
||
|
||
int app_num;
|
||
int app_y_step;
|
||
STATUSBAR_AppStruct app_item[APPM_LIST_MAXLEN];
|
||
|
||
} WIN_StatusBarStruct;
|
||
|
||
// 在堆里构造一个状态栏
|
||
WIN_StatusBarStruct *WIN_CreatStatusBar(
|
||
WIN_WindowStruct *base,
|
||
void (*msgLoop)(struct _WIN_WindowStruct *win, WIN_MsgStruct *msg), int x,
|
||
int y, int x_size, int y_size);
|
||
|
||
// 状态信息更新
|
||
void STATUSBAR_StateUpdata(WIN_StatusBarStruct *statusbar,
|
||
STATUSBAR_DataStruct *s);
|
||
|
||
// 设置资源文件
|
||
void STATUSBAR_SetRes(WIN_StatusBarStruct *statusbar, STATUSBAR_ResStruct *r);
|
||
|
||
// 设置背景图片
|
||
void STATUSBAR_SetBackPic(WIN_StatusBarStruct *statusbar, WIN_PicStruct *pic);
|
||
|
||
// 默认绘制函数
|
||
void STATUSBAR_DefaultPaint(WIN_StatusBarStruct *statusbar);
|
||
|
||
// 默认消息处理函数
|
||
void STATUSBAR_DefaultMsgLoop(WIN_StatusBarStruct *statusbar,
|
||
WIN_MsgStruct *msg);
|
||
|
||
#endif
|