📄 alert.h
字号:
#define IDC_ALERT_LIST 100
#define IDC_REPORT_LIST 250
#define IDC_ALARM 300
#define IDC_REPORT 400
#define IDC_LAST 210
#define IDC_NEXT 220
#define IDC_DATE 230
#define IDC_MODE 111
#define IDC_FIRST 112
#define IDC_UP 113
#define IDC_DOWN 114
#define IDC_ENTER 115
#define IDC_BACK 116
#define IDC_MYBUTTON 117
#define IDC_DOWNLOAD 110
#define IDC_CLEAR 120
#define IDC_OPREATE 130
#define IDC_CONFIGURE 140
#define IDC_CTRL 150
#define IDC_CLOSE 160
#define ALARM_LIST 6
#define REPORT_LIST 5
#define MAX_ALARM_NUM 24
#define DAY 0
#define WEEK 1
#define MONTH 2
#define LIGHTBLUE 180
static int alarm_number ;
int period ;
typedef struct _lsthdr
{
struct _lsthdr *pNext;
int x;
int y;
int width;
int height;
BOOL up;
//SORTTYPE sort;
char *pTitle;
}
LSTHDR;
typedef LSTHDR *PLSTHDR;
typedef struct _subitemdata
{
struct _subitemdata *pNext;
char *pszInfo;
}
SUBITEMDATA;
typedef SUBITEMDATA *PSUBITEMDATA;
typedef struct _itemdata
{
struct _itemdata *pNext;
int nTextColor;
BOOL bSelected;
int nRows;//used for item selected ,valid is bSelected = true
PSUBITEMDATA pSubItemHead;
}
ITEMDATA;
typedef ITEMDATA *PITEMDATA;
typedef struct _lstvwdata
{
int nCols;
int nRows;
int nVisableRows;
int nFirstVisableRow;
int nOriginalX;
int nOriginalY;
BOOL bBorderDraged;
BOOL bItemClicked;
//static BOOL bMouseInBorder = FALSE;
PLSTHDR pItemDraged;
PLSTHDR pItemClicked;
PITEMDATA pItemSelected;
int oldMouseX, oldMouseY;
int nItemDraged;
int nItemSelected;
int nItemHeight;
int nHeadHeight;
HWND hWnd;
PLSTHDR pLstHead;
PITEMDATA pItemHead;
}
LSTVWDATA;
typedef LSTVWDATA *PLSTVWDATA;
typedef struct _ALARMTABLE{
int num;
char * type;
char * from;
float value;
}ALARMTABLE;
typedef ALARMTABLE* PALARMTABLE;
ALARMTABLE alarm_table;
typedef struct _DATE{
int year;
int month;
int day;
}DATE;
typedef DATE* PDATE;
DATE report_date;
//左边的按钮
#define LBUTTON_X 2
#define LBUTTON_Y 0
#define LBUTTON_W 80
#define LBUTTON_H 73 //(HEIGHT-top/6)
//底部的按钮
#define BBUTTON_X 82//(LBUTTON_X+LBUTTON_W)
#define BBUTTON_Y 400 //(HEIGHT-LEFT-BOTTOM)
#define BBUTTON_W 80 //((WIDTH-LEFT)/7) (640-80)/7
#define BBUTTON_H 40
//列表框
#define LV_X 82
#define LV_Y 70
#define LV_W 550 //640-80
#define LV_H 330
static DLGTEMPLATE DlgEvent =
{
WS_VISIBLE,
WS_EX_NONE,
0, TOP, WIDTH, HEIGHT-TOP,
"Event/Alert",
0, 0,
19, NULL,
0
};
static CTRLDATA CtrlEvent[] =
{
{ "listview", WS_BORDER | WS_CHILD | WS_VSCROLL |WS_VISIBLE ,LV_X, 30, LV_W, LV_H,IDC_ALERT_LIST, "",0 },
{"listview",WS_BORDER | WS_CHILD |WS_VSCROLL,LV_X, LV_Y, LV_W, LV_H, IDC_REPORT_LIST, "", 0},
{CTRL_STATIC,SS_CENTER, 240, 35, 200, 25, IDC_DATE, "03/12/2005", },
{ "button",WS_CHILD | BS_PUSHBUTTON,LV_X, 35, 40, 25, IDC_LAST, "<",0},
{"button",WS_CHILD | BS_PUSHBUTTON,630-40, 35, 40, 25,IDC_NEXT, ">",0 },
{"button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, LV_X, 5, 80, 25,IDC_ALARM, "事件/警报",0},
{"button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, LV_X+90, 5, 80, 25,IDC_REPORT, " 报告 ",0},
//左边的按钮
{ "button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON |BS_MULTLINE, LBUTTON_X, LBUTTON_Y, LBUTTON_W, LBUTTON_H, IDC_MODE, "\n模式\n事件", 0 },
{ "button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON |BS_MULTLINE, LBUTTON_X, LBUTTON_Y+LBUTTON_H, LBUTTON_W, LBUTTON_H,IDC_FIRST, "",0 },
{"button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON |BS_BITMAP, LBUTTON_X, LBUTTON_Y+LBUTTON_H*2, LBUTTON_W, LBUTTON_H, IDC_UP, "", (DWORD) GetSystemBitmap (IDI_APPLICATION) },
{"button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,LBUTTON_X, LBUTTON_Y+LBUTTON_H*3, LBUTTON_W, LBUTTON_H,IDC_DOWN, "下移", 0},
{ "button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , LBUTTON_X, LBUTTON_Y+LBUTTON_H*4, LBUTTON_W, LBUTTON_H, IDC_ENTER, "确认", 0 },
{ "button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,LBUTTON_X, LBUTTON_Y+LBUTTON_H*5, LBUTTON_W, LBUTTON_H, IDC_BACK, "返回", 0 },
//底部的按钮
{ "button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,BBUTTON_X,BBUTTON_Y,BBUTTON_W,BBUTTON_H,IDC_DOWNLOAD, "下载", 0},
{"button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, BBUTTON_X+BBUTTON_W,BBUTTON_Y,BBUTTON_W,BBUTTON_H,IDC_CLEAR,"清除",0},
{ "button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,BBUTTON_X+BBUTTON_W*2,BBUTTON_Y,BBUTTON_W,BBUTTON_H,IDC_OPREATE, "操作",0},
{"button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,BBUTTON_X+BBUTTON_W*3,BBUTTON_Y,BBUTTON_W,BBUTTON_H, IDC_CONFIGURE, "组态",0 },
{ "button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,BBUTTON_X+BBUTTON_W*4,BBUTTON_Y,BBUTTON_W,BBUTTON_H,IDC_CTRL, "", 0 },
{ "button",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, BBUTTON_X+BBUTTON_W*5,BBUTTON_Y,BBUTTON_W,BBUTTON_H,IDC_CLOSE,"关闭", 0 },
};
static void download_item(HWND hDlg );
static void alarm_happen(HWND hDlg ,PALARMTABLE alarm);
static void alarm_solve(HWND hDlg ,int num);
static void alarm_over(HWND hDlg ,int num);
static void alarm_clear(HWND hDlg );
static void InitAlert(HWND hDlg);
static void forwardDate(HWND hDlg);
static void backDate(HWND hDlg);
int EventProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam);
static void Draw (HWND hDlg,HDC hdc);
static void
sDrawTextToSubItem1(HDC hdc, const char *pszText, int nRows, int nCols,PITEMDATA pItem, PLSTVWDATA pLVInternalData);
static void
sDrawText1(HDC hdc, int x, int y, int width, int height, const char *pszText);
static int
sGetItemWidth1 (PLSTVWDATA pLVInternalData);
static int
sGetSubItemX1 (int nCols, PLSTVWDATA pLVInternalData);
static int
sGetSubItemWidth1 (int nCols, PLSTVWDATA pLVInternalData);
void DlgConfAlert(HWND hWnd);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -