#pragma once
|
#include "CBaseView.h"
|
#include "BlButton.h"
|
#include "PLC.h"
|
|
// BUTTON¿Ø¼þ
|
#define BTN_MAX 7
|
#define BTN_RUN 0 // Æô¶¯
|
#define BTN_AUTO 1 // ×Ô¶¯
|
#define BTN_PUASE 2 // ÔÝÍ£
|
#define BTN_MANUAL 3 // ÊÖ¶¯
|
#define BTN_MUTE 4 // ¾²Òô
|
#define BTN_OPR 5 // ¸´Î»
|
#define BTN_STOP 6 // ֹͣ
|
|
// ²Ù×÷ÀàÐÍ
|
enum class OperationType {
|
RUN = 0, // Æô¶¯
|
AUTO, // ×Ô¶¯
|
PUASE, // ÔÝÍ£
|
MANUAL, // ÊÖ¶¯
|
MUTE, // ¾²Òô
|
OPR, // ¸´Î»
|
STOP // ֹͣ
|
};
|
|
class CPlcView :public CBaseView
|
{
|
DECLARE_DYNAMIC(CPlcView)
|
|
public:
|
CPlcView(CWnd* pParent = nullptr);
|
~CPlcView();
|
|
public:
|
virtual void SetContext(void* pContext);
|
|
private:
|
void InitRxWindows();
|
void Resize();
|
|
private:
|
void SetButtonBackgroundColors(CBlButton* btn, bool bOff);
|
void HandleOperation(OperationType eOpType);
|
void WriteOperationDataToPLC(OperationType eOpType, bool bPressed);
|
|
private:
|
COLORREF m_crBkgnd;
|
HBRUSH m_hbrBkgnd;
|
IObserver* m_pObserver;
|
CPLC* m_pPlc;
|
|
private:
|
// ¿Ø¼þ
|
CBlButton* m_pBlBtns[BTN_MAX];
|
|
// ¶Ô»°¿òÊý¾Ý
|
#ifdef AFX_DESIGN_TIME
|
enum { IDD = IDD_VIEW_PLC};
|
#endif
|
|
protected:
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö
|
|
DECLARE_MESSAGE_MAP()
|
public:
|
virtual BOOL OnInitDialog();
|
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
afx_msg void OnDestroy();
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
afx_msg void OnClose();
|
afx_msg void OnBnClickedButtonActivate();
|
afx_msg void OnBnClickedButtonAuto();
|
afx_msg void OnBnClickedButtonPuase();
|
afx_msg void OnBnClickedButtonManualOperation();
|
afx_msg void OnBnClickedButtonSoundOff();
|
afx_msg void OnBnClickedButtonResetting();
|
afx_msg void OnBnClickedButtonStop();
|
};
|