MainFrm.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
  2. // (“Fluent UI”)。该示例仅供参考,
  3. // 用以补充《Microsoft 基础类参考》和
  4. // MFC C++ 库软件随附的相关电子文档。
  5. // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
  6. // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
  7. // https://go.microsoft.com/fwlink/?LinkId=238214.
  8. //
  9. // 版权所有(C) Microsoft Corporation
  10. // 保留所有权利。
  11. // MainFrm.h: CMainFrame 类的接口
  12. //
  13. #pragma once
  14. #include "FileView.h"
  15. #include "ClassView.h"
  16. #include "OutputWnd.h"
  17. #include "IRControlWnd.h"
  18. #include "CalendarBar.h"
  19. #include "Resource.h"
  20. #include "SATHelperDoc.h"
  21. #include "SATHelperView.h"
  22. #include "ChildFrm.h"
  23. #include "DeviceView.h"
  24. #include "UB530View.h"
  25. //////////////////////////////////////////////////////////////////////////
  26. #include "TrayIcon.h"
  27. #define USE_TRAYICON 1
  28. // 状态栏消息;
  29. #define MSG_STATUS_BAR (WM_USER + 101)
  30. class COutlookBar : public CMFCOutlookBar
  31. {
  32. virtual BOOL AllowShowOnPaneMenu() const { return TRUE; }
  33. virtual void GetPaneName(CString& strName) const { BOOL bNameValid = strName.LoadString(IDS_OUTLOOKBAR); ASSERT(bNameValid); if (!bNameValid) strName.Empty(); }
  34. };
  35. class CMainFrame : public CMDIFrameWndEx
  36. {
  37. DECLARE_DYNAMIC(CMainFrame)
  38. public:
  39. CMainFrame() noexcept;
  40. // 特性
  41. public:
  42. CSATHelperDoc* m_pDoc;
  43. CFormView* m_pActiveView;
  44. CChildFrame* m_pViewIDE[10];
  45. CChildFrame* m_pUB530View;
  46. CChildFrame* m_pDeviceView;
  47. // 操作
  48. public:
  49. // 重写
  50. public:
  51. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  52. // 实现
  53. public:
  54. virtual ~CMainFrame();
  55. #ifdef _DEBUG
  56. virtual void AssertValid() const;
  57. virtual void Dump(CDumpContext& dc) const;
  58. #endif
  59. protected: // 控件条嵌入成员
  60. CMFCRibbonBar m_wndRibbonBar;
  61. CMFCRibbonApplicationButton m_MainButton;
  62. CMFCToolBarImages m_PanelImages;
  63. CMFCRibbonStatusBar m_wndStatusBar;
  64. #if __DOCKINGBAR__
  65. #if __FC_WIN__
  66. CFileView m_wndFileView;
  67. CClassView m_wndClassView;
  68. #endif
  69. #if __OUT_PUT_WIN__
  70. COutputWnd m_wndOutput;
  71. #endif
  72. CIRControlWnd m_wndIRControl;
  73. #endif
  74. #if __OUTLOOKBAR__
  75. COutlookBar m_wndNavigationBar;
  76. CMFCShellTreeCtrl m_wndTree;
  77. CCalendarBar m_wndCalendar;
  78. #endif
  79. #if __CAPTIONBAR__
  80. CMFCCaptionBar m_wndCaptionBar;
  81. #endif
  82. // 生成的消息映射函数
  83. protected:
  84. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  85. afx_msg void OnWindowManager();
  86. afx_msg void OnApplicationLook(UINT id);
  87. afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
  88. afx_msg void OnViewCaptionBar();
  89. afx_msg void OnUpdateViewCaptionBar(CCmdUI* pCmdUI);
  90. afx_msg void OnOptions();
  91. afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  92. afx_msg LRESULT OnMsgStatusBar(WPARAM wParam, LPARAM lParam);
  93. afx_msg void OnClose();
  94. void OnTraymenuExit();
  95. DECLARE_MESSAGE_MAP()
  96. #if __DOCKINGBAR__
  97. BOOL CreateDockingWindows();
  98. void SetDockingWindowIcons(BOOL bHiColorIcons);
  99. #endif
  100. #if __OUTLOOKBAR__
  101. BOOL CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, CMFCShellTreeCtrl& tree, CCalendarBar& calendar, int nInitialWidth);
  102. #endif
  103. #if __CAPTIONBAR__
  104. BOOL CreateCaptionBar();
  105. #endif
  106. int FindFocusedOutlookWnd(CMFCOutlookBarTabCtrl** ppOutlookWnd);
  107. CMFCOutlookBarTabCtrl* FindOutlookParent(CWnd* pWnd);
  108. CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd;
  109. CMFCOutlookBarPane* m_pCurrOutlookPage;
  110. public:
  111. #if USE_TRAYICON
  112. void InitTrayIcon();
  113. // 托盘是否显示;
  114. BOOL m_isNotify;
  115. // 启动程序时,隐藏或显示对话框,在消息处理程序OnNcPaint()中使用;
  116. BOOL m_bShowNc;
  117. // 是否响应托盘消息;
  118. BOOL m_bNoticeTray;
  119. // 托盘工作类;
  120. ITrayIcon m_trayIcon;
  121. BOOL m_bAutoRuning;
  122. afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);
  123. afx_msg LRESULT OnTaskBarCreated(WPARAM wp, LPARAM lp);
  124. void TaskNotifyIcon(); // 托盘的工作内容;
  125. void TrayRight();
  126. #endif
  127. CMFCRibbonButton* GetRibbonButton(int uId) {
  128. return DYNAMIC_DOWNCAST(CMFCRibbonButton, m_wndRibbonBar.FindByID(uId));
  129. }
  130. // 设置状态栏文本;
  131. void SetRibbonStatusBarText(CString strText, int uId) {
  132. if (IsWindow(m_wndStatusBar))
  133. {
  134. CMFCRibbonBaseElement* pElement = m_wndStatusBar.FindByID(uId);
  135. if (pElement)
  136. {
  137. pElement->SetText(strText);
  138. pElement->Redraw();
  139. }
  140. }
  141. }
  142. public:
  143. virtual BOOL PreTranslateMessage(MSG* pMsg);
  144. //afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
  145. afx_msg LRESULT OnRibbonChanged(WPARAM wParam, LPARAM lParam);
  146. };