📄 dlgalarm.h
字号:
#if !defined(AFX_DLGALARM_H__92896D1E_1D89_4223_B99E_915D981E8F52__INCLUDED_)
#define AFX_DLGALARM_H__92896D1E_1D89_4223_B99E_915D981E8F52__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgAlarm.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDlgAlarm dialog
#include "../utils/LED.h"
#include "../utils/TransCK.h"
#include "../notif/notif_cmd.h"
#include "../utils/TransButton.h"
#include <vector>
template<class T, class U>
class modelessdlg: public T
{
public:
typedef modelessdlg<T,U> baseclass;
modelessdlg(UINT idd, CWnd* parent = NULL): T(idd, parent){}
void init(CWnd* parent=NULL)
{
Create(U::IDD, parent) ;
}
virtual void show(CWnd* parent = NULL)
{
if (!IsWindow(m_hWnd))
init(parent) ;
if (::IsWindowVisible(m_hWnd))
return ;
//CenterWindow() ;
::MoveWindow(m_hWnd, 816, 225, 208,470, TRUE) ;
ShowWindow(SW_SHOW) ;
UpdateWindow() ;
}
virtual void hide()
{
DestroyWindow() ;
}
protected:
virtual int DoModal(){return -1;}
virtual void OnOK(){}
virtual void OnCancel(){}
};
class alarm_data
{
public:
ULONG ip ;
USHORT port ;
DWORD version ;
USHORT alarms[3] ;
CString alias ;
alarm_data(ULONG i, USHORT p, LPCTSTR als, byte* al)
{
ip = i ; port = p ;
alias = als ;
set_alarm(al) ;
}
alarm_data(const alarm_data& ref)
{
*this = ref;
}
alarm_data& operator=(const alarm_data& ref)
{
ip = ref.ip ;
port = ref.port ;
alias = ref.alias;
version = ref.version ;
memcpy(alarms, ref.alarms, 6) ;
return *this ;
}
void set_alarm(byte *al) ;
};
struct version_class
{
unsigned int v1 :4;
unsigned int v2 :4;
unsigned int year :8;
unsigned int month :8;
unsigned int day :8;
};
class CDlgAlarm : public modelessdlg<CDialog, CDlgAlarm>
{
HICON red ;
HICON green ;
enum {LEDS = 48} ;
enum {CAMERA=0, MD=1, VIDEO_LOST=2} ;
void update_status(int i) ;
void update_combo() ;
typedef std::vector<alarm_data> alarm_list ;
alarm_list al ;
bool showing ;
int m_sel_bun;
// Construction
public:
CDlgAlarm(CWnd* pParent = NULL); // standard constructor
virtual void show(CWnd* parent = NULL) ;
virtual void hide() ;
void add_alarm(ULONG _ip, USHORT _port, LPCTSTR alias, byte *masks, bool m_bool) ;
void remove_alarm(ULONG _ip, USHORT _port);
void set_disk_info(DISK_SPACE *m_disk);
bool alarms_present() const;
BOOL AutoShow() ;
void update_status() ;
void checkip();
// Dialog Data
//{{AFX_DATA(CDlgAlarm)
enum { IDD = IDD_ALARM };
CLed m_led[3][LEDS/3];
CComboBox m_cbremote;
int m_remote;
//BOOL m_auto ;
CString m_hostver ;
CString m_disk_all;
CString m_disk_part;
CString m_lable;
CTransButton m_clearalarmbtn;
//CTransCK m_alarm1btn;
CTransCK m_alarm2btn;
CTransCK m_alarm3btn;
CTransCK m_alarm_maxctl;
//BOOL m_alarmbool1;
BOOL m_alarmbool2;
BOOL m_alarmbool3;
BOOL m_alarm_max;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgAlarm)
protected:
//##ModelId=3F90BABC0088
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgAlarm)
virtual void OnCancel();
virtual void OnOK();
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnSelChangeRemote();
//afx_msg void OnAuto() ;
afx_msg void Onclear_alarm();
//afx_msg void Onsensor_alarm();
afx_msg void Onmotion_alarm();
afx_msg void Onelemap_alarm();
afx_msg void onmax();
// afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGALARM_H__92896D1E_1D89_4223_B99E_915D981E8F52__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -