MainFrm.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
  2. // ("Fluent UI"),该示例仅作为参考资料提供,
  3. // 用以补充《Microsoft 基础类参考》和
  4. // MFC C++ 库软件随附的相关电子文档。
  5. // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
  6. // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
  7. // http://msdn.microsoft.com/officeui。
  8. //
  9. // 版权所有 (C) Microsoft Corporation
  10. // 保留所有权利。
  11. // MainFrm.h : CMainFrame 类的接口
  12. //
  13. #pragma once
  14. #include "CalendarBar.h"
  15. #include "Resource.h"
  16. #include "PropertiesWnd.h"
  17. #include "CaptureVideo.h"
  18. #include "FieldTestToolDoc.h"
  19. class CChildFrame;
  20. class COutlookBar : public CMFCOutlookBar
  21. {
  22. virtual BOOL AllowShowOnPaneMenu() const { return TRUE; }
  23. virtual void GetPaneName(CString& strName) const { BOOL bNameValid = strName.LoadString(IDS_OUTLOOKBAR); ASSERT(bNameValid); }
  24. };
  25. class CMainFrame : public CMDIFrameWndEx
  26. {
  27. DECLARE_DYNAMIC(CMainFrame)
  28. public:
  29. CMainFrame();
  30. // 属性
  31. public:
  32. CFieldTestToolDoc* m_pDoc;
  33. CMultiDocTemplate* m_pDocTemplate;
  34. // 操作
  35. public:
  36. // 重写
  37. public:
  38. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  39. // 实现
  40. public:
  41. virtual ~CMainFrame();
  42. #ifdef _DEBUG
  43. virtual void AssertValid() const;
  44. virtual void Dump(CDumpContext& dc) const;
  45. #endif
  46. protected: // 控件条嵌入成员
  47. CMFCRibbonBar m_wndRibbonBar;
  48. CMFCRibbonApplicationButton m_MainButton;
  49. CMFCToolBarImages m_PanelImages;
  50. CMFCRibbonStatusBar m_wndStatusBar;
  51. #ifndef DISABLE_OUTLOOKBAR
  52. COutlookBar m_wndNavigationBar;
  53. CMFCShellTreeCtrl m_wndTree;
  54. CCalendarBar m_wndCalendar;
  55. #endif
  56. #ifndef DISABLE_CAPTIONBAR
  57. CMFCCaptionBar m_wndCaptionBar;
  58. #endif
  59. CPropertiesWnd m_wndProperties;
  60. // 生成的消息映射函数
  61. protected:
  62. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  63. afx_msg void OnWindowManager();
  64. afx_msg void OnApplicationLook(UINT id);
  65. afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
  66. #ifndef DISABLE_CAPTIONBAR
  67. afx_msg void OnViewCaptionBar();
  68. afx_msg void OnUpdateViewCaptionBar(CCmdUI* pCmdUI);
  69. #endif
  70. // 摄像头;
  71. afx_msg void OnCameraCombobox();
  72. afx_msg void OnUpdateCameraCombobox(CCmdUI* pCmdUI);
  73. // 红外:测试精灵;
  74. afx_msg void OnInfraedCombobox();
  75. afx_msg void OnUpdateInfraedCombobox(CCmdUI* pCmdUI);
  76. afx_msg void OnInfraedCheckbox();
  77. afx_msg void OnUpdateInfraedCheckbox(CCmdUI* pCmdUI);
  78. // 红外版本选择;
  79. afx_msg void OnInfraedVersionCombobox();
  80. afx_msg void OnUpdateInfraedVersionCombobox(CCmdUI* pCmdUI);
  81. // USB切换器;
  82. afx_msg void OnSwitcherCombobox();
  83. afx_msg void OnUpdateSwitcherCombobox(CCmdUI* pCmdUI);
  84. afx_msg void OnSwitcherCheckbox();
  85. // 记录Checkbox的状态;
  86. bool m_bSwitcherCheckA;
  87. bool m_bSwitcherCheckB;
  88. afx_msg void OnUpdateSwitcherCheckbox(CCmdUI* pCmdUI);
  89. afx_msg void OnSwitcherCheckboxA();
  90. afx_msg void OnUpdateSwitcherCheckboxA(CCmdUI* pCmdUI);
  91. afx_msg void OnSwitcherCheckboxB();
  92. afx_msg void OnUpdateSwitcherCheckboxB(CCmdUI* pCmdUI);
  93. // 摄像头刷新按钮;
  94. afx_msg void OnCameraFlush();
  95. afx_msg void OnUpdateCameraFlush(CCmdUI* pCmdUI);
  96. // 注册设备变化监听;
  97. bool RegisterDeviceChange();
  98. afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData);
  99. DECLARE_MESSAGE_MAP()
  100. public:
  101. CMFCRibbonBar* GetRibbonBar() {return &m_wndRibbonBar;}
  102. CMFCRibbonStatusBar* GetRibbonStatusBar() { return &m_wndStatusBar; }
  103. void InitializeRibbon();
  104. BOOL CreateDockingWindows();
  105. void SetDockingWindowIcons(BOOL bHiColorIcons);
  106. BOOL CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, CMFCShellTreeCtrl& tree, CCalendarBar& calendar, int nInitialWidth);
  107. BOOL CreateCaptionBar();
  108. int FindFocusedOutlookWnd(CMFCOutlookBarTabCtrl** ppOutlookWnd);
  109. CCaptureVideo m_cap;
  110. CBaseSerial m_SerialTW;
  111. CBaseSerial m_SerialUSB;
  112. std::vector<TString> m_vtPorts;
  113. void InitSerialCombobox();
  114. // 是否找到测试精灵串口;
  115. bool m_bFindTestWizardPort;
  116. // 是否找到u盘切换设备;
  117. bool m_bFindSwitcherPort;
  118. // 查找测试精灵串口;
  119. bool IsTestWizardPort(CString strCOMPort);
  120. // 查找USB切U盘设备串口
  121. bool IsUSBSwitchPort(CString strCOMPort);
  122. // 记录活动窗口;
  123. CView *m_pActiveView;
  124. CChildFrame *m_pChildFrame;
  125. CMFCOutlookBarTabCtrl* FindOutlookParent(CWnd* pWnd);
  126. CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd;
  127. CMFCOutlookBarPane* m_pCurrOutlookPage;
  128. afx_msg void OnTimer(UINT_PTR nIDEvent);
  129. virtual BOOL PreTranslateMessage(MSG* pMsg);
  130. afx_msg void OnClose();
  131. };