123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
- // (“Fluent UI”)。该示例仅供参考,
- // 用以补充《Microsoft 基础类参考》和
- // MFC C++ 库软件随附的相关电子文档。
- // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
- // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
- // https://go.microsoft.com/fwlink/?LinkId=238214.
- //
- // 版权所有(C) Microsoft Corporation
- // 保留所有权利。
- #include "DlgIRControl.h"
- #include <map>
- #pragma once
- // 按钮id起始值;
- #define BTNID 11000
- // layout.xml item;
- typedef struct __BTN_INFO__
- {
- std::string name;
- int width;
- int height;
- DWORD color;
- CMFCButton *pBTN;
- bool bEnable = false;
- }BtnInfo, *pBtnInfo;
- class CIRControlToolBar : public CMFCToolBar
- {
- public:
- virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
- {
- CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
- }
- virtual BOOL AllowShowOnList() const { return FALSE; }
- };
- class CIRControlWnd : public CDockablePane
- {
- // 构造
- public:
- CIRControlWnd() noexcept;
- void AdjustLayout();
- // 特性
- public:
- protected:
- CFont m_fntPropList;
- // 重启服务端进程;
- CMFCButton m_btnRestart;
- // 信号集文件;
- CComboBox m_wndSignalCombo;
- // 选择通用遥控器;
- CMFCButton m_wndSignalCheck;
- #if __PANE_DLG__
- CDlgIRControl m_dlgIRControl;
- #endif
-
- // 实现
- public:
- virtual ~CIRControlWnd();
- // 去掉关闭按钮;但组合多个pane时无效;
- virtual BOOL CanBeClosed() const { return FALSE; };
- // 禁止拖动Pane;
- virtual BOOL FloatPane(CRect rectFloat, AFX_DOCK_METHOD dockMethod = DM_UNKNOWN, bool bShow = true) { return FALSE; }
- // 禁用停靠,双击底部无效(不会停靠)
- virtual BOOL CanFloat() const { return FALSE; };
- // 禁用大小;//崩溃;
- //virtual BOOL IsResizable() const {return FALSE;}
- protected:
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnExpandAllProperties();
- afx_msg void OnUpdateExpandAllProperties(CCmdUI* pCmdUI);
- afx_msg void OnSortProperties();
- afx_msg void OnUpdateSortProperties(CCmdUI* pCmdUI);
- afx_msg void OnProperties1();
- afx_msg void OnUpdateProperties1(CCmdUI* pCmdUI);
- afx_msg void OnProperties2();
- afx_msg void OnUpdateProperties2(CCmdUI* pCmdUI);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
- // 下拉框选项变化事件;
- afx_msg void OnCbnSelchangeSignal();
- DECLARE_MESSAGE_MAP()
- void SetPropListFont();
- int m_nComboHeight;
- // 重启红老鼠;
- void StartIRDevice(BOOL bReStart = TRUE);
- // 重载信号文件;
- void ReLoadSignalXml();
- // 禁用信号按钮;
- void DisableSignalBtn() {
- for (std::vector<BtnInfo>::iterator it = m_vtBtnInfo.begin(); it != m_vtBtnInfo.end(); it++)
- {
- it->bEnable = false;
- }
- }
- public:
- std::map<UINT, BtnInfo&> m_map_btn;
- std::vector<std::string> m_vtsignal_gen;
- std::vector<std::string> m_vtsignal_pro;
- void LoadSignals();
- std::vector<BtnInfo> m_vtBtnInfo;
- void Loadlayout(std::vector<BtnInfo> &vt);
- afx_msg void OnPaint();
- // 单击按钮;
- afx_msg void OnSignalBtnClick(UINT uId);
- // 更新按钮状态;
- afx_msg void OnUpdateSignalBtn(CCmdUI* pCmdUI);
- // 更新checkbox状态;
- afx_msg void OnUpdateCheckBox(CCmdUI * pCmdUI);
- afx_msg void OnCheckBoxClicked();
- // 更新重启按钮状态;
- afx_msg void OnUpdateBtnRestartProc(CCmdUI* pCmdUI);
- afx_msg void OnBtnRestartProcClicked();
- // 更新按钮实际状态;
- void UpdateSignalBtnStatus();
- };
|