123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
- // (“Fluent UI”)。该示例仅供参考,
- // 用以补充《Microsoft 基础类参考》和
- // MFC C++ 库软件随附的相关电子文档。
- // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
- // 若要了解有关 Fluent UI 许可计划的详细信息,请访问
- // https://go.microsoft.com/fwlink/?LinkId=238214.
- //
- // 版权所有(C) Microsoft Corporation
- // 保留所有权利。
- // MainFrm.h: CMainFrame 类的接口
- //
- #pragma once
- #include "FileView.h"
- #include "ClassView.h"
- #include "OutputWnd.h"
- #include "IRControlWnd.h"
- #include "CalendarBar.h"
- #include "Resource.h"
- #include "TrayIcon.h"
- #define USE_TRAYICON 1
- // 状态栏消息;
- #define MSG_STATUS_BAR (WM_USER + 101)
- class COutlookBar : public CMFCOutlookBar
- {
- virtual BOOL AllowShowOnPaneMenu() const { return TRUE; }
- virtual void GetPaneName(CString& strName) const { BOOL bNameValid = strName.LoadString(IDS_OUTLOOKBAR); ASSERT(bNameValid); if (!bNameValid) strName.Empty(); }
- };
- class CMainFrame : public CFrameWndEx
- {
-
- protected: // 仅从序列化创建
- CMainFrame() noexcept;
- DECLARE_DYNCREATE(CMainFrame)
- // 特性
- public:
- // 操作
- public:
- // 重写
- public:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- // 实现
- public:
- virtual ~CMainFrame();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected: // 控件条嵌入成员
- CMFCRibbonBar m_wndRibbonBar;
- CMFCRibbonApplicationButton m_MainButton;
- CMFCToolBarImages m_PanelImages;
- CMFCRibbonStatusBar m_wndStatusBar;
- #if __DOCKINGBAR__
- #if __FC_WIN__
- CFileView m_wndFileView;
- CClassView m_wndClassView;
- #endif
- #if __OUT_PUT_WIN__
- COutputWnd m_wndOutput;
- #endif
- CIRControlWnd m_wndIRControl;
- #endif
- #if __OUTLOOKBAR__
- COutlookBar m_wndNavigationBar;
- CMFCShellTreeCtrl m_wndTree;
- CCalendarBar m_wndCalendar;
- #endif
- #if __CAPTIONBAR__
- CMFCCaptionBar m_wndCaptionBar;
- #endif
- public:
- #if USE_TRAYICON
- void InitTrayIcon();
- // 托盘是否显示;
- BOOL m_isNotify;
- // 启动程序时,隐藏或显示对话框,在消息处理程序OnNcPaint()中使用;
- BOOL m_bShowNc;
- // 是否响应托盘消息;
- BOOL m_bNoticeTray;
- // 托盘工作类;
- ITrayIcon m_trayIcon;
- BOOL m_bAutoRuning;
- afx_msg LRESULT OnTrayNotification(WPARAM wp, LPARAM lp);
- afx_msg LRESULT OnTaskBarCreated(WPARAM wp, LPARAM lp);
- void TaskNotifyIcon(); // 托盘的工作内容;
- void TrayRight();
- #endif
- CMFCRibbonButton* GetRibbonButton(int uId) {
- return DYNAMIC_DOWNCAST(CMFCRibbonButton, m_wndRibbonBar.FindByID(uId));
- }
- // 设置状态栏文本;
- void SetRibbonStatusBarText(CString strText, int uId) {
- if ( IsWindow(m_wndStatusBar) )
- {
- CMFCRibbonBaseElement *pElement = m_wndStatusBar.FindByID(uId);
- if ( pElement )
- {
- pElement->SetText(strText);
- pElement->Redraw();
- }
- }
- }
- // 生成的消息映射函数
- protected:
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- afx_msg void OnApplicationLook(UINT id);
- afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
- afx_msg void OnViewCaptionBar();
- afx_msg void OnUpdateViewCaptionBar(CCmdUI* pCmdUI);
- afx_msg void OnOptions();
- afx_msg void OnFilePrint();
- afx_msg void OnFilePrintPreview();
- afx_msg void OnUpdateFilePrintPreview(CCmdUI* pCmdUI);
- afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
- afx_msg LRESULT OnMsgStatusBar(WPARAM wParam, LPARAM lParam);
- DECLARE_MESSAGE_MAP()
- #if __DOCKINGBAR__
- BOOL CreateDockingWindows();
- void SetDockingWindowIcons(BOOL bHiColorIcons);
- #endif
- #if __OUTLOOKBAR__
- BOOL CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, CMFCShellTreeCtrl& tree, CCalendarBar& calendar, int nInitialWidth);
- #endif
- #if __CAPTIONBAR__
- BOOL CreateCaptionBar();
- #endif
- int FindFocusedOutlookWnd(CMFCOutlookBarTabCtrl** ppOutlookWnd);
- CMFCOutlookBarTabCtrl* FindOutlookParent(CWnd* pWnd);
- CMFCOutlookBarTabCtrl* m_pCurrOutlookWnd;
- CMFCOutlookBarPane* m_pCurrOutlookPage;
- public:
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- afx_msg void OnTraymenuExit();
- afx_msg void OnClose();
- afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
- };
|