├── res ├── main.bmp ├── sort.bmp ├── Toolbar.bmp ├── buttons.bmp ├── explorer.bmp ├── fileview.bmp ├── sort_hc.bmp ├── Toolbar256.bmp ├── class_view.ico ├── classview.bmp ├── explorer_hc.bmp ├── file_view.ico ├── filelarge.bmp ├── filelarge.png ├── filesmall.bmp ├── fileview_hc.bmp ├── menuimages.bmp ├── output_wnd.ico ├── properties.bmp ├── ui_elements.png ├── writelarge.bmp ├── writesmall.bmp ├── RibbonExample.ico ├── RibbonExample.rc2 ├── class_view_hc.ico ├── classview_hc.bmp ├── file_view_hc.ico ├── menuimages_hc.bmp ├── output_wnd_hc.ico ├── properties_hc.bmp ├── RibbonExampleDoc.ico ├── properties_wnd.ico ├── properties_wnd_hc.ico └── ribbon.mfcribbon-ms ├── RibbonExample.aps ├── VisualManager.png ├── .gitignore ├── .vs └── RibbonExample │ └── v14 │ └── .suo ├── README.md ├── RainbowStyle.cpp ├── Windows10Style.cpp ├── stdafx.cpp ├── targetver.h ├── ViewTree.h ├── ChildFrm.h ├── RibbonExample.sln ├── RibbonExample.h ├── ViewTree.cpp ├── RibbonExampleDoc.h ├── OutputWnd.h ├── FileView.h ├── RibbonExampleView.h ├── ClassView.h ├── PropertiesWnd.h ├── stdafx.h ├── ChildFrm.cpp ├── MainFrm.h ├── RibbonExampleView.cpp ├── RibbonExampleDoc.cpp ├── resource.h ├── OutputWnd.cpp ├── RibbonExample.cpp ├── FileView.cpp ├── PropertiesWnd.cpp ├── ClassView.cpp ├── MainFrm.cpp ├── RibbonExample.vcxproj ├── RainbowStyle.h ├── Windows10Style.h └── RibbonExample.rc /res/main.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/main.bmp -------------------------------------------------------------------------------- /res/sort.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/sort.bmp -------------------------------------------------------------------------------- /res/Toolbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/Toolbar.bmp -------------------------------------------------------------------------------- /res/buttons.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/buttons.bmp -------------------------------------------------------------------------------- /res/explorer.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/explorer.bmp -------------------------------------------------------------------------------- /res/fileview.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/fileview.bmp -------------------------------------------------------------------------------- /res/sort_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/sort_hc.bmp -------------------------------------------------------------------------------- /RibbonExample.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/RibbonExample.aps -------------------------------------------------------------------------------- /VisualManager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/VisualManager.png -------------------------------------------------------------------------------- /res/Toolbar256.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/Toolbar256.bmp -------------------------------------------------------------------------------- /res/class_view.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/class_view.ico -------------------------------------------------------------------------------- /res/classview.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/classview.bmp -------------------------------------------------------------------------------- /res/explorer_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/explorer_hc.bmp -------------------------------------------------------------------------------- /res/file_view.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/file_view.ico -------------------------------------------------------------------------------- /res/filelarge.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/filelarge.bmp -------------------------------------------------------------------------------- /res/filelarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/filelarge.png -------------------------------------------------------------------------------- /res/filesmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/filesmall.bmp -------------------------------------------------------------------------------- /res/fileview_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/fileview_hc.bmp -------------------------------------------------------------------------------- /res/menuimages.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/menuimages.bmp -------------------------------------------------------------------------------- /res/output_wnd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/output_wnd.ico -------------------------------------------------------------------------------- /res/properties.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/properties.bmp -------------------------------------------------------------------------------- /res/ui_elements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/ui_elements.png -------------------------------------------------------------------------------- /res/writelarge.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/writelarge.bmp -------------------------------------------------------------------------------- /res/writesmall.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/writesmall.bmp -------------------------------------------------------------------------------- /res/RibbonExample.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/RibbonExample.ico -------------------------------------------------------------------------------- /res/RibbonExample.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/RibbonExample.rc2 -------------------------------------------------------------------------------- /res/class_view_hc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/class_view_hc.ico -------------------------------------------------------------------------------- /res/classview_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/classview_hc.bmp -------------------------------------------------------------------------------- /res/file_view_hc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/file_view_hc.ico -------------------------------------------------------------------------------- /res/menuimages_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/menuimages_hc.bmp -------------------------------------------------------------------------------- /res/output_wnd_hc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/output_wnd_hc.ico -------------------------------------------------------------------------------- /res/properties_hc.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/properties_hc.bmp -------------------------------------------------------------------------------- /res/RibbonExampleDoc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/RibbonExampleDoc.ico -------------------------------------------------------------------------------- /res/properties_wnd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/properties_wnd.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.filters 3 | ipch 4 | x64 5 | ReadMe.txt 6 | *.db 7 | *.opendb 8 | *.aps 9 | *.vs 10 | -------------------------------------------------------------------------------- /.vs/RibbonExample/v14/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/.vs/RibbonExample/v14/.suo -------------------------------------------------------------------------------- /res/properties_wnd_hc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/HEAD/res/properties_wnd_hc.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ribbonexamples 2 | 3 | Ribbon Examples is a small demo project showing how to use the CWindow10Style class for making MFC applications have a Windows 10 look and feel 4 | 5 | Also included is RainbowStyle, a MFC VisualManager class for allowing you to explore the visual elements of a CMFCVisualManager 6 | 7 | 8 | ![Visual Manager](https://raw.githubusercontent.com/mydeveloperday/ribbonexamples/master/VisualManager.png "CMFCVisualManager") 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /RainbowStyle.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "RainbowStyle.h" 3 | #include "resource.h" 4 | 5 | using namespace Gdiplus; 6 | 7 | IMPLEMENT_DYNCREATE(CRainbowStyle, CMFCVisualManagerOffice2007); 8 | 9 | CRainbowStyle::CRainbowStyle() 10 | { 11 | m_crlBkgn = RGB(0xFF, 30, 30); 12 | 13 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); 14 | 15 | m_tabFaceBrush.CreateSolidBrush(m_clrWindows10ApplicationButton); 16 | m_tabBlackBrush.CreateSolidBrush(GetSysColor(COLOR_WINDOWFRAME)); 17 | 18 | // load the UI elements 19 | m_uiElements.Load(IDB_UI_ELEMENTS); 20 | } 21 | 22 | CRainbowStyle::~CRainbowStyle() 23 | { } 24 | 25 | -------------------------------------------------------------------------------- /Windows10Style.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Windows10Style.h" 3 | #include "resource.h" 4 | 5 | using namespace Gdiplus; 6 | 7 | IMPLEMENT_DYNCREATE(CWindows10Style, CMFCVisualManagerOffice2007); 8 | 9 | CWindows10Style::CWindows10Style() 10 | { 11 | m_crlBkgn = RGB(0xFF, 30, 30); 12 | 13 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); 14 | 15 | m_tabFaceBrush.CreateSolidBrush(m_clrWindows10ApplicationButton); 16 | m_tabBlackBrush.CreateSolidBrush(GetSysColor(COLOR_WINDOWFRAME)); 17 | 18 | // load the UI elements 19 | m_uiElements.Load(IDB_UI_ELEMENTS); 20 | } 21 | 22 | CWindows10Style::~CWindows10Style() 23 | { } 24 | 25 | -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.cpp : source file that includes just the standard includes 13 | // RibbonExample.pch will be the pre-compiled header 14 | // stdafx.obj will contain the pre-compiled type information 15 | 16 | #include "stdafx.h" 17 | 18 | 19 | -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | // Including SDKDDKVer.h defines the highest available Windows platform. 15 | 16 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 17 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 18 | 19 | #include 20 | -------------------------------------------------------------------------------- /ViewTree.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // CViewTree window 16 | 17 | class CViewTree : public CTreeCtrl 18 | { 19 | // Construction 20 | public: 21 | CViewTree(); 22 | 23 | // Overrides 24 | protected: 25 | virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); 26 | 27 | // Implementation 28 | public: 29 | virtual ~CViewTree(); 30 | 31 | protected: 32 | DECLARE_MESSAGE_MAP() 33 | }; 34 | -------------------------------------------------------------------------------- /ChildFrm.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // ChildFrm.h : interface of the CChildFrame class 13 | // 14 | 15 | #pragma once 16 | 17 | class CChildFrame : public CMDIChildWndEx 18 | { 19 | DECLARE_DYNCREATE(CChildFrame) 20 | public: 21 | CChildFrame(); 22 | 23 | // Attributes 24 | public: 25 | 26 | // Operations 27 | public: 28 | 29 | // Overrides 30 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 31 | 32 | // Implementation 33 | public: 34 | virtual ~CChildFrame(); 35 | #ifdef _DEBUG 36 | virtual void AssertValid() const; 37 | virtual void Dump(CDumpContext& dc) const; 38 | #endif 39 | 40 | // Generated message map functions 41 | protected: 42 | afx_msg void OnFilePrint(); 43 | afx_msg void OnFilePrintPreview(); 44 | afx_msg void OnUpdateFilePrintPreview(CCmdUI* pCmdUI); 45 | DECLARE_MESSAGE_MAP() 46 | }; 47 | -------------------------------------------------------------------------------- /RibbonExample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RibbonExample", "RibbonExample.vcxproj", "{562F06A9-535A-4CB4-95A9-A4935E02E696}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Debug|x64.ActiveCfg = Debug|x64 17 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Debug|x64.Build.0 = Debug|x64 18 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Debug|x86.ActiveCfg = Debug|Win32 19 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Debug|x86.Build.0 = Debug|Win32 20 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Release|x64.ActiveCfg = Release|x64 21 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Release|x64.Build.0 = Release|x64 22 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Release|x86.ActiveCfg = Release|Win32 23 | {562F06A9-535A-4CB4-95A9-A4935E02E696}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /RibbonExample.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExample.h : main header file for the RibbonExample application 13 | // 14 | #pragma once 15 | 16 | #ifndef __AFXWIN_H__ 17 | #error "include 'stdafx.h' before including this file for PCH" 18 | #endif 19 | 20 | #include "resource.h" // main symbols 21 | 22 | 23 | // CRibbonExampleApp: 24 | // See RibbonExample.cpp for the implementation of this class 25 | // 26 | 27 | class CRibbonExampleApp : public CWinAppEx 28 | { 29 | public: 30 | CRibbonExampleApp(); 31 | 32 | 33 | // Overrides 34 | public: 35 | virtual BOOL InitInstance(); 36 | virtual int ExitInstance(); 37 | 38 | // Implementation 39 | UINT m_nAppLook; 40 | BOOL m_bHiColorIcons; 41 | 42 | virtual void PreLoadState(); 43 | virtual void LoadCustomState(); 44 | virtual void SaveCustomState(); 45 | 46 | afx_msg void OnAppAbout(); 47 | DECLARE_MESSAGE_MAP() 48 | }; 49 | 50 | extern CRibbonExampleApp theApp; 51 | -------------------------------------------------------------------------------- /ViewTree.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #include "stdafx.h" 13 | #include "ViewTree.h" 14 | 15 | #ifdef _DEBUG 16 | #define new DEBUG_NEW 17 | #undef THIS_FILE 18 | static char THIS_FILE[] = __FILE__; 19 | #endif 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // CViewTree 23 | 24 | CViewTree::CViewTree() 25 | { 26 | } 27 | 28 | CViewTree::~CViewTree() 29 | { 30 | } 31 | 32 | BEGIN_MESSAGE_MAP(CViewTree, CTreeCtrl) 33 | END_MESSAGE_MAP() 34 | 35 | ///////////////////////////////////////////////////////////////////////////// 36 | // CViewTree message handlers 37 | 38 | BOOL CViewTree::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 39 | { 40 | BOOL bRes = CTreeCtrl::OnNotify(wParam, lParam, pResult); 41 | 42 | NMHDR* pNMHDR = (NMHDR*)lParam; 43 | ASSERT(pNMHDR != NULL); 44 | 45 | if (pNMHDR && pNMHDR->code == TTN_SHOW && GetToolTips() != NULL) 46 | { 47 | GetToolTips()->SetWindowPos(&wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSIZE); 48 | } 49 | 50 | return bRes; 51 | } 52 | -------------------------------------------------------------------------------- /RibbonExampleDoc.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExampleDoc.h : interface of the CRibbonExampleDoc class 13 | // 14 | 15 | 16 | #pragma once 17 | 18 | 19 | class CRibbonExampleDoc : public CDocument 20 | { 21 | protected: // create from serialization only 22 | CRibbonExampleDoc(); 23 | DECLARE_DYNCREATE(CRibbonExampleDoc) 24 | 25 | // Attributes 26 | public: 27 | 28 | // Operations 29 | public: 30 | 31 | // Overrides 32 | public: 33 | virtual BOOL OnNewDocument(); 34 | virtual void Serialize(CArchive& ar); 35 | #ifdef SHARED_HANDLERS 36 | virtual void InitializeSearchContent(); 37 | virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds); 38 | #endif // SHARED_HANDLERS 39 | 40 | // Implementation 41 | public: 42 | virtual ~CRibbonExampleDoc(); 43 | #ifdef _DEBUG 44 | virtual void AssertValid() const; 45 | virtual void Dump(CDumpContext& dc) const; 46 | #endif 47 | 48 | protected: 49 | 50 | // Generated message map functions 51 | protected: 52 | DECLARE_MESSAGE_MAP() 53 | 54 | #ifdef SHARED_HANDLERS 55 | // Helper function that sets search content for a Search Handler 56 | void SetSearchContent(const CString& value); 57 | #endif // SHARED_HANDLERS 58 | }; 59 | -------------------------------------------------------------------------------- /OutputWnd.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // COutputList window 16 | 17 | class COutputList : public CListBox 18 | { 19 | // Construction 20 | public: 21 | COutputList(); 22 | 23 | // Implementation 24 | public: 25 | virtual ~COutputList(); 26 | 27 | protected: 28 | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); 29 | afx_msg void OnEditCopy(); 30 | afx_msg void OnEditClear(); 31 | afx_msg void OnViewOutput(); 32 | 33 | DECLARE_MESSAGE_MAP() 34 | }; 35 | 36 | class COutputWnd : public CDockablePane 37 | { 38 | // Construction 39 | public: 40 | COutputWnd(); 41 | 42 | void UpdateFonts(); 43 | 44 | // Attributes 45 | protected: 46 | CMFCTabCtrl m_wndTabs; 47 | 48 | COutputList m_wndOutputBuild; 49 | COutputList m_wndOutputDebug; 50 | COutputList m_wndOutputFind; 51 | 52 | protected: 53 | void FillBuildWindow(); 54 | void FillDebugWindow(); 55 | void FillFindWindow(); 56 | 57 | void AdjustHorzScroll(CListBox& wndListBox); 58 | 59 | // Implementation 60 | public: 61 | virtual ~COutputWnd(); 62 | 63 | protected: 64 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 65 | afx_msg void OnSize(UINT nType, int cx, int cy); 66 | 67 | DECLARE_MESSAGE_MAP() 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /FileView.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | #include "ViewTree.h" 15 | 16 | class CFileViewToolBar : public CMFCToolBar 17 | { 18 | virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler) 19 | { 20 | CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler); 21 | } 22 | 23 | virtual BOOL AllowShowOnList() const { return FALSE; } 24 | }; 25 | 26 | class CFileView : public CDockablePane 27 | { 28 | // Construction 29 | public: 30 | CFileView(); 31 | 32 | void AdjustLayout(); 33 | void OnChangeVisualStyle(); 34 | 35 | // Attributes 36 | protected: 37 | 38 | CViewTree m_wndFileView; 39 | CImageList m_FileViewImages; 40 | CFileViewToolBar m_wndToolBar; 41 | 42 | protected: 43 | void FillFileView(); 44 | 45 | // Implementation 46 | public: 47 | virtual ~CFileView(); 48 | 49 | protected: 50 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 51 | afx_msg void OnSize(UINT nType, int cx, int cy); 52 | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); 53 | afx_msg void OnProperties(); 54 | afx_msg void OnFileOpen(); 55 | afx_msg void OnFileOpenWith(); 56 | afx_msg void OnDummyCompile(); 57 | afx_msg void OnEditCut(); 58 | afx_msg void OnEditCopy(); 59 | afx_msg void OnEditClear(); 60 | afx_msg void OnPaint(); 61 | afx_msg void OnSetFocus(CWnd* pOldWnd); 62 | 63 | DECLARE_MESSAGE_MAP() 64 | }; 65 | 66 | -------------------------------------------------------------------------------- /RibbonExampleView.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExampleView.h : interface of the CRibbonExampleView class 13 | // 14 | 15 | #pragma once 16 | 17 | 18 | class CRibbonExampleView : public CView 19 | { 20 | protected: // create from serialization only 21 | CRibbonExampleView(); 22 | DECLARE_DYNCREATE(CRibbonExampleView) 23 | 24 | // Attributes 25 | public: 26 | CRibbonExampleDoc* GetDocument() const; 27 | 28 | // Operations 29 | public: 30 | 31 | // Overrides 32 | public: 33 | virtual void OnDraw(CDC* pDC); // overridden to draw this view 34 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 35 | protected: 36 | virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 37 | virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); 38 | virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); 39 | 40 | // Implementation 41 | public: 42 | virtual ~CRibbonExampleView(); 43 | #ifdef _DEBUG 44 | virtual void AssertValid() const; 45 | virtual void Dump(CDumpContext& dc) const; 46 | #endif 47 | 48 | protected: 49 | 50 | // Generated message map functions 51 | protected: 52 | afx_msg void OnFilePrintPreview(); 53 | afx_msg void OnRButtonUp(UINT nFlags, CPoint point); 54 | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); 55 | DECLARE_MESSAGE_MAP() 56 | }; 57 | 58 | #ifndef _DEBUG // debug version in RibbonExampleView.cpp 59 | inline CRibbonExampleDoc* CRibbonExampleView::GetDocument() const 60 | { return reinterpret_cast(m_pDocument); } 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /ClassView.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | #include "ViewTree.h" 15 | 16 | class CClassToolBar : public CMFCToolBar 17 | { 18 | virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler) 19 | { 20 | CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler); 21 | } 22 | 23 | virtual BOOL AllowShowOnList() const { return FALSE; } 24 | }; 25 | 26 | class CClassView : public CDockablePane 27 | { 28 | public: 29 | CClassView(); 30 | virtual ~CClassView(); 31 | 32 | void AdjustLayout(); 33 | void OnChangeVisualStyle(); 34 | 35 | protected: 36 | CClassToolBar m_wndToolBar; 37 | CViewTree m_wndClassView; 38 | CImageList m_ClassViewImages; 39 | UINT m_nCurrSort; 40 | 41 | void FillClassView(); 42 | 43 | // Overrides 44 | public: 45 | virtual BOOL PreTranslateMessage(MSG* pMsg); 46 | 47 | protected: 48 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 49 | afx_msg void OnSize(UINT nType, int cx, int cy); 50 | afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); 51 | afx_msg void OnClassAddMemberFunction(); 52 | afx_msg void OnClassAddMemberVariable(); 53 | afx_msg void OnClassDefinition(); 54 | afx_msg void OnClassProperties(); 55 | afx_msg void OnNewFolder(); 56 | afx_msg void OnPaint(); 57 | afx_msg void OnSetFocus(CWnd* pOldWnd); 58 | afx_msg LRESULT OnChangeActiveTab(WPARAM, LPARAM); 59 | afx_msg void OnSort(UINT id); 60 | afx_msg void OnUpdateSort(CCmdUI* pCmdUI); 61 | 62 | DECLARE_MESSAGE_MAP() 63 | }; 64 | 65 | -------------------------------------------------------------------------------- /PropertiesWnd.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | class CPropertiesToolBar : public CMFCToolBar 15 | { 16 | public: 17 | virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler) 18 | { 19 | CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler); 20 | } 21 | 22 | virtual BOOL AllowShowOnList() const { return FALSE; } 23 | }; 24 | 25 | class CPropertiesWnd : public CDockablePane 26 | { 27 | // Construction 28 | public: 29 | CPropertiesWnd(); 30 | 31 | void AdjustLayout(); 32 | 33 | // Attributes 34 | public: 35 | void SetVSDotNetLook(BOOL bSet) 36 | { 37 | m_wndPropList.SetVSDotNetLook(bSet); 38 | m_wndPropList.SetGroupNameFullWidth(bSet); 39 | } 40 | 41 | protected: 42 | CFont m_fntPropList; 43 | CComboBox m_wndObjectCombo; 44 | CPropertiesToolBar m_wndToolBar; 45 | CMFCPropertyGridCtrl m_wndPropList; 46 | 47 | // Implementation 48 | public: 49 | virtual ~CPropertiesWnd(); 50 | 51 | protected: 52 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 53 | afx_msg void OnSize(UINT nType, int cx, int cy); 54 | afx_msg void OnExpandAllProperties(); 55 | afx_msg void OnUpdateExpandAllProperties(CCmdUI* pCmdUI); 56 | afx_msg void OnSortProperties(); 57 | afx_msg void OnUpdateSortProperties(CCmdUI* pCmdUI); 58 | afx_msg void OnProperties1(); 59 | afx_msg void OnUpdateProperties1(CCmdUI* pCmdUI); 60 | afx_msg void OnProperties2(); 61 | afx_msg void OnUpdateProperties2(CCmdUI* pCmdUI); 62 | afx_msg void OnSetFocus(CWnd* pOldWnd); 63 | afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection); 64 | 65 | DECLARE_MESSAGE_MAP() 66 | 67 | void InitPropList(); 68 | void SetPropListFont(); 69 | 70 | int m_nComboHeight; 71 | }; 72 | 73 | -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.h : include file for standard system include files, 13 | // or project specific include files that are used frequently, 14 | // but are changed infrequently 15 | 16 | #pragma once 17 | 18 | #ifndef VC_EXTRALEAN 19 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 20 | #endif 21 | 22 | #include "targetver.h" 23 | 24 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 25 | 26 | // turns off MFC's hiding of some common and often safely ignored warning messages 27 | #define _AFX_ALL_WARNINGS 28 | 29 | #include // MFC core and standard components 30 | #include // MFC extensions 31 | 32 | 33 | #include // MFC Automation classes 34 | 35 | 36 | 37 | #ifndef _AFX_NO_OLE_SUPPORT 38 | #include // MFC support for Internet Explorer 4 Common Controls 39 | #endif 40 | #ifndef _AFX_NO_AFXCMN_SUPPORT 41 | #include // MFC support for Windows Common Controls 42 | #endif // _AFX_NO_AFXCMN_SUPPORT 43 | 44 | #include // MFC support for ribbons and control bars 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | #ifdef _UNICODE 55 | #if defined _M_IX86 56 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 57 | #elif defined _M_X64 58 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 59 | #else 60 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 61 | #endif 62 | #endif 63 | 64 | 65 | -------------------------------------------------------------------------------- /ChildFrm.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // ChildFrm.cpp : implementation of the CChildFrame class 13 | // 14 | 15 | #include "stdafx.h" 16 | #include "RibbonExample.h" 17 | 18 | #include "ChildFrm.h" 19 | 20 | #ifdef _DEBUG 21 | #define new DEBUG_NEW 22 | #endif 23 | 24 | // CChildFrame 25 | 26 | IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx) 27 | 28 | BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx) 29 | ON_COMMAND(ID_FILE_PRINT, &CChildFrame::OnFilePrint) 30 | ON_COMMAND(ID_FILE_PRINT_DIRECT, &CChildFrame::OnFilePrint) 31 | ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CChildFrame::OnFilePrintPreview) 32 | ON_UPDATE_COMMAND_UI(ID_FILE_PRINT_PREVIEW, &CChildFrame::OnUpdateFilePrintPreview) 33 | END_MESSAGE_MAP() 34 | 35 | // CChildFrame construction/destruction 36 | 37 | CChildFrame::CChildFrame() 38 | { 39 | // TODO: add member initialization code here 40 | } 41 | 42 | CChildFrame::~CChildFrame() 43 | { 44 | } 45 | 46 | 47 | BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) 48 | { 49 | // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs 50 | if( !CMDIChildWndEx::PreCreateWindow(cs) ) 51 | return FALSE; 52 | 53 | return TRUE; 54 | } 55 | 56 | // CChildFrame diagnostics 57 | 58 | #ifdef _DEBUG 59 | void CChildFrame::AssertValid() const 60 | { 61 | CMDIChildWndEx::AssertValid(); 62 | } 63 | 64 | void CChildFrame::Dump(CDumpContext& dc) const 65 | { 66 | CMDIChildWndEx::Dump(dc); 67 | } 68 | #endif //_DEBUG 69 | 70 | // CChildFrame message handlers 71 | 72 | void CChildFrame::OnFilePrint() 73 | { 74 | if (m_dockManager.IsPrintPreviewValid()) 75 | { 76 | PostMessage(WM_COMMAND, AFX_ID_PREVIEW_PRINT); 77 | } 78 | } 79 | 80 | void CChildFrame::OnFilePrintPreview() 81 | { 82 | if (m_dockManager.IsPrintPreviewValid()) 83 | { 84 | PostMessage(WM_COMMAND, AFX_ID_PREVIEW_CLOSE); // force Print Preview mode closed 85 | } 86 | } 87 | 88 | void CChildFrame::OnUpdateFilePrintPreview(CCmdUI* pCmdUI) 89 | { 90 | pCmdUI->SetCheck(m_dockManager.IsPrintPreviewValid()); 91 | } 92 | -------------------------------------------------------------------------------- /MainFrm.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // MainFrm.h : interface of the CMainFrame class 13 | // 14 | 15 | #pragma once 16 | #include "FileView.h" 17 | #include "ClassView.h" 18 | #include "OutputWnd.h" 19 | #include "PropertiesWnd.h" 20 | 21 | class CWindows10StyleApplicationButton: public CMFCRibbonApplicationButton 22 | { 23 | public: 24 | CWindows10StyleApplicationButton() { 25 | SetText(L"File"); 26 | } 27 | 28 | void OnDraw(CDC* pDC) { 29 | CString str = GetText(); 30 | 31 | if (!str.IsEmpty()) 32 | { 33 | COLORREF clrTextOld = pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT)); 34 | pDC->DrawText(str, GetRect(), DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); 35 | pDC->SetTextColor(clrTextOld); 36 | } 37 | } 38 | }; 39 | 40 | class CMainFrame : public CMDIFrameWndEx 41 | { 42 | DECLARE_DYNAMIC(CMainFrame) 43 | public: 44 | CMainFrame(); 45 | 46 | // Attributes 47 | public: 48 | 49 | // Operations 50 | public: 51 | 52 | // Overrides 53 | public: 54 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 55 | 56 | // Implementation 57 | public: 58 | virtual ~CMainFrame(); 59 | #ifdef _DEBUG 60 | virtual void AssertValid() const; 61 | virtual void Dump(CDumpContext& dc) const; 62 | #endif 63 | 64 | protected: // control bar embedded members 65 | CMFCRibbonBar m_wndRibbonBar; 66 | CWindows10StyleApplicationButton m_MainButton; 67 | CMFCToolBarImages m_PanelImages; 68 | CMFCRibbonStatusBar m_wndStatusBar; 69 | CFileView m_wndFileView; 70 | CClassView m_wndClassView; 71 | COutputWnd m_wndOutput; 72 | CPropertiesWnd m_wndProperties; 73 | 74 | // Generated message map functions 75 | protected: 76 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 77 | afx_msg void OnWindowManager(); 78 | afx_msg void OnApplicationLook(UINT id); 79 | afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI); 80 | afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection); 81 | afx_msg void OnNcPaint(); 82 | DECLARE_MESSAGE_MAP() 83 | 84 | BOOL CreateDockingWindows(); 85 | void SetDockingWindowIcons(BOOL bHiColorIcons); 86 | 87 | }; 88 | 89 | 90 | -------------------------------------------------------------------------------- /RibbonExampleView.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExampleView.cpp : implementation of the CRibbonExampleView class 13 | // 14 | 15 | #include "stdafx.h" 16 | // SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail 17 | // and search filter handlers and allows sharing of document code with that project. 18 | #ifndef SHARED_HANDLERS 19 | #include "RibbonExample.h" 20 | #endif 21 | 22 | #include "RibbonExampleDoc.h" 23 | #include "RibbonExampleView.h" 24 | 25 | #ifdef _DEBUG 26 | #define new DEBUG_NEW 27 | #endif 28 | 29 | 30 | // CRibbonExampleView 31 | 32 | IMPLEMENT_DYNCREATE(CRibbonExampleView, CView) 33 | 34 | BEGIN_MESSAGE_MAP(CRibbonExampleView, CView) 35 | // Standard printing commands 36 | ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint) 37 | ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint) 38 | ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CRibbonExampleView::OnFilePrintPreview) 39 | ON_WM_CONTEXTMENU() 40 | ON_WM_RBUTTONUP() 41 | END_MESSAGE_MAP() 42 | 43 | // CRibbonExampleView construction/destruction 44 | 45 | CRibbonExampleView::CRibbonExampleView() 46 | { 47 | // TODO: add construction code here 48 | 49 | } 50 | 51 | CRibbonExampleView::~CRibbonExampleView() 52 | { 53 | } 54 | 55 | BOOL CRibbonExampleView::PreCreateWindow(CREATESTRUCT& cs) 56 | { 57 | // TODO: Modify the Window class or styles here by modifying 58 | // the CREATESTRUCT cs 59 | 60 | return CView::PreCreateWindow(cs); 61 | } 62 | 63 | // CRibbonExampleView drawing 64 | 65 | void CRibbonExampleView::OnDraw(CDC* /*pDC*/) 66 | { 67 | CRibbonExampleDoc* pDoc = GetDocument(); 68 | ASSERT_VALID(pDoc); 69 | if (!pDoc) 70 | return; 71 | 72 | // TODO: add draw code for native data here 73 | } 74 | 75 | 76 | // CRibbonExampleView printing 77 | 78 | 79 | void CRibbonExampleView::OnFilePrintPreview() 80 | { 81 | #ifndef SHARED_HANDLERS 82 | AFXPrintPreview(this); 83 | #endif 84 | } 85 | 86 | BOOL CRibbonExampleView::OnPreparePrinting(CPrintInfo* pInfo) 87 | { 88 | // default preparation 89 | return DoPreparePrinting(pInfo); 90 | } 91 | 92 | void CRibbonExampleView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 93 | { 94 | // TODO: add extra initialization before printing 95 | } 96 | 97 | void CRibbonExampleView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 98 | { 99 | // TODO: add cleanup after printing 100 | } 101 | 102 | void CRibbonExampleView::OnRButtonUp(UINT /* nFlags */, CPoint point) 103 | { 104 | ClientToScreen(&point); 105 | OnContextMenu(this, point); 106 | } 107 | 108 | void CRibbonExampleView::OnContextMenu(CWnd* /* pWnd */, CPoint point) 109 | { 110 | #ifndef SHARED_HANDLERS 111 | theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE); 112 | #endif 113 | } 114 | 115 | 116 | // CRibbonExampleView diagnostics 117 | 118 | #ifdef _DEBUG 119 | void CRibbonExampleView::AssertValid() const 120 | { 121 | CView::AssertValid(); 122 | } 123 | 124 | void CRibbonExampleView::Dump(CDumpContext& dc) const 125 | { 126 | CView::Dump(dc); 127 | } 128 | 129 | CRibbonExampleDoc* CRibbonExampleView::GetDocument() const // non-debug version is inline 130 | { 131 | ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRibbonExampleDoc))); 132 | return (CRibbonExampleDoc*)m_pDocument; 133 | } 134 | #endif //_DEBUG 135 | 136 | 137 | // CRibbonExampleView message handlers 138 | -------------------------------------------------------------------------------- /RibbonExampleDoc.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExampleDoc.cpp : implementation of the CRibbonExampleDoc class 13 | // 14 | 15 | #include "stdafx.h" 16 | // SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail 17 | // and search filter handlers and allows sharing of document code with that project. 18 | #ifndef SHARED_HANDLERS 19 | #include "RibbonExample.h" 20 | #endif 21 | 22 | #include "RibbonExampleDoc.h" 23 | 24 | #include 25 | 26 | #ifdef _DEBUG 27 | #define new DEBUG_NEW 28 | #endif 29 | 30 | // CRibbonExampleDoc 31 | 32 | IMPLEMENT_DYNCREATE(CRibbonExampleDoc, CDocument) 33 | 34 | BEGIN_MESSAGE_MAP(CRibbonExampleDoc, CDocument) 35 | END_MESSAGE_MAP() 36 | 37 | 38 | // CRibbonExampleDoc construction/destruction 39 | 40 | CRibbonExampleDoc::CRibbonExampleDoc() 41 | { 42 | // TODO: add one-time construction code here 43 | 44 | } 45 | 46 | CRibbonExampleDoc::~CRibbonExampleDoc() 47 | { 48 | } 49 | 50 | BOOL CRibbonExampleDoc::OnNewDocument() 51 | { 52 | if (!CDocument::OnNewDocument()) 53 | return FALSE; 54 | 55 | // TODO: add reinitialization code here 56 | // (SDI documents will reuse this document) 57 | 58 | return TRUE; 59 | } 60 | 61 | 62 | 63 | 64 | // CRibbonExampleDoc serialization 65 | 66 | void CRibbonExampleDoc::Serialize(CArchive& ar) 67 | { 68 | if (ar.IsStoring()) 69 | { 70 | // TODO: add storing code here 71 | } 72 | else 73 | { 74 | // TODO: add loading code here 75 | } 76 | } 77 | 78 | #ifdef SHARED_HANDLERS 79 | 80 | // Support for thumbnails 81 | void CRibbonExampleDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds) 82 | { 83 | // Modify this code to draw the document's data 84 | dc.FillSolidRect(lprcBounds, RGB(255, 255, 255)); 85 | 86 | CString strText = _T("TODO: implement thumbnail drawing here"); 87 | LOGFONT lf; 88 | 89 | CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); 90 | pDefaultGUIFont->GetLogFont(&lf); 91 | lf.lfHeight = 36; 92 | 93 | CFont fontDraw; 94 | fontDraw.CreateFontIndirect(&lf); 95 | 96 | CFont* pOldFont = dc.SelectObject(&fontDraw); 97 | dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK); 98 | dc.SelectObject(pOldFont); 99 | } 100 | 101 | // Support for Search Handlers 102 | void CRibbonExampleDoc::InitializeSearchContent() 103 | { 104 | CString strSearchContent; 105 | // Set search contents from document's data. 106 | // The content parts should be separated by ";" 107 | 108 | // For example: strSearchContent = _T("point;rectangle;circle;ole object;"); 109 | SetSearchContent(strSearchContent); 110 | } 111 | 112 | void CRibbonExampleDoc::SetSearchContent(const CString& value) 113 | { 114 | if (value.IsEmpty()) 115 | { 116 | RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid); 117 | } 118 | else 119 | { 120 | CMFCFilterChunkValueImpl *pChunk = NULL; 121 | ATLTRY(pChunk = new CMFCFilterChunkValueImpl); 122 | if (pChunk != NULL) 123 | { 124 | pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT); 125 | SetChunkValue(pChunk); 126 | } 127 | } 128 | } 129 | 130 | #endif // SHARED_HANDLERS 131 | 132 | // CRibbonExampleDoc diagnostics 133 | 134 | #ifdef _DEBUG 135 | void CRibbonExampleDoc::AssertValid() const 136 | { 137 | CDocument::AssertValid(); 138 | } 139 | 140 | void CRibbonExampleDoc::Dump(CDumpContext& dc) const 141 | { 142 | CDocument::Dump(dc); 143 | } 144 | #endif //_DEBUG 145 | 146 | 147 | // CRibbonExampleDoc commands 148 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by RibbonExample.rc 4 | // 5 | #define IDD_ABOUTBOX 100 6 | #define IDP_OLE_INIT_FAILED 100 7 | #define IDB_WRITESMALL 110 8 | #define IDB_WRITELARGE 111 9 | #define IDB_MAIN 112 10 | #define IDB_BUTTONS 113 11 | #define IDB_FILELARGE 114 12 | #define IDB_FILELARGEA 114 13 | #define IDB_FILESMALL 115 14 | #define IDR_POPUP_EDIT 119 15 | #define ID_STATUSBAR_PANE1 120 16 | #define ID_STATUSBAR_PANE2 121 17 | #define IDS_STATUS_PANE1 122 18 | #define IDS_STATUS_PANE2 123 19 | #define IDR_MAINFRAME 128 20 | #define IDR_MAINFRAME_256 129 21 | #define IDR_RibbonExampleTYPE 130 22 | #define ID_WINDOW_MANAGER 131 23 | #define ID_VIEW_FILEVIEW 133 24 | #define ID_VIEW_CLASSVIEW 134 25 | #define ID_PROPERTIES 135 26 | #define ID_OPEN 136 27 | #define ID_OPEN_WITH 137 28 | #define ID_DUMMY_COMPILE 138 29 | #define ID_CLASS_ADD_MEMBER_FUNCTION 139 30 | #define ID_CLASS_ADD_MEMBER_VARIABLE 140 31 | #define ID_CLASS_DEFINITION 141 32 | #define ID_CLASS_PROPERTIES 142 33 | #define ID_NEW_FOLDER 143 34 | #define ID_SORT_MENU 144 35 | #define ID_SORTING_GROUPBYTYPE 145 36 | #define ID_SORTING_SORTALPHABETIC 146 37 | #define ID_SORTING_SORTBYTYPE 147 38 | #define ID_SORTING_SORTBYACCESS 148 39 | #define ID_VIEW_OUTPUTWND 149 40 | #define ID_VIEW_PROPERTIESWND 150 41 | #define IDR_PASTE_MENU 151 42 | #define ID_SORTPROPERTIES 151 43 | #define IDR_WINDOWS_MENU 152 44 | #define ID_PROPERTIES1 152 45 | #define ID_PROPERTIES2 153 46 | #define ID_EXPAND_ALL 154 47 | #define IDS_FILE_VIEW 155 48 | #define IDS_CLASS_VIEW 156 49 | #define IDS_OUTPUT_WND 157 50 | #define IDS_PROPERTIES_WND 158 51 | #define IDI_FILE_VIEW 161 52 | #define IDI_FILE_VIEW_HC 162 53 | #define IDI_CLASS_VIEW 163 54 | #define IDI_CLASS_VIEW_HC 164 55 | #define IDI_OUTPUT_WND 165 56 | #define IDI_OUTPUT_WND_HC 166 57 | #define IDI_PROPERTIES_WND 167 58 | #define IDI_PROPERTIES_WND_HC 168 59 | #define IDR_EXPLORER 169 60 | #define IDB_EXPLORER_24 170 61 | #define IDR_SORT 171 62 | #define IDB_SORT_24 172 63 | #define IDR_POPUP_SORT 173 64 | #define IDR_POPUP_EXPLORER 174 65 | #define IDB_FILE_VIEW 175 66 | #define IDB_FILE_VIEW_24 176 67 | #define IDB_CLASS_VIEW 177 68 | #define IDB_CLASS_VIEW_24 178 69 | #define IDR_MENU_IMAGES 179 70 | #define IDB_MENU_IMAGES_24 180 71 | #define ID_TOOLS_MACRO 181 72 | #define IDR_OUTPUT_POPUP 182 73 | #define IDR_PROPERTIES 183 74 | #define IDB_PROPERTIES_HC 184 75 | #define IDR_THEME_MENU 200 76 | #define ID_SET_STYLE 201 77 | #define ID_VIEW_APPLOOK_WIN_2000 205 78 | #define ID_VIEW_APPLOOK_OFF_XP 206 79 | #define ID_VIEW_APPLOOK_WIN_XP 207 80 | #define ID_VIEW_APPLOOK_OFF_2003 208 81 | #define ID_VIEW_APPLOOK_VS_2005 209 82 | #define ID_VIEW_APPLOOK_VS_2008 210 83 | #define ID_VIEW_APPLOOK_OFF_2007_BLUE 215 84 | #define ID_VIEW_APPLOOK_OFF_2007_BLACK 216 85 | #define ID_VIEW_APPLOOK_OFF_2007_SILVER 217 86 | #define ID_VIEW_APPLOOK_OFF_2007_AQUA 218 87 | #define ID_VIEW_APPLOOK_WINDOWS_7 219 88 | #define ID_VIEW_APPLOOK_WINDOWS_10 220 89 | #define ID_VIEW_APPLOOK_OFFICE2016 221 90 | #define ID_VIEW_APPLOOK_RAINBOW 222 91 | #define IDS_BUILD_TAB 300 92 | #define IDS_DEBUG_TAB 301 93 | #define IDS_FIND_TAB 302 94 | #define IDS_EXPLORER 305 95 | #define IDS_EDIT_MENU 306 96 | #define IDR_RIBBON 307 97 | #define IDB_PNG1 313 98 | #define IDB_UI_ELEMENTS 313 99 | #define ID_WRITE_PASTEASHYPERLINK 32770 100 | #define ID_BUTTON2 32771 101 | #define ID_BUTTON3 32772 102 | #define ID_BUTTON4 32773 103 | #define ID_EDIT2 32774 104 | #define ID_SPIN2 32775 105 | #define ID_COMBO2 32776 106 | #define ID_COMBO3 32777 107 | #define ID_BUTTON7 32780 108 | #define ID_BUTTON8 32781 109 | #define ID_SLIDER2 32782 110 | #define ID_PROGRESS2 32783 111 | #define ID_SYSLINK2 32784 112 | 113 | // Next default values for new objects 114 | // 115 | #ifdef APSTUDIO_INVOKED 116 | #ifndef APSTUDIO_READONLY_SYMBOLS 117 | #define _APS_NEXT_RESOURCE_VALUE 314 118 | #define _APS_NEXT_COMMAND_VALUE 32791 119 | #define _APS_NEXT_CONTROL_VALUE 1000 120 | #define _APS_NEXT_SYMED_VALUE 310 121 | #endif 122 | #endif 123 | -------------------------------------------------------------------------------- /OutputWnd.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #include "stdafx.h" 13 | 14 | #include "OutputWnd.h" 15 | #include "Resource.h" 16 | #include "MainFrm.h" 17 | 18 | #ifdef _DEBUG 19 | #define new DEBUG_NEW 20 | #undef THIS_FILE 21 | static char THIS_FILE[] = __FILE__; 22 | #endif 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // COutputBar 26 | 27 | COutputWnd::COutputWnd() 28 | { 29 | } 30 | 31 | COutputWnd::~COutputWnd() 32 | { 33 | } 34 | 35 | BEGIN_MESSAGE_MAP(COutputWnd, CDockablePane) 36 | ON_WM_CREATE() 37 | ON_WM_SIZE() 38 | END_MESSAGE_MAP() 39 | 40 | int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 41 | { 42 | if (CDockablePane::OnCreate(lpCreateStruct) == -1) 43 | return -1; 44 | 45 | CRect rectDummy; 46 | rectDummy.SetRectEmpty(); 47 | 48 | // Create tabs window: 49 | if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1)) 50 | { 51 | TRACE0("Failed to create output tab window\n"); 52 | return -1; // fail to create 53 | } 54 | 55 | // Create output panes: 56 | const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; 57 | 58 | if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) || 59 | !m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) || 60 | !m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4)) 61 | { 62 | TRACE0("Failed to create output windows\n"); 63 | return -1; // fail to create 64 | } 65 | 66 | UpdateFonts(); 67 | 68 | CString strTabName; 69 | BOOL bNameValid; 70 | 71 | // Attach list windows to tab: 72 | bNameValid = strTabName.LoadString(IDS_BUILD_TAB); 73 | ASSERT(bNameValid); 74 | m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0); 75 | bNameValid = strTabName.LoadString(IDS_DEBUG_TAB); 76 | ASSERT(bNameValid); 77 | m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1); 78 | bNameValid = strTabName.LoadString(IDS_FIND_TAB); 79 | ASSERT(bNameValid); 80 | m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2); 81 | 82 | // Fill output tabs with some dummy text (nothing magic here) 83 | FillBuildWindow(); 84 | FillDebugWindow(); 85 | FillFindWindow(); 86 | 87 | return 0; 88 | } 89 | 90 | void COutputWnd::OnSize(UINT nType, int cx, int cy) 91 | { 92 | CDockablePane::OnSize(nType, cx, cy); 93 | 94 | // Tab control should cover the whole client area: 95 | m_wndTabs.SetWindowPos (NULL, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); 96 | } 97 | 98 | void COutputWnd::AdjustHorzScroll(CListBox& wndListBox) 99 | { 100 | CClientDC dc(this); 101 | CFont* pOldFont = dc.SelectObject(&afxGlobalData.fontRegular); 102 | 103 | int cxExtentMax = 0; 104 | 105 | for (int i = 0; i < wndListBox.GetCount(); i ++) 106 | { 107 | CString strItem; 108 | wndListBox.GetText(i, strItem); 109 | 110 | cxExtentMax = max(cxExtentMax, (int)dc.GetTextExtent(strItem).cx); 111 | } 112 | 113 | wndListBox.SetHorizontalExtent(cxExtentMax); 114 | dc.SelectObject(pOldFont); 115 | } 116 | 117 | void COutputWnd::FillBuildWindow() 118 | { 119 | m_wndOutputBuild.AddString(_T("Build output is being displayed here.")); 120 | m_wndOutputBuild.AddString(_T("The output is being displayed in rows of a list view")); 121 | m_wndOutputBuild.AddString(_T("but you can change the way it is displayed as you wish...")); 122 | } 123 | 124 | void COutputWnd::FillDebugWindow() 125 | { 126 | m_wndOutputDebug.AddString(_T("Debug output is being displayed here.")); 127 | m_wndOutputDebug.AddString(_T("The output is being displayed in rows of a list view")); 128 | m_wndOutputDebug.AddString(_T("but you can change the way it is displayed as you wish...")); 129 | } 130 | 131 | void COutputWnd::FillFindWindow() 132 | { 133 | m_wndOutputFind.AddString(_T("Find output is being displayed here.")); 134 | m_wndOutputFind.AddString(_T("The output is being displayed in rows of a list view")); 135 | m_wndOutputFind.AddString(_T("but you can change the way it is displayed as you wish...")); 136 | } 137 | 138 | void COutputWnd::UpdateFonts() 139 | { 140 | m_wndOutputBuild.SetFont(&afxGlobalData.fontRegular); 141 | m_wndOutputDebug.SetFont(&afxGlobalData.fontRegular); 142 | m_wndOutputFind.SetFont(&afxGlobalData.fontRegular); 143 | } 144 | 145 | ///////////////////////////////////////////////////////////////////////////// 146 | // COutputList1 147 | 148 | COutputList::COutputList() 149 | { 150 | } 151 | 152 | COutputList::~COutputList() 153 | { 154 | } 155 | 156 | BEGIN_MESSAGE_MAP(COutputList, CListBox) 157 | ON_WM_CONTEXTMENU() 158 | ON_COMMAND(ID_EDIT_COPY, OnEditCopy) 159 | ON_COMMAND(ID_EDIT_CLEAR, OnEditClear) 160 | ON_COMMAND(ID_VIEW_OUTPUTWND, OnViewOutput) 161 | ON_WM_WINDOWPOSCHANGING() 162 | END_MESSAGE_MAP() 163 | ///////////////////////////////////////////////////////////////////////////// 164 | // COutputList message handlers 165 | 166 | void COutputList::OnContextMenu(CWnd* /*pWnd*/, CPoint point) 167 | { 168 | CMenu menu; 169 | menu.LoadMenu(IDR_OUTPUT_POPUP); 170 | 171 | CMenu* pSumMenu = menu.GetSubMenu(0); 172 | 173 | if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx))) 174 | { 175 | CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu; 176 | 177 | if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE)) 178 | return; 179 | 180 | ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu); 181 | UpdateDialogControls(this, FALSE); 182 | } 183 | 184 | SetFocus(); 185 | } 186 | 187 | void COutputList::OnEditCopy() 188 | { 189 | MessageBox(_T("Copy output")); 190 | } 191 | 192 | void COutputList::OnEditClear() 193 | { 194 | MessageBox(_T("Clear output")); 195 | } 196 | 197 | void COutputList::OnViewOutput() 198 | { 199 | CDockablePane* pParentBar = DYNAMIC_DOWNCAST(CDockablePane, GetOwner()); 200 | CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWndEx, GetTopLevelFrame()); 201 | 202 | if (pMainFrame != NULL && pParentBar != NULL) 203 | { 204 | pMainFrame->SetFocus(); 205 | pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE); 206 | pMainFrame->RecalcLayout(); 207 | 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /RibbonExample.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // RibbonExample.cpp : Defines the class behaviors for the application. 13 | // 14 | 15 | #include "stdafx.h" 16 | #include "afxwinappex.h" 17 | #include "afxdialogex.h" 18 | #include "RibbonExample.h" 19 | #include "MainFrm.h" 20 | 21 | #include "ChildFrm.h" 22 | #include "RibbonExampleDoc.h" 23 | #include "RibbonExampleView.h" 24 | 25 | #ifdef _DEBUG 26 | #define new DEBUG_NEW 27 | #endif 28 | 29 | 30 | // CRibbonExampleApp 31 | 32 | BEGIN_MESSAGE_MAP(CRibbonExampleApp, CWinAppEx) 33 | ON_COMMAND(ID_APP_ABOUT, &CRibbonExampleApp::OnAppAbout) 34 | // Standard file based document commands 35 | ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew) 36 | ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen) 37 | // Standard print setup command 38 | ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup) 39 | END_MESSAGE_MAP() 40 | 41 | 42 | // CRibbonExampleApp construction 43 | 44 | CRibbonExampleApp::CRibbonExampleApp() 45 | { 46 | m_bHiColorIcons = TRUE; 47 | 48 | // support Restart Manager 49 | m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS; 50 | #ifdef _MANAGED 51 | // If the application is built using Common Language Runtime support (/clr): 52 | // 1) This additional setting is needed for Restart Manager support to work properly. 53 | // 2) In your project, you must add a reference to System.Windows.Forms in order to build. 54 | System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException); 55 | #endif 56 | 57 | // TODO: replace application ID string below with unique ID string; recommended 58 | // format for string is CompanyName.ProductName.SubProduct.VersionInformation 59 | SetAppID(_T("RibbonExample.AppID.NoVersion")); 60 | 61 | // TODO: add construction code here, 62 | // Place all significant initialization in InitInstance 63 | } 64 | 65 | // The one and only CRibbonExampleApp object 66 | 67 | CRibbonExampleApp theApp; 68 | 69 | 70 | // CRibbonExampleApp initialization 71 | 72 | BOOL CRibbonExampleApp::InitInstance() 73 | { 74 | // InitCommonControlsEx() is required on Windows XP if an application 75 | // manifest specifies use of ComCtl32.dll version 6 or later to enable 76 | // visual styles. Otherwise, any window creation will fail. 77 | INITCOMMONCONTROLSEX InitCtrls; 78 | InitCtrls.dwSize = sizeof(InitCtrls); 79 | // Set this to include all the common control classes you want to use 80 | // in your application. 81 | InitCtrls.dwICC = ICC_WIN95_CLASSES; 82 | InitCommonControlsEx(&InitCtrls); 83 | 84 | CWinAppEx::InitInstance(); 85 | 86 | 87 | // Initialize OLE libraries 88 | if (!AfxOleInit()) 89 | { 90 | AfxMessageBox(IDP_OLE_INIT_FAILED); 91 | return FALSE; 92 | } 93 | 94 | AfxEnableControlContainer(); 95 | 96 | EnableTaskbarInteraction(); 97 | 98 | // AfxInitRichEdit2() is required to use RichEdit control 99 | // AfxInitRichEdit2(); 100 | 101 | // Standard initialization 102 | // If you are not using these features and wish to reduce the size 103 | // of your final executable, you should remove from the following 104 | // the specific initialization routines you do not need 105 | // Change the registry key under which our settings are stored 106 | // TODO: You should modify this string to be something appropriate 107 | // such as the name of your company or organization 108 | SetRegistryKey(_T("Local AppWizard-Generated Applications")); 109 | LoadStdProfileSettings(4); // Load standard INI file options (including MRU) 110 | 111 | 112 | InitContextMenuManager(); 113 | 114 | InitKeyboardManager(); 115 | 116 | InitTooltipManager(); 117 | CMFCToolTipInfo ttParams; 118 | ttParams.m_bVislManagerTheme = TRUE; 119 | theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, 120 | RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); 121 | 122 | // Register the application's document templates. Document templates 123 | // serve as the connection between documents, frame windows and views 124 | CMultiDocTemplate* pDocTemplate; 125 | pDocTemplate = new CMultiDocTemplate(IDR_RibbonExampleTYPE, 126 | RUNTIME_CLASS(CRibbonExampleDoc), 127 | RUNTIME_CLASS(CChildFrame), // custom MDI child frame 128 | RUNTIME_CLASS(CRibbonExampleView)); 129 | if (!pDocTemplate) 130 | return FALSE; 131 | AddDocTemplate(pDocTemplate); 132 | 133 | // create main MDI Frame window 134 | CMainFrame* pMainFrame = new CMainFrame; 135 | if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) 136 | { 137 | delete pMainFrame; 138 | return FALSE; 139 | } 140 | m_pMainWnd = pMainFrame; 141 | 142 | 143 | // Parse command line for standard shell commands, DDE, file open 144 | CCommandLineInfo cmdInfo; 145 | ParseCommandLine(cmdInfo); 146 | 147 | 148 | 149 | // Dispatch commands specified on the command line. Will return FALSE if 150 | // app was launched with /RegServer, /Register, /Unregserver or /Unregister. 151 | if (!ProcessShellCommand(cmdInfo)) 152 | return FALSE; 153 | // The main window has been initialized, so show and update it 154 | pMainFrame->ShowWindow(m_nCmdShow); 155 | pMainFrame->UpdateWindow(); 156 | 157 | return TRUE; 158 | } 159 | 160 | int CRibbonExampleApp::ExitInstance() 161 | { 162 | //TODO: handle additional resources you may have added 163 | AfxOleTerm(FALSE); 164 | 165 | return CWinAppEx::ExitInstance(); 166 | } 167 | 168 | // CRibbonExampleApp message handlers 169 | 170 | 171 | // CAboutDlg dialog used for App About 172 | 173 | class CAboutDlg : public CDialogEx 174 | { 175 | public: 176 | CAboutDlg(); 177 | 178 | // Dialog Data 179 | #ifdef AFX_DESIGN_TIME 180 | enum { IDD = IDD_ABOUTBOX }; 181 | #endif 182 | 183 | protected: 184 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 185 | 186 | // Implementation 187 | protected: 188 | DECLARE_MESSAGE_MAP() 189 | }; 190 | 191 | CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) 192 | { 193 | } 194 | 195 | void CAboutDlg::DoDataExchange(CDataExchange* pDX) 196 | { 197 | CDialogEx::DoDataExchange(pDX); 198 | } 199 | 200 | BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) 201 | END_MESSAGE_MAP() 202 | 203 | // App command to run the dialog 204 | void CRibbonExampleApp::OnAppAbout() 205 | { 206 | CAboutDlg aboutDlg; 207 | aboutDlg.DoModal(); 208 | } 209 | 210 | // CRibbonExampleApp customization load/save methods 211 | 212 | void CRibbonExampleApp::PreLoadState() 213 | { 214 | BOOL bNameValid; 215 | CString strName; 216 | bNameValid = strName.LoadString(IDS_EDIT_MENU); 217 | ASSERT(bNameValid); 218 | GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT); 219 | bNameValid = strName.LoadString(IDS_EXPLORER); 220 | ASSERT(bNameValid); 221 | GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EXPLORER); 222 | } 223 | 224 | void CRibbonExampleApp::LoadCustomState() 225 | { 226 | } 227 | 228 | void CRibbonExampleApp::SaveCustomState() 229 | { 230 | } 231 | 232 | // CRibbonExampleApp message handlers 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /FileView.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #include "stdafx.h" 13 | #include "mainfrm.h" 14 | #include "FileView.h" 15 | #include "Resource.h" 16 | #include "RibbonExample.h" 17 | 18 | #ifdef _DEBUG 19 | #undef THIS_FILE 20 | static char THIS_FILE[]=__FILE__; 21 | #define new DEBUG_NEW 22 | #endif 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // CFileView 26 | 27 | CFileView::CFileView() 28 | { 29 | } 30 | 31 | CFileView::~CFileView() 32 | { 33 | } 34 | 35 | BEGIN_MESSAGE_MAP(CFileView, CDockablePane) 36 | ON_WM_CREATE() 37 | ON_WM_SIZE() 38 | ON_WM_CONTEXTMENU() 39 | ON_COMMAND(ID_PROPERTIES, OnProperties) 40 | ON_COMMAND(ID_OPEN, OnFileOpen) 41 | ON_COMMAND(ID_OPEN_WITH, OnFileOpenWith) 42 | ON_COMMAND(ID_DUMMY_COMPILE, OnDummyCompile) 43 | ON_COMMAND(ID_EDIT_CUT, OnEditCut) 44 | ON_COMMAND(ID_EDIT_COPY, OnEditCopy) 45 | ON_COMMAND(ID_EDIT_CLEAR, OnEditClear) 46 | ON_WM_PAINT() 47 | ON_WM_SETFOCUS() 48 | END_MESSAGE_MAP() 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // CWorkspaceBar message handlers 52 | 53 | int CFileView::OnCreate(LPCREATESTRUCT lpCreateStruct) 54 | { 55 | if (CDockablePane::OnCreate(lpCreateStruct) == -1) 56 | return -1; 57 | 58 | CRect rectDummy; 59 | rectDummy.SetRectEmpty(); 60 | 61 | // Create view: 62 | const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS; 63 | 64 | if (!m_wndFileView.Create(dwViewStyle, rectDummy, this, 4)) 65 | { 66 | TRACE0("Failed to create file view\n"); 67 | return -1; // fail to create 68 | } 69 | 70 | // Load view images: 71 | m_FileViewImages.Create(IDB_FILE_VIEW, 16, 0, RGB(255, 0, 255)); 72 | m_wndFileView.SetImageList(&m_FileViewImages, TVSIL_NORMAL); 73 | 74 | m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_EXPLORER); 75 | m_wndToolBar.LoadToolBar(IDR_EXPLORER, 0, 0, TRUE /* Is locked */); 76 | 77 | OnChangeVisualStyle(); 78 | 79 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); 80 | 81 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); 82 | 83 | m_wndToolBar.SetOwner(this); 84 | 85 | // All commands will be routed via this control , not via the parent frame: 86 | m_wndToolBar.SetRouteCommandsViaFrame(FALSE); 87 | 88 | // Fill in some static tree view data (dummy code, nothing magic here) 89 | FillFileView(); 90 | AdjustLayout(); 91 | 92 | return 0; 93 | } 94 | 95 | void CFileView::OnSize(UINT nType, int cx, int cy) 96 | { 97 | CDockablePane::OnSize(nType, cx, cy); 98 | AdjustLayout(); 99 | } 100 | 101 | void CFileView::FillFileView() 102 | { 103 | HTREEITEM hRoot = m_wndFileView.InsertItem(_T("FakeApp files"), 0, 0); 104 | m_wndFileView.SetItemState(hRoot, TVIS_BOLD, TVIS_BOLD); 105 | 106 | HTREEITEM hSrc = m_wndFileView.InsertItem(_T("FakeApp Source Files"), 0, 0, hRoot); 107 | 108 | m_wndFileView.InsertItem(_T("FakeApp.cpp"), 1, 1, hSrc); 109 | m_wndFileView.InsertItem(_T("FakeApp.rc"), 1, 1, hSrc); 110 | m_wndFileView.InsertItem(_T("FakeAppDoc.cpp"), 1, 1, hSrc); 111 | m_wndFileView.InsertItem(_T("FakeAppView.cpp"), 1, 1, hSrc); 112 | m_wndFileView.InsertItem(_T("MainFrm.cpp"), 1, 1, hSrc); 113 | m_wndFileView.InsertItem(_T("StdAfx.cpp"), 1, 1, hSrc); 114 | 115 | HTREEITEM hInc = m_wndFileView.InsertItem(_T("FakeApp Header Files"), 0, 0, hRoot); 116 | 117 | m_wndFileView.InsertItem(_T("FakeApp.h"), 2, 2, hInc); 118 | m_wndFileView.InsertItem(_T("FakeAppDoc.h"), 2, 2, hInc); 119 | m_wndFileView.InsertItem(_T("FakeAppView.h"), 2, 2, hInc); 120 | m_wndFileView.InsertItem(_T("Resource.h"), 2, 2, hInc); 121 | m_wndFileView.InsertItem(_T("MainFrm.h"), 2, 2, hInc); 122 | m_wndFileView.InsertItem(_T("StdAfx.h"), 2, 2, hInc); 123 | 124 | HTREEITEM hRes = m_wndFileView.InsertItem(_T("FakeApp Resource Files"), 0, 0, hRoot); 125 | 126 | m_wndFileView.InsertItem(_T("FakeApp.ico"), 2, 2, hRes); 127 | m_wndFileView.InsertItem(_T("FakeApp.rc2"), 2, 2, hRes); 128 | m_wndFileView.InsertItem(_T("FakeAppDoc.ico"), 2, 2, hRes); 129 | m_wndFileView.InsertItem(_T("FakeToolbar.bmp"), 2, 2, hRes); 130 | 131 | m_wndFileView.Expand(hRoot, TVE_EXPAND); 132 | m_wndFileView.Expand(hSrc, TVE_EXPAND); 133 | m_wndFileView.Expand(hInc, TVE_EXPAND); 134 | } 135 | 136 | void CFileView::OnContextMenu(CWnd* pWnd, CPoint point) 137 | { 138 | CTreeCtrl* pWndTree = (CTreeCtrl*) &m_wndFileView; 139 | ASSERT_VALID(pWndTree); 140 | 141 | if (pWnd != pWndTree) 142 | { 143 | CDockablePane::OnContextMenu(pWnd, point); 144 | return; 145 | } 146 | 147 | if (point != CPoint(-1, -1)) 148 | { 149 | // Select clicked item: 150 | CPoint ptTree = point; 151 | pWndTree->ScreenToClient(&ptTree); 152 | 153 | UINT flags = 0; 154 | HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags); 155 | if (hTreeItem != NULL) 156 | { 157 | pWndTree->SelectItem(hTreeItem); 158 | } 159 | } 160 | 161 | pWndTree->SetFocus(); 162 | theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EXPLORER, point.x, point.y, this, TRUE); 163 | } 164 | 165 | void CFileView::AdjustLayout() 166 | { 167 | if (GetSafeHwnd() == NULL) 168 | { 169 | return; 170 | } 171 | 172 | CRect rectClient; 173 | GetClientRect(rectClient); 174 | 175 | int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; 176 | 177 | m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER); 178 | m_wndFileView.SetWindowPos(NULL, rectClient.left + 1, rectClient.top + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER); 179 | } 180 | 181 | void CFileView::OnProperties() 182 | { 183 | AfxMessageBox(_T("Properties....")); 184 | 185 | } 186 | 187 | void CFileView::OnFileOpen() 188 | { 189 | // TODO: Add your command handler code here 190 | } 191 | 192 | void CFileView::OnFileOpenWith() 193 | { 194 | // TODO: Add your command handler code here 195 | } 196 | 197 | void CFileView::OnDummyCompile() 198 | { 199 | // TODO: Add your command handler code here 200 | } 201 | 202 | void CFileView::OnEditCut() 203 | { 204 | // TODO: Add your command handler code here 205 | } 206 | 207 | void CFileView::OnEditCopy() 208 | { 209 | // TODO: Add your command handler code here 210 | } 211 | 212 | void CFileView::OnEditClear() 213 | { 214 | // TODO: Add your command handler code here 215 | } 216 | 217 | void CFileView::OnPaint() 218 | { 219 | CPaintDC dc(this); // device context for painting 220 | 221 | CRect rectTree; 222 | m_wndFileView.GetWindowRect(rectTree); 223 | ScreenToClient(rectTree); 224 | 225 | rectTree.InflateRect(1, 1); 226 | dc.Draw3dRect(rectTree, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DSHADOW)); 227 | } 228 | 229 | void CFileView::OnSetFocus(CWnd* pOldWnd) 230 | { 231 | CDockablePane::OnSetFocus(pOldWnd); 232 | 233 | m_wndFileView.SetFocus(); 234 | } 235 | 236 | void CFileView::OnChangeVisualStyle() 237 | { 238 | m_wndToolBar.CleanUpLockedImages(); 239 | m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_EXPLORER_24 : IDR_EXPLORER, 0, 0, TRUE /* Locked */); 240 | 241 | m_FileViewImages.DeleteImageList(); 242 | 243 | UINT uiBmpId = theApp.m_bHiColorIcons ? IDB_FILE_VIEW_24 : IDB_FILE_VIEW; 244 | 245 | CBitmap bmp; 246 | if (!bmp.LoadBitmap(uiBmpId)) 247 | { 248 | TRACE(_T("Can't load bitmap: %x\n"), uiBmpId); 249 | ASSERT(FALSE); 250 | return; 251 | } 252 | 253 | BITMAP bmpObj; 254 | bmp.GetBitmap(&bmpObj); 255 | 256 | UINT nFlags = ILC_MASK; 257 | 258 | nFlags |= (theApp.m_bHiColorIcons) ? ILC_COLOR24 : ILC_COLOR4; 259 | 260 | m_FileViewImages.Create(16, bmpObj.bmHeight, nFlags, 0, 0); 261 | m_FileViewImages.Add(&bmp, RGB(255, 0, 255)); 262 | 263 | m_wndFileView.SetImageList(&m_FileViewImages, TVSIL_NORMAL); 264 | } 265 | 266 | 267 | -------------------------------------------------------------------------------- /PropertiesWnd.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #include "stdafx.h" 13 | 14 | #include "PropertiesWnd.h" 15 | #include "Resource.h" 16 | #include "MainFrm.h" 17 | #include "RibbonExample.h" 18 | 19 | #ifdef _DEBUG 20 | #undef THIS_FILE 21 | static char THIS_FILE[]=__FILE__; 22 | #define new DEBUG_NEW 23 | #endif 24 | 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // CResourceViewBar 27 | 28 | CPropertiesWnd::CPropertiesWnd() 29 | { 30 | m_nComboHeight = 0; 31 | } 32 | 33 | CPropertiesWnd::~CPropertiesWnd() 34 | { 35 | } 36 | 37 | BEGIN_MESSAGE_MAP(CPropertiesWnd, CDockablePane) 38 | ON_WM_CREATE() 39 | ON_WM_SIZE() 40 | ON_COMMAND(ID_EXPAND_ALL, OnExpandAllProperties) 41 | ON_UPDATE_COMMAND_UI(ID_EXPAND_ALL, OnUpdateExpandAllProperties) 42 | ON_COMMAND(ID_SORTPROPERTIES, OnSortProperties) 43 | ON_UPDATE_COMMAND_UI(ID_SORTPROPERTIES, OnUpdateSortProperties) 44 | ON_COMMAND(ID_PROPERTIES1, OnProperties1) 45 | ON_UPDATE_COMMAND_UI(ID_PROPERTIES1, OnUpdateProperties1) 46 | ON_COMMAND(ID_PROPERTIES2, OnProperties2) 47 | ON_UPDATE_COMMAND_UI(ID_PROPERTIES2, OnUpdateProperties2) 48 | ON_WM_SETFOCUS() 49 | ON_WM_SETTINGCHANGE() 50 | END_MESSAGE_MAP() 51 | 52 | ///////////////////////////////////////////////////////////////////////////// 53 | // CResourceViewBar message handlers 54 | 55 | void CPropertiesWnd::AdjustLayout() 56 | { 57 | if (GetSafeHwnd () == NULL || (AfxGetMainWnd() != NULL && AfxGetMainWnd()->IsIconic())) 58 | { 59 | return; 60 | } 61 | 62 | CRect rectClient; 63 | GetClientRect(rectClient); 64 | 65 | int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; 66 | 67 | m_wndObjectCombo.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), m_nComboHeight, SWP_NOACTIVATE | SWP_NOZORDER); 68 | m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top + m_nComboHeight, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER); 69 | m_wndPropList.SetWindowPos(NULL, rectClient.left, rectClient.top + m_nComboHeight + cyTlb, rectClient.Width(), rectClient.Height() -(m_nComboHeight+cyTlb), SWP_NOACTIVATE | SWP_NOZORDER); 70 | } 71 | 72 | int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 73 | { 74 | if (CDockablePane::OnCreate(lpCreateStruct) == -1) 75 | return -1; 76 | 77 | CRect rectDummy; 78 | rectDummy.SetRectEmpty(); 79 | 80 | // Create combo: 81 | const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; 82 | 83 | if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, 1)) 84 | { 85 | TRACE0("Failed to create Properties Combo \n"); 86 | return -1; // fail to create 87 | } 88 | 89 | m_wndObjectCombo.AddString(_T("Application")); 90 | m_wndObjectCombo.AddString(_T("Properties Window")); 91 | m_wndObjectCombo.SetCurSel(0); 92 | 93 | CRect rectCombo; 94 | m_wndObjectCombo.GetClientRect (&rectCombo); 95 | 96 | m_nComboHeight = rectCombo.Height(); 97 | 98 | if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2)) 99 | { 100 | TRACE0("Failed to create Properties Grid \n"); 101 | return -1; // fail to create 102 | } 103 | 104 | InitPropList(); 105 | 106 | m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES); 107 | m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* Is locked */); 108 | m_wndToolBar.CleanUpLockedImages(); 109 | m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* Locked */); 110 | 111 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); 112 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); 113 | m_wndToolBar.SetOwner(this); 114 | 115 | // All commands will be routed via this control , not via the parent frame: 116 | m_wndToolBar.SetRouteCommandsViaFrame(FALSE); 117 | 118 | AdjustLayout(); 119 | return 0; 120 | } 121 | 122 | void CPropertiesWnd::OnSize(UINT nType, int cx, int cy) 123 | { 124 | CDockablePane::OnSize(nType, cx, cy); 125 | AdjustLayout(); 126 | } 127 | 128 | void CPropertiesWnd::OnExpandAllProperties() 129 | { 130 | m_wndPropList.ExpandAll(); 131 | } 132 | 133 | void CPropertiesWnd::OnUpdateExpandAllProperties(CCmdUI* /* pCmdUI */) 134 | { 135 | } 136 | 137 | void CPropertiesWnd::OnSortProperties() 138 | { 139 | m_wndPropList.SetAlphabeticMode(!m_wndPropList.IsAlphabeticMode()); 140 | } 141 | 142 | void CPropertiesWnd::OnUpdateSortProperties(CCmdUI* pCmdUI) 143 | { 144 | pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode()); 145 | } 146 | 147 | void CPropertiesWnd::OnProperties1() 148 | { 149 | // TODO: Add your command handler code here 150 | } 151 | 152 | void CPropertiesWnd::OnUpdateProperties1(CCmdUI* /*pCmdUI*/) 153 | { 154 | // TODO: Add your command update UI handler code here 155 | } 156 | 157 | void CPropertiesWnd::OnProperties2() 158 | { 159 | // TODO: Add your command handler code here 160 | } 161 | 162 | void CPropertiesWnd::OnUpdateProperties2(CCmdUI* /*pCmdUI*/) 163 | { 164 | // TODO: Add your command update UI handler code here 165 | } 166 | 167 | void CPropertiesWnd::InitPropList() 168 | { 169 | SetPropListFont(); 170 | 171 | m_wndPropList.EnableHeaderCtrl(FALSE); 172 | m_wndPropList.EnableDescriptionArea(); 173 | m_wndPropList.SetVSDotNetLook(); 174 | m_wndPropList.MarkModifiedProperties(); 175 | 176 | CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance")); 177 | 178 | pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), (_variant_t) false, _T("Specifies the window's font will be non-bold and controls will have a 3D border"))); 179 | 180 | CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"), _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame")); 181 | pProp->AddOption(_T("None")); 182 | pProp->AddOption(_T("Thin")); 183 | pProp->AddOption(_T("Resizable")); 184 | pProp->AddOption(_T("Dialog Frame")); 185 | pProp->AllowEdit(FALSE); 186 | 187 | pGroup1->AddSubItem(pProp); 188 | pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (_variant_t) _T("About"), _T("Specifies the text that will be displayed in the window's title bar"))); 189 | 190 | m_wndPropList.AddProperty(pGroup1); 191 | 192 | CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Window Size"), 0, TRUE); 193 | 194 | pProp = new CMFCPropertyGridProperty(_T("Height"), (_variant_t) 250l, _T("Specifies the window's height")); 195 | pProp->EnableSpinControl(TRUE, 50, 300); 196 | pSize->AddSubItem(pProp); 197 | 198 | pProp = new CMFCPropertyGridProperty( _T("Width"), (_variant_t) 150l, _T("Specifies the window's width")); 199 | pProp->EnableSpinControl(TRUE, 50, 200); 200 | pSize->AddSubItem(pProp); 201 | 202 | m_wndPropList.AddProperty(pSize); 203 | 204 | CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("Font")); 205 | 206 | LOGFONT lf; 207 | CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); 208 | font->GetLogFont(&lf); 209 | 210 | _tcscpy_s(lf.lfFaceName, _T("Arial")); 211 | 212 | pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("Font"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the window"))); 213 | pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("Use System Font"), (_variant_t) true, _T("Specifies that the window uses MS Shell Dlg font"))); 214 | 215 | m_wndPropList.AddProperty(pGroup2); 216 | 217 | CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("Misc")); 218 | pProp = new CMFCPropertyGridProperty(_T("(Name)"), _T("Application")); 219 | pProp->Enable(FALSE); 220 | pGroup3->AddSubItem(pProp); 221 | 222 | CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default window color")); 223 | pColorProp->EnableOtherButton(_T("Other...")); 224 | pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE)); 225 | pGroup3->AddSubItem(pColorProp); 226 | 227 | static const TCHAR szFilter[] = _T("Icon Files(*.ico)|*.ico|All Files(*.*)|*.*||"); 228 | pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Icon"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("Specifies the window icon"))); 229 | 230 | pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Folder"), _T("c:\\"))); 231 | 232 | m_wndPropList.AddProperty(pGroup3); 233 | 234 | CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("Hierarchy")); 235 | 236 | CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("First sub-level")); 237 | pGroup4->AddSubItem(pGroup41); 238 | 239 | CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Second sub-level")); 240 | pGroup41->AddSubItem(pGroup411); 241 | 242 | pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 1"), (_variant_t) _T("Value 1"), _T("This is a description"))); 243 | pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 2"), (_variant_t) _T("Value 2"), _T("This is a description"))); 244 | pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 3"), (_variant_t) _T("Value 3"), _T("This is a description"))); 245 | 246 | pGroup4->Expand(FALSE); 247 | m_wndPropList.AddProperty(pGroup4); 248 | } 249 | 250 | void CPropertiesWnd::OnSetFocus(CWnd* pOldWnd) 251 | { 252 | CDockablePane::OnSetFocus(pOldWnd); 253 | m_wndPropList.SetFocus(); 254 | } 255 | 256 | void CPropertiesWnd::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) 257 | { 258 | CDockablePane::OnSettingChange(uFlags, lpszSection); 259 | SetPropListFont(); 260 | } 261 | 262 | void CPropertiesWnd::SetPropListFont() 263 | { 264 | ::DeleteObject(m_fntPropList.Detach()); 265 | 266 | LOGFONT lf; 267 | afxGlobalData.fontRegular.GetLogFont(&lf); 268 | 269 | NONCLIENTMETRICS info; 270 | info.cbSize = sizeof(info); 271 | 272 | afxGlobalData.GetNonClientMetrics(info); 273 | 274 | lf.lfHeight = info.lfMenuFont.lfHeight; 275 | lf.lfWeight = info.lfMenuFont.lfWeight; 276 | lf.lfItalic = info.lfMenuFont.lfItalic; 277 | 278 | m_fntPropList.CreateFontIndirect(&lf); 279 | 280 | m_wndPropList.SetFont(&m_fntPropList); 281 | m_wndObjectCombo.SetFont(&m_fntPropList); 282 | } 283 | -------------------------------------------------------------------------------- /ClassView.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #include "stdafx.h" 13 | #include "MainFrm.h" 14 | #include "ClassView.h" 15 | #include "Resource.h" 16 | #include "RibbonExample.h" 17 | 18 | class CClassViewMenuButton : public CMFCToolBarMenuButton 19 | { 20 | friend class CClassView; 21 | 22 | DECLARE_SERIAL(CClassViewMenuButton) 23 | 24 | public: 25 | CClassViewMenuButton(HMENU hMenu = NULL) : CMFCToolBarMenuButton((UINT)-1, hMenu, -1) 26 | { 27 | } 28 | 29 | virtual void OnDraw(CDC* pDC, const CRect& rect, CMFCToolBarImages* pImages, BOOL bHorz = TRUE, 30 | BOOL bCustomizeMode = FALSE, BOOL bHighlight = FALSE, BOOL bDrawBorder = TRUE, BOOL bGrayDisabledButtons = TRUE) 31 | { 32 | pImages = CMFCToolBar::GetImages(); 33 | 34 | CAfxDrawState ds; 35 | pImages->PrepareDrawImage(ds); 36 | 37 | CMFCToolBarMenuButton::OnDraw(pDC, rect, pImages, bHorz, bCustomizeMode, bHighlight, bDrawBorder, bGrayDisabledButtons); 38 | 39 | pImages->EndDrawImage(ds); 40 | } 41 | }; 42 | 43 | IMPLEMENT_SERIAL(CClassViewMenuButton, CMFCToolBarMenuButton, 1) 44 | 45 | ////////////////////////////////////////////////////////////////////// 46 | // Construction/Destruction 47 | ////////////////////////////////////////////////////////////////////// 48 | 49 | CClassView::CClassView() 50 | { 51 | m_nCurrSort = ID_SORTING_GROUPBYTYPE; 52 | } 53 | 54 | CClassView::~CClassView() 55 | { 56 | } 57 | 58 | BEGIN_MESSAGE_MAP(CClassView, CDockablePane) 59 | ON_WM_CREATE() 60 | ON_WM_SIZE() 61 | ON_WM_CONTEXTMENU() 62 | ON_COMMAND(ID_CLASS_ADD_MEMBER_FUNCTION, OnClassAddMemberFunction) 63 | ON_COMMAND(ID_CLASS_ADD_MEMBER_VARIABLE, OnClassAddMemberVariable) 64 | ON_COMMAND(ID_CLASS_DEFINITION, OnClassDefinition) 65 | ON_COMMAND(ID_CLASS_PROPERTIES, OnClassProperties) 66 | ON_COMMAND(ID_NEW_FOLDER, OnNewFolder) 67 | ON_WM_PAINT() 68 | ON_WM_SETFOCUS() 69 | ON_COMMAND_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnSort) 70 | ON_UPDATE_COMMAND_UI_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnUpdateSort) 71 | END_MESSAGE_MAP() 72 | 73 | ///////////////////////////////////////////////////////////////////////////// 74 | // CClassView message handlers 75 | 76 | int CClassView::OnCreate(LPCREATESTRUCT lpCreateStruct) 77 | { 78 | if (CDockablePane::OnCreate(lpCreateStruct) == -1) 79 | return -1; 80 | 81 | CRect rectDummy; 82 | rectDummy.SetRectEmpty(); 83 | 84 | // Create views: 85 | const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; 86 | 87 | if (!m_wndClassView.Create(dwViewStyle, rectDummy, this, 2)) 88 | { 89 | TRACE0("Failed to create Class View\n"); 90 | return -1; // fail to create 91 | } 92 | 93 | // Load images: 94 | m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_SORT); 95 | m_wndToolBar.LoadToolBar(IDR_SORT, 0, 0, TRUE /* Is locked */); 96 | 97 | OnChangeVisualStyle(); 98 | 99 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); 100 | m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); 101 | 102 | m_wndToolBar.SetOwner(this); 103 | 104 | // All commands will be routed via this control , not via the parent frame: 105 | m_wndToolBar.SetRouteCommandsViaFrame(FALSE); 106 | 107 | CMenu menuSort; 108 | menuSort.LoadMenu(IDR_POPUP_SORT); 109 | 110 | m_wndToolBar.ReplaceButton(ID_SORT_MENU, CClassViewMenuButton(menuSort.GetSubMenu(0)->GetSafeHmenu())); 111 | 112 | CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0)); 113 | 114 | if (pButton != NULL) 115 | { 116 | pButton->m_bText = FALSE; 117 | pButton->m_bImage = TRUE; 118 | pButton->SetImage(GetCmdMgr()->GetCmdImage(m_nCurrSort)); 119 | pButton->SetMessageWnd(this); 120 | } 121 | 122 | // Fill in some static tree view data (dummy code, nothing magic here) 123 | FillClassView(); 124 | 125 | return 0; 126 | } 127 | 128 | void CClassView::OnSize(UINT nType, int cx, int cy) 129 | { 130 | CDockablePane::OnSize(nType, cx, cy); 131 | AdjustLayout(); 132 | } 133 | 134 | void CClassView::FillClassView() 135 | { 136 | HTREEITEM hRoot = m_wndClassView.InsertItem(_T("FakeApp classes"), 0, 0); 137 | m_wndClassView.SetItemState(hRoot, TVIS_BOLD, TVIS_BOLD); 138 | 139 | HTREEITEM hClass = m_wndClassView.InsertItem(_T("CFakeAboutDlg"), 1, 1, hRoot); 140 | m_wndClassView.InsertItem(_T("CFakeAboutDlg()"), 3, 3, hClass); 141 | 142 | m_wndClassView.Expand(hRoot, TVE_EXPAND); 143 | 144 | hClass = m_wndClassView.InsertItem(_T("CFakeApp"), 1, 1, hRoot); 145 | m_wndClassView.InsertItem(_T("CFakeApp()"), 3, 3, hClass); 146 | m_wndClassView.InsertItem(_T("InitInstance()"), 3, 3, hClass); 147 | m_wndClassView.InsertItem(_T("OnAppAbout()"), 3, 3, hClass); 148 | 149 | hClass = m_wndClassView.InsertItem(_T("CFakeAppDoc"), 1, 1, hRoot); 150 | m_wndClassView.InsertItem(_T("CFakeAppDoc()"), 4, 4, hClass); 151 | m_wndClassView.InsertItem(_T("~CFakeAppDoc()"), 3, 3, hClass); 152 | m_wndClassView.InsertItem(_T("OnNewDocument()"), 3, 3, hClass); 153 | 154 | hClass = m_wndClassView.InsertItem(_T("CFakeAppView"), 1, 1, hRoot); 155 | m_wndClassView.InsertItem(_T("CFakeAppView()"), 4, 4, hClass); 156 | m_wndClassView.InsertItem(_T("~CFakeAppView()"), 3, 3, hClass); 157 | m_wndClassView.InsertItem(_T("GetDocument()"), 3, 3, hClass); 158 | m_wndClassView.Expand(hClass, TVE_EXPAND); 159 | 160 | hClass = m_wndClassView.InsertItem(_T("CFakeAppFrame"), 1, 1, hRoot); 161 | m_wndClassView.InsertItem(_T("CFakeAppFrame()"), 3, 3, hClass); 162 | m_wndClassView.InsertItem(_T("~CFakeAppFrame()"), 3, 3, hClass); 163 | m_wndClassView.InsertItem(_T("m_wndMenuBar"), 6, 6, hClass); 164 | m_wndClassView.InsertItem(_T("m_wndToolBar"), 6, 6, hClass); 165 | m_wndClassView.InsertItem(_T("m_wndStatusBar"), 6, 6, hClass); 166 | 167 | hClass = m_wndClassView.InsertItem(_T("Globals"), 2, 2, hRoot); 168 | m_wndClassView.InsertItem(_T("theFakeApp"), 5, 5, hClass); 169 | m_wndClassView.Expand(hClass, TVE_EXPAND); 170 | } 171 | 172 | void CClassView::OnContextMenu(CWnd* pWnd, CPoint point) 173 | { 174 | CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndClassView; 175 | ASSERT_VALID(pWndTree); 176 | 177 | if (pWnd != pWndTree) 178 | { 179 | CDockablePane::OnContextMenu(pWnd, point); 180 | return; 181 | } 182 | 183 | if (point != CPoint(-1, -1)) 184 | { 185 | // Select clicked item: 186 | CPoint ptTree = point; 187 | pWndTree->ScreenToClient(&ptTree); 188 | 189 | UINT flags = 0; 190 | HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags); 191 | if (hTreeItem != NULL) 192 | { 193 | pWndTree->SelectItem(hTreeItem); 194 | } 195 | } 196 | 197 | pWndTree->SetFocus(); 198 | CMenu menu; 199 | menu.LoadMenu(IDR_POPUP_SORT); 200 | 201 | CMenu* pSumMenu = menu.GetSubMenu(0); 202 | 203 | if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx))) 204 | { 205 | CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu; 206 | 207 | if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE)) 208 | return; 209 | 210 | ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu); 211 | UpdateDialogControls(this, FALSE); 212 | } 213 | } 214 | 215 | void CClassView::AdjustLayout() 216 | { 217 | if (GetSafeHwnd() == NULL) 218 | { 219 | return; 220 | } 221 | 222 | CRect rectClient; 223 | GetClientRect(rectClient); 224 | 225 | int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; 226 | 227 | m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER); 228 | m_wndClassView.SetWindowPos(NULL, rectClient.left + 1, rectClient.top + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER); 229 | } 230 | 231 | BOOL CClassView::PreTranslateMessage(MSG* pMsg) 232 | { 233 | return CDockablePane::PreTranslateMessage(pMsg); 234 | } 235 | 236 | void CClassView::OnSort(UINT id) 237 | { 238 | if (m_nCurrSort == id) 239 | { 240 | return; 241 | } 242 | 243 | m_nCurrSort = id; 244 | 245 | CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0)); 246 | 247 | if (pButton != NULL) 248 | { 249 | pButton->SetImage(GetCmdMgr()->GetCmdImage(id)); 250 | m_wndToolBar.Invalidate(); 251 | m_wndToolBar.UpdateWindow(); 252 | } 253 | } 254 | 255 | void CClassView::OnUpdateSort(CCmdUI* pCmdUI) 256 | { 257 | pCmdUI->SetCheck(pCmdUI->m_nID == m_nCurrSort); 258 | } 259 | 260 | void CClassView::OnClassAddMemberFunction() 261 | { 262 | AfxMessageBox(_T("Add member function...")); 263 | } 264 | 265 | void CClassView::OnClassAddMemberVariable() 266 | { 267 | // TODO: Add your command handler code here 268 | } 269 | 270 | void CClassView::OnClassDefinition() 271 | { 272 | // TODO: Add your command handler code here 273 | } 274 | 275 | void CClassView::OnClassProperties() 276 | { 277 | // TODO: Add your command handler code here 278 | } 279 | 280 | void CClassView::OnNewFolder() 281 | { 282 | AfxMessageBox(_T("New Folder...")); 283 | } 284 | 285 | void CClassView::OnPaint() 286 | { 287 | CPaintDC dc(this); // device context for painting 288 | 289 | CRect rectTree; 290 | m_wndClassView.GetWindowRect(rectTree); 291 | ScreenToClient(rectTree); 292 | 293 | rectTree.InflateRect(1, 1); 294 | dc.Draw3dRect(rectTree, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DSHADOW)); 295 | } 296 | 297 | void CClassView::OnSetFocus(CWnd* pOldWnd) 298 | { 299 | CDockablePane::OnSetFocus(pOldWnd); 300 | 301 | m_wndClassView.SetFocus(); 302 | } 303 | 304 | void CClassView::OnChangeVisualStyle() 305 | { 306 | m_ClassViewImages.DeleteImageList(); 307 | 308 | UINT uiBmpId = theApp.m_bHiColorIcons ? IDB_CLASS_VIEW_24 : IDB_CLASS_VIEW; 309 | 310 | CBitmap bmp; 311 | if (!bmp.LoadBitmap(uiBmpId)) 312 | { 313 | TRACE(_T("Can't load bitmap: %x\n"), uiBmpId); 314 | ASSERT(FALSE); 315 | return; 316 | } 317 | 318 | BITMAP bmpObj; 319 | bmp.GetBitmap(&bmpObj); 320 | 321 | UINT nFlags = ILC_MASK; 322 | 323 | nFlags |= (theApp.m_bHiColorIcons) ? ILC_COLOR24 : ILC_COLOR4; 324 | 325 | m_ClassViewImages.Create(16, bmpObj.bmHeight, nFlags, 0, 0); 326 | m_ClassViewImages.Add(&bmp, RGB(255, 0, 0)); 327 | 328 | m_wndClassView.SetImageList(&m_ClassViewImages, TVSIL_NORMAL); 329 | 330 | m_wndToolBar.CleanUpLockedImages(); 331 | m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_SORT_24 : IDR_SORT, 0, 0, TRUE /* Locked */); 332 | } 333 | -------------------------------------------------------------------------------- /MainFrm.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // MainFrm.cpp : implementation of the CMainFrame class 13 | // 14 | 15 | #include "stdafx.h" 16 | #include "RibbonExample.h" 17 | 18 | #include "MainFrm.h" 19 | #include "Windows10Style.h" 20 | #include "RainbowStyle.h" 21 | 22 | #ifdef _DEBUG 23 | #define new DEBUG_NEW 24 | #endif 25 | 26 | // CMainFrame 27 | 28 | IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx) 29 | 30 | BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx) 31 | ON_WM_CREATE() 32 | ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager) 33 | ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_RAINBOW, &CMainFrame::OnApplicationLook) 34 | ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_RAINBOW, &CMainFrame::OnUpdateApplicationLook) 35 | //ON_WM_NCPAINT() 36 | ON_WM_SETTINGCHANGE() 37 | END_MESSAGE_MAP() 38 | 39 | // CMainFrame construction/destruction 40 | 41 | CMainFrame::CMainFrame() 42 | { 43 | // TODO: add member initialization code here 44 | theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2008); 45 | } 46 | 47 | CMainFrame::~CMainFrame() 48 | { 49 | } 50 | 51 | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 52 | { 53 | if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) 54 | return -1; 55 | 56 | BOOL bNameValid; 57 | 58 | CMDITabInfo mdiTabParams; 59 | mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... 60 | mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area 61 | mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba 62 | mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs 63 | mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area 64 | EnableMDITabbedGroups(TRUE, mdiTabParams); 65 | 66 | m_wndRibbonBar.Create(this); 67 | m_wndRibbonBar.LoadFromResource(IDR_RIBBON); 68 | 69 | if (!m_wndStatusBar.Create(this)) 70 | { 71 | TRACE0("Failed to create status bar\n"); 72 | return -1; // fail to create 73 | } 74 | 75 | CString strTitlePane1; 76 | CString strTitlePane2; 77 | bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); 78 | ASSERT(bNameValid); 79 | bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); 80 | ASSERT(bNameValid); 81 | m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); 82 | m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); 83 | 84 | // enable Visual Studio 2005 style docking window behavior 85 | CDockingManager::SetDockingMode(DT_SMART); 86 | // enable Visual Studio 2005 style docking window auto-hide behavior 87 | EnableAutoHidePanes(CBRS_ALIGN_ANY); 88 | 89 | // Load menu item image (not placed on any standard toolbars): 90 | CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); 91 | 92 | // create docking windows 93 | if (!CreateDockingWindows()) 94 | { 95 | TRACE0("Failed to create docking windows\n"); 96 | return -1; 97 | } 98 | 99 | m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); 100 | m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); 101 | DockPane(&m_wndFileView); 102 | CDockablePane* pTabbedBar = NULL; 103 | m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); 104 | m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); 105 | DockPane(&m_wndOutput); 106 | m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); 107 | DockPane(&m_wndProperties); 108 | 109 | // set the visual manager and style based on persisted value 110 | OnApplicationLook(theApp.m_nAppLook); 111 | 112 | // Enable enhanced windows management dialog 113 | EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); 114 | 115 | // Switch the order of document name and application name on the window title bar. This 116 | // improves the usability of the taskbar because the document name is visible with the thumbnail. 117 | ModifyStyle(0, FWS_PREFIXTITLE); 118 | 119 | return 0; 120 | } 121 | 122 | BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 123 | { 124 | if( !CMDIFrameWndEx::PreCreateWindow(cs) ) 125 | return FALSE; 126 | // TODO: Modify the Window class or styles here by modifying 127 | // the CREATESTRUCT cs 128 | 129 | return TRUE; 130 | } 131 | 132 | BOOL CMainFrame::CreateDockingWindows() 133 | { 134 | BOOL bNameValid; 135 | 136 | // Create class view 137 | CString strClassView; 138 | bNameValid = strClassView.LoadString(IDS_CLASS_VIEW); 139 | ASSERT(bNameValid); 140 | if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) 141 | { 142 | TRACE0("Failed to create Class View window\n"); 143 | return FALSE; // failed to create 144 | } 145 | 146 | // Create file view 147 | CString strFileView; 148 | bNameValid = strFileView.LoadString(IDS_FILE_VIEW); 149 | ASSERT(bNameValid); 150 | if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI)) 151 | { 152 | TRACE0("Failed to create File View window\n"); 153 | return FALSE; // failed to create 154 | } 155 | 156 | // Create output window 157 | CString strOutputWnd; 158 | bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND); 159 | ASSERT(bNameValid); 160 | if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) 161 | { 162 | TRACE0("Failed to create Output window\n"); 163 | return FALSE; // failed to create 164 | } 165 | 166 | // Create properties window 167 | CString strPropertiesWnd; 168 | bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND); 169 | ASSERT(bNameValid); 170 | if (!m_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIESWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) 171 | { 172 | TRACE0("Failed to create Properties window\n"); 173 | return FALSE; // failed to create 174 | } 175 | 176 | SetDockingWindowIcons(theApp.m_bHiColorIcons); 177 | return TRUE; 178 | } 179 | 180 | void CMainFrame::SetDockingWindowIcons(BOOL bHiColorIcons) 181 | { 182 | HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); 183 | m_wndFileView.SetIcon(hFileViewIcon, FALSE); 184 | 185 | HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); 186 | m_wndClassView.SetIcon(hClassViewIcon, FALSE); 187 | 188 | HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); 189 | m_wndOutput.SetIcon(hOutputBarIcon, FALSE); 190 | 191 | HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0); 192 | m_wndProperties.SetIcon(hPropertiesBarIcon, FALSE); 193 | 194 | UpdateMDITabbedBarsIcons(); 195 | } 196 | 197 | // CMainFrame diagnostics 198 | 199 | #ifdef _DEBUG 200 | void CMainFrame::AssertValid() const 201 | { 202 | CMDIFrameWndEx::AssertValid(); 203 | } 204 | 205 | void CMainFrame::Dump(CDumpContext& dc) const 206 | { 207 | CMDIFrameWndEx::Dump(dc); 208 | } 209 | #endif //_DEBUG 210 | 211 | 212 | // CMainFrame message handlers 213 | 214 | void CMainFrame::OnWindowManager() 215 | { 216 | ShowWindowsDialog(); 217 | } 218 | 219 | void CMainFrame::OnApplicationLook(UINT id) 220 | { 221 | CWaitCursor wait; 222 | 223 | theApp.m_nAppLook = id; 224 | 225 | switch (theApp.m_nAppLook) 226 | { 227 | case ID_VIEW_APPLOOK_WIN_2000: 228 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager)); 229 | m_wndRibbonBar.SetWindows7Look(FALSE); 230 | break; 231 | 232 | case ID_VIEW_APPLOOK_OFF_XP: 233 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP)); 234 | m_wndRibbonBar.SetWindows7Look(FALSE); 235 | break; 236 | 237 | case ID_VIEW_APPLOOK_WIN_XP: 238 | CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE; 239 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); 240 | m_wndRibbonBar.SetWindows7Look(FALSE); 241 | break; 242 | 243 | case ID_VIEW_APPLOOK_OFF_2003: 244 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003)); 245 | CDockingManager::SetDockingMode(DT_SMART); 246 | m_wndRibbonBar.SetWindows7Look(FALSE); 247 | break; 248 | 249 | case ID_VIEW_APPLOOK_VS_2005: 250 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005)); 251 | CDockingManager::SetDockingMode(DT_SMART); 252 | m_wndRibbonBar.SetWindows7Look(FALSE); 253 | break; 254 | 255 | case ID_VIEW_APPLOOK_VS_2008: 256 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008)); 257 | CDockingManager::SetDockingMode(DT_SMART); 258 | m_wndRibbonBar.SetWindows7Look(FALSE); 259 | break; 260 | 261 | case ID_VIEW_APPLOOK_WINDOWS_10: { 262 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CWindows10Style)); 263 | CDockingManager::SetDockingMode(DT_SMART); 264 | m_wndRibbonBar.SetWindows7Look(TRUE); 265 | CSize sizeOfMainButton(56, 45); 266 | m_wndRibbonBar.SetApplicationButton(&m_MainButton, sizeOfMainButton); 267 | } break; 268 | 269 | case ID_VIEW_APPLOOK_RAINBOW: { 270 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CRainbowStyle)); 271 | CDockingManager::SetDockingMode(DT_SMART); 272 | m_wndRibbonBar.SetWindows7Look(TRUE); 273 | CSize sizeOfMainButton(56, 45); 274 | m_wndRibbonBar.SetApplicationButton(&m_MainButton, sizeOfMainButton); 275 | } break; 276 | 277 | case ID_VIEW_APPLOOK_WINDOWS_7: 278 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7)); 279 | CDockingManager::SetDockingMode(DT_SMART); 280 | m_wndRibbonBar.SetWindows7Look(TRUE); 281 | break; 282 | 283 | default: 284 | switch (theApp.m_nAppLook) 285 | { 286 | case ID_VIEW_APPLOOK_OFF_2007_BLUE: 287 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); 288 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue); 289 | break; 290 | 291 | case ID_VIEW_APPLOOK_OFF_2007_BLACK: 292 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); 293 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); 294 | break; 295 | 296 | case ID_VIEW_APPLOOK_OFF_2007_SILVER: 297 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); 298 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); 299 | break; 300 | 301 | case ID_VIEW_APPLOOK_OFF_2007_AQUA: 302 | CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); 303 | CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua); 304 | break; 305 | } 306 | } 307 | CDockingManager::SetDockingMode(DT_SMART); 308 | 309 | m_wndOutput.UpdateFonts(); 310 | RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); 311 | 312 | theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook); 313 | } 314 | 315 | void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI) 316 | { 317 | pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID); 318 | } 319 | 320 | 321 | void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) 322 | { 323 | CMDIFrameWndEx::OnSettingChange(uFlags, lpszSection); 324 | m_wndOutput.UpdateFonts(); 325 | } 326 | -------------------------------------------------------------------------------- /RibbonExample.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {562F06A9-535A-4CB4-95A9-A4935E02E696} 23 | RibbonExample 24 | 8.1 25 | MFCProj 26 | 27 | 28 | 29 | Application 30 | true 31 | v140 32 | Unicode 33 | Dynamic 34 | 35 | 36 | Application 37 | false 38 | v140 39 | true 40 | Unicode 41 | Dynamic 42 | 43 | 44 | Application 45 | true 46 | v140 47 | Unicode 48 | Dynamic 49 | 50 | 51 | Application 52 | false 53 | v140 54 | true 55 | Unicode 56 | Dynamic 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | true 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | false 87 | 88 | 89 | 90 | Use 91 | Level4 92 | Disabled 93 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 94 | true 95 | 96 | 97 | Windows 98 | 99 | 100 | false 101 | true 102 | _DEBUG;%(PreprocessorDefinitions) 103 | 104 | 105 | 0x0409 106 | _DEBUG;%(PreprocessorDefinitions) 107 | $(IntDir);%(AdditionalIncludeDirectories) 108 | 109 | 110 | 111 | 112 | Use 113 | Level3 114 | Disabled 115 | _WINDOWS;_DEBUG;%(PreprocessorDefinitions) 116 | true 117 | 118 | 119 | Windows 120 | 121 | 122 | false 123 | true 124 | _DEBUG;%(PreprocessorDefinitions) 125 | 126 | 127 | 0x0409 128 | _DEBUG;%(PreprocessorDefinitions) 129 | $(IntDir);%(AdditionalIncludeDirectories) 130 | 131 | 132 | 133 | 134 | Level3 135 | Use 136 | MaxSpeed 137 | true 138 | true 139 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 140 | true 141 | 142 | 143 | Windows 144 | true 145 | true 146 | 147 | 148 | false 149 | true 150 | NDEBUG;%(PreprocessorDefinitions) 151 | 152 | 153 | 0x0409 154 | NDEBUG;%(PreprocessorDefinitions) 155 | $(IntDir);%(AdditionalIncludeDirectories) 156 | 157 | 158 | 159 | 160 | Level3 161 | Use 162 | MaxSpeed 163 | true 164 | true 165 | _WINDOWS;NDEBUG;%(PreprocessorDefinitions) 166 | true 167 | 168 | 169 | Windows 170 | true 171 | true 172 | 173 | 174 | false 175 | true 176 | NDEBUG;%(PreprocessorDefinitions) 177 | 178 | 179 | 0x0409 180 | NDEBUG;%(PreprocessorDefinitions) 181 | $(IntDir);%(AdditionalIncludeDirectories) 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | Create 214 | Create 215 | Create 216 | Create 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | -------------------------------------------------------------------------------- /res/ribbon.mfcribbon-ms: -------------------------------------------------------------------------------- 1 |
1
RibbonBarTRUETRUETRUETRUEFALSEIDB_BUTTONS113Button_MainFFALSEFALSE-1-1TRUEIDB_MAIN112Category_MainFileIDB_FILESMALL115IDB_FILELARGE114ButtonID_FILE_NEW57600&NewFALSEFALSE00TRUEFALSEButtonID_FILE_OPEN57601&Open...FALSEFALSE11TRUEFALSEButtonID_FILE_SAVE57603&SaveFALSEFALSE22TRUEFALSEButtonID_FILE_SAVE_AS57604Save &As...FALSEFALSE33TRUEFALSEButtonID_FILE_PRINT57607PrintPWFALSEFALSE44TRUEFALSELabelPreview and print the documentFALSEFALSE-1-1TRUEButtonID_FILE_PRINT_DIRECT57608&Quick PrintFALSEFALSE55TRUETRUEButtonID_FILE_PRINT_PREVIEW57609Print Pre&viewFALSEFALSE66TRUETRUEButtonID_FILE_PRINT_SETUP57606Print Set&upFALSEFALSE77TRUETRUEButtonID_BUTTON232771Change folder and search optionsFALSEFALSE55FALSEFALSESeparatorTRUEButtonID_FILE_CLOSE57602&CloseFALSEFALSE88TRUEFALSEButtonID_APP_EXIT57665ExitFALSEFALSE99FALSEFALSEButton_Main_PanelID_BUTTON332772FALSEFALSE-1-1FALSETRUE300QATTRUEID_FILE_NEW57600TRUEID_FILE_OPEN57601TRUEID_FILE_SAVE57603TRUEID_FILE_PRINT_DIRECT57608TRUEGroupButtonStyleSFALSEFALSE-1-1FALSEFALSEButtonID_VIEW_APPLOOK_OFF_2007_BLUE215Office 2007 (&Blue Style)FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_OFF_2007_BLACK216Office 2007 (B&lack Style)FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_OFF_2007_SILVER217Office 2007 (&Silver Style)FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_OFF_2007_AQUA218Office 2007 (&Aqua Style)FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_WINDOWS_7219Win&dows 7FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_WINDOWS_10220Windows 10FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_OFFICE2016221Office 2016FALSEFALSE-1-1TRUEFALSEButtonID_VIEW_APPLOOK_RAINBOW222RainbowFALSEFALSE-1-1TRUEFALSEButtonID_APP_ABOUT57664AFALSEFALSE0-1TRUEFALSECategoryHomeHIDB_WRITESMALL110IDB_WRITELARGE111PanelClipboardD1FALSEFALSEButtonID_EDIT_PASTE57637PasteVFALSEFALSE00TRUEFALSEButtonID_EDIT_CUT57635CutXFALSEFALSE1-1TRUEFALSEButtonID_EDIT_COPY57634CopyCFALSEFALSE2-1TRUEFALSEButtonID_EDIT_SELECT_ALL57642Select AllAFALSEFALSE3-1TRUEFALSEPanelView2FALSEFALSEButton_CheckID_VIEW_STATUS_BAR59393Status BarSFALSEFALSE-1-1TRUEPanelWindowW4FALSEFALSEButtonID_WINDOW_MANAGER131WindowsWFALSETRUE83TRUEFALSEButtonID_WINDOW_NEW57648&New WindowFALSEFALSE-1-1TRUEFALSEPanelPanel1-1FALSEFALSEButton_GalleryID_BUTTON232771Button1FALSEFALSE-1-1TRUEFALSEFALSEFALSE00, 0Button_ColorID_BUTTON332772Button2FALSEFALSE-1-1TRUETRUEFALSEFALSE522, 220, 0, 0FALSE0, 0, 0TRUEFALSEButton_UndoID_BUTTON432773Button3FALSEFALSE-1-1TRUETRUEFALSEFALSE-10, 0PanelPanel5-1FALSEFALSELabelStatic1FALSEFALSE-1-1TRUEEditID_EDIT232774Edit1FALSEFALSE-1-1TRUE700FALSEEditID_SPIN232775Spin1FALSEFALSE-1-1TRUE700TRUE0100PanelPanel6-1FALSEFALSEComboBoxID_COMBO232776Combo1FALSEFALSE-1-1TRUE1080FALSETRUETRUETRUEComboBox_FontID_COMBO332777Combo2FALSEFALSE-1-1TRUE1080FALSETRUETRUETRUE710ButtonID_BUTTON732780Button6FALSEFALSE-1-1TRUEFALSEGroupButtonID_BUTTON832781Button7FALSEFALSE-1-1TRUEFALSECategoryCategory4PanelPanel7-1FALSEFALSESliderID_SLIDER232782FALSEFALSE10001000FALSEProgressID_PROGRESS232783FALSEFALSE1002201000FALSEButton_LinkCtrlID_SYSLINK232784SysLink1FALSEFALSE-1-1TRUECategoryCategory1PanelPanel2-1FALSEFALSECategoryCategory2PanelPanel3-1FALSEFALSECategoryCategory3PanelPanel4-1FALSEFALSE
-------------------------------------------------------------------------------- /RainbowStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CRainbowStyle : public CMFCVisualManagerOffice2007 4 | { 5 | DECLARE_DYNCREATE(CRainbowStyle); 6 | 7 | CMFCToolBarImages m_uiElements; 8 | 9 | private: 10 | CRainbowStyle(); 11 | 12 | public: 13 | virtual ~CRainbowStyle(); 14 | 15 | // This is the color of a docking pane's caption 16 | virtual COLORREF OnDrawPaneCaption( 17 | CDC* pDC, 18 | CDockablePane* pBar, 19 | BOOL bActive, 20 | CRect rectCaption, 21 | CRect rectButtons) 22 | { 23 | static_cast(pBar); 24 | static_cast(bActive); 25 | static_cast(rectButtons); 26 | CBrush brush(RGB(0x58,0x8c,0x36)); 27 | pDC->FillRect(rectCaption, &brush); 28 | return static_cast(-1); 29 | } 30 | 31 | virtual COLORREF OnDrawPropertySheetListItem( 32 | CDC* pDC, 33 | CMFCPropertySheet* pParent, 34 | CRect rect, 35 | BOOL bIsHighlihted, 36 | BOOL bIsSelected) 37 | { 38 | static_cast(bIsHighlihted); 39 | static_cast(bIsSelected); 40 | static_cast(pParent); 41 | pDC->FillSolidRect(rect, RGB(0x9a,0xe3,0x72)); 42 | return RGB(0x9a,0xa3,0x28); 43 | } 44 | 45 | // This is the are behind the ribbon where there are no categories 46 | virtual void OnDrawRibbonCategory( 47 | CDC* pDC, 48 | CMFCRibbonCategory* pCategory, 49 | CRect rectCategory) 50 | { 51 | static_cast(pCategory); 52 | pDC->FillSolidRect(rectCategory, RGB(0x79,0x16,0x9b)); 53 | 54 | CPen pen(PS_SOLID, 1, RGB(0xf5,0xa7,0x45)); 55 | pDC->SelectObject(pen); 56 | pDC->MoveTo(CPoint(rectCategory.left, rectCategory.top)); 57 | pDC->LineTo(CPoint(rectCategory.right - 1, rectCategory.top)); 58 | } 59 | 60 | virtual COLORREF OnFillRibbonMainPanelButton( 61 | CDC* pDC, 62 | CMFCRibbonButton* pButton) 63 | { 64 | CString text = pButton->GetText(); 65 | if (!text.IsEmpty()) { 66 | pDC->FillSolidRect(pButton->GetRect(), RGB(0x39,0x8a,0xca)); 67 | return RGB(0xdb, 0xcf, 0x1f); 68 | } 69 | return RGB(0x4e,0x03,0xb2); 70 | } 71 | 72 | virtual void OnDrawRibbonMainPanelButtonBorder( 73 | CDC* pDC, 74 | CMFCRibbonButton* pButton 75 | ) 76 | { 77 | CString text = pButton->GetText(); 78 | if (!text.IsEmpty()) { 79 | pDC->SelectStockObject(BLACK_PEN); 80 | pDC->SelectStockObject(NULL_BRUSH); 81 | pDC->Rectangle(pButton->GetRect()); 82 | } 83 | } 84 | 85 | virtual void OnDrawRibbonMainPanelFrame( 86 | CDC* pDC, 87 | CMFCRibbonMainPanel* pPanel, 88 | CRect rect 89 | ) 90 | { 91 | static_cast(pPanel); 92 | pDC->FillSolidRect(rect, RGB(0x7f,0xa0,0xbe)); 93 | } 94 | 95 | virtual void OnFillRibbonMenuFrame( 96 | CDC* pDC, 97 | CMFCRibbonMainPanel* pPanel, 98 | CRect rect) 99 | { 100 | static_cast(rect); 101 | pDC->FillSolidRect(pPanel->GetRect(), RGB(0x6d,0xa5,0x45)); 102 | } 103 | 104 | 105 | virtual void OnDrawRibbonRecentFilesFrame( 106 | CDC* pDC, 107 | CMFCRibbonMainPanel* pPanel, 108 | CRect rect) 109 | { 110 | static_cast(pPanel); 111 | pDC->FillSolidRect(rect, RGB(0x1a,0x14,0x45)); 112 | } 113 | 114 | virtual COLORREF OnFillRibbonButton( 115 | CDC* pDC, 116 | CMFCRibbonButton* pButton) 117 | { 118 | if (pButton->GetParentPanel() && pButton->GetParentPanel()->IsKindOf(RUNTIME_CLASS(CMFCRibbonMainPanel))) 119 | { 120 | // RHS of recent files does not have large icons 121 | if (pButton->IsLargeImage()) { 122 | if (pButton->IsHighlighted()) { 123 | // #EDF4FC 124 | pDC->FillSolidRect(pButton->GetRect(), RGB(0x85,0xeb,0xc0)); 125 | 126 | // #A8D2FD 127 | CPen pen(PS_SOLID, 1, RGB(0xad,0x2a,0xb5)); 128 | pDC->SelectObject(pen); 129 | pDC->SelectStockObject(NULL_BRUSH); 130 | pDC->Rectangle(pButton->GetRect()); 131 | } 132 | else { 133 | pDC->FillSolidRect(pButton->GetRect(), RGB(0x93,0xd3,0x24)); 134 | } 135 | return RGB(0x37, 0xe4, 0x0c); 136 | } 137 | } 138 | return RGB(0x08, 0x01, 0x46); 139 | } 140 | 141 | virtual COLORREF OnDrawMenuLabel( 142 | CDC* pDC, 143 | CRect rect) 144 | { 145 | pDC->FillSolidRect(rect, RGB(0x4b,0xeb,0xf2)); 146 | return RGB(0xf0,0xe6,0xb8); 147 | } 148 | 149 | virtual COLORREF GetMenuItemTextColor( 150 | CMFCToolBarMenuButton* pButton, 151 | BOOL bHighlighted, 152 | BOOL bDisabled) override 153 | { 154 | static_cast(pButton); 155 | static_cast(bHighlighted); 156 | static_cast(bDisabled); 157 | return GetSysColor(COLOR_MENUTEXT); 158 | } 159 | 160 | virtual void OnHighlightMenuItem( 161 | CDC* pDC, 162 | CMFCToolBarMenuButton* pButton, 163 | CRect rect, 164 | COLORREF& clrText) override 165 | { 166 | static_cast(pButton); 167 | 168 | // #EDF4FC 169 | pDC->FillSolidRect(rect, RGB(0xED, 0xF4, 0xFC)); 170 | 171 | // #A8D2FD 172 | CPen pen(PS_SOLID, 1, RGB(0xA8, 0xD2, 0xFD)); 173 | pDC->SelectObject(pen); 174 | pDC->SelectStockObject(NULL_BRUSH); 175 | pDC->Rectangle(rect); 176 | clrText = GetSysColor(COLOR_MENUTEXT); 177 | } 178 | 179 | virtual void OnDrawMenuCheck( 180 | CDC* pDC, 181 | CMFCToolBarMenuButton* pButton, 182 | CRect rect, 183 | BOOL bHighlight, 184 | BOOL bIsRadio) 185 | { 186 | static_cast(pButton); 187 | static_cast(bHighlight); 188 | static_cast(bIsRadio); 189 | 190 | rect.InflateRect(0, 1); 191 | 192 | if (bHighlight) 193 | { 194 | // #C2DEFC 195 | pDC->SelectStockObject(NULL_PEN); 196 | pDC->FillSolidRect(rect, RGB(0xC2, 0xDE, 0xFC)); 197 | 198 | // #5FA2E6 199 | CPen pen(PS_SOLID, 1, RGB(0x5F, 0xA2, 0xE6)); 200 | pDC->SelectObject(pen); 201 | pDC->SelectStockObject(NULL_BRUSH); 202 | pDC->Rectangle(rect); 203 | } 204 | else { 205 | // #CEE5FC 206 | pDC->SelectStockObject(NULL_PEN); 207 | pDC->FillSolidRect(rect, RGB(0xCE, 0xE5, 0xFC)); 208 | 209 | // #64A5E6 210 | CPen pen(PS_SOLID, 1, RGB(0x64, 0xA5, 0xE6)); 211 | pDC->SelectObject(pen); 212 | pDC->SelectStockObject(NULL_BRUSH); 213 | pDC->Rectangle(rect); 214 | } 215 | 216 | CSize size(m_uiElements.GetImageSize()); 217 | CRect imgRect(0, 0, size.cx, size.cy); 218 | 219 | if ((pButton->m_nStyle & TBBS_DISABLED) == TBBS_DISABLED) 220 | { 221 | imgRect.OffsetRect(0, size.cy); 222 | } 223 | 224 | m_uiElements.DrawEx(pDC, rect, 0,CMFCToolBarImages::ImageAlignHorzCenter, 225 | CMFCToolBarImages::ImageAlignVertCenter, imgRect); 226 | } 227 | 228 | // The ribbons tab at the top where the categories are 229 | virtual COLORREF OnDrawRibbonCategoryTab( 230 | CDC* pDC, 231 | CMFCRibbonTab* pTab, 232 | BOOL bIsActive) 233 | { 234 | // the background of the category tab 235 | if (bIsActive) { 236 | pDC->FillSolidRect(pTab->GetRect(), RGB(0x0c,0xf9,0xd5)); 237 | 238 | CPen pen(PS_SOLID,1,GetSysColor(COLOR_3DLIGHT)); 239 | pDC->SelectObject(pen); 240 | pDC->MoveTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 241 | pDC->LineTo(CPoint(pTab->GetRect().left, pTab->GetRect().top)); 242 | pDC->LineTo(CPoint(pTab->GetRect().right-1, pTab->GetRect().top)); 243 | pDC->LineTo(CPoint(pTab->GetRect().right-1, pTab->GetRect().bottom)); 244 | 245 | CPen pen2(PS_SOLID, 1, RGB(0xfa,0x6e,0xa3)); 246 | pDC->SelectObject(pen2); 247 | pDC->LineTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 248 | } 249 | else { 250 | CBrush brush(RGB(0x79,0xbb,0xf6)); 251 | pDC->FillRect(pTab->GetRect(), &brush); 252 | 253 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 254 | pDC->SelectObject(pen); 255 | pDC->MoveTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 256 | pDC->LineTo(CPoint(pTab->GetRect().right - 1, pTab->GetRect().bottom)); 257 | 258 | pDC->SelectStockObject(BLACK_PEN); 259 | } 260 | // the color of the text on the tab 261 | if (bIsActive) { 262 | // the color of the selected tab text 263 | return GetSysColor(COLOR_WINDOWFRAME); 264 | } 265 | // the color of the non selected tab text 266 | return GetSysColor(COLOR_WINDOWFRAME); 267 | } 268 | 269 | virtual COLORREF OnDrawRibbonPanel( 270 | CDC* pDC, 271 | CMFCRibbonPanel* pPanel, 272 | CRect rectPanel, 273 | CRect rectCaption) 274 | { 275 | static_cast(pPanel); 276 | // the color of the ribbon 277 | pDC->FillSolidRect(rectPanel, RGB(0xb6,0x16,0x9e)); 278 | pDC->FillSolidRect(rectCaption, RGB(0x1e,0x9c,0xe2)); 279 | 280 | // This is the color of controls on the ribbon 281 | return RGB(0x66,0x52,0x20); 282 | } 283 | 284 | // this is the caption at the bottom on each panel 285 | virtual void OnDrawRibbonPanelCaption( 286 | CDC* pDC, 287 | CMFCRibbonPanel* pPanel, 288 | CRect rectCaption) 289 | { 290 | pDC->FillSolidRect(rectCaption, RGB(0xc9,0xa4,0x88)); 291 | 292 | CString str = pPanel->GetName(); 293 | 294 | if (!str.IsEmpty()) 295 | { 296 | rectCaption.DeflateRect(1, 1); 297 | 298 | if ((rectCaption.Width() % 2) == 0) 299 | { 300 | rectCaption.right--; 301 | } 302 | 303 | rectCaption.OffsetRect(0, -1); 304 | 305 | COLORREF clrTextOld = pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT)); 306 | pDC->DrawText(str, rectCaption, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); 307 | pDC->SetTextColor(clrTextOld); 308 | } 309 | 310 | // draw the separator on the right hand side 311 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 312 | pDC->SelectObject(pen); 313 | CRect panelRect = pPanel->GetRect(); 314 | pDC->MoveTo(panelRect.right - 1, panelRect.top + 2); 315 | pDC->LineTo(panelRect.right - 1, panelRect.bottom - 2); 316 | } 317 | 318 | // The color behind the category tabs 319 | virtual COLORREF OnDrawRibbonTabsFrame( 320 | CDC* pDC, 321 | CMFCRibbonBar* pWndRibbonBar, 322 | CRect rectTab) 323 | { 324 | static_cast(pWndRibbonBar); 325 | CBrush brush(RGB(0x28,0xcd,0xb3)); 326 | pDC->FillRect(rectTab, &brush); 327 | 328 | // color return is reserved by Microsoft 329 | return static_cast(-1); 330 | } 331 | 332 | virtual COLORREF OnDrawRibbonStatusBarPane( 333 | CDC* pDC, 334 | CMFCRibbonStatusBar* pBar, 335 | CMFCRibbonStatusBarPane* pPane) 336 | { 337 | static_cast(pBar); 338 | // this is the color of the names 339 | CBrush brush(RGB(0x45,0x5f,0x59)); 340 | pDC->FillRect(pPane->GetRect(), &brush); 341 | 342 | // this is the text color 343 | return GetSysColor(COLOR_WINDOWTEXT); 344 | } 345 | 346 | virtual void OnFillBarBackground( 347 | CDC* pDC, 348 | CBasePane* pBar, 349 | CRect rectClient, 350 | CRect rectClip, 351 | BOOL bNCArea = FALSE) 352 | { 353 | static_cast(bNCArea); 354 | static_cast(rectClip); 355 | static_cast(pBar); 356 | CBrush brush(RGB(0xff,0x0e,0x36)); 357 | pDC->FillRect(rectClient, &brush); 358 | } 359 | 360 | virtual BOOL OnEraseTabsFrame( 361 | CDC* pDC, 362 | CRect rect, 363 | const CMFCBaseTabCtrl* pTabWnd) 364 | { 365 | static_cast(pTabWnd); 366 | CBrush brush(RGB(0x98,0x72,0xd0)); 367 | pDC->FillRect(rect, &brush); 368 | return TRUE; 369 | } 370 | 371 | virtual void OnDrawStatusBarSizeBox( 372 | CDC* pDC, 373 | CMFCStatusBar* pStatBar, 374 | CRect rectSizeBox) 375 | { 376 | static_cast(pStatBar); 377 | CBrush brush(RGB(0xef,0x3e,0xe4)); 378 | pDC->FillRect(rectSizeBox, &brush); 379 | } 380 | 381 | virtual void OnDrawTab( 382 | CDC* pDC, 383 | CRect rectTab, 384 | int iTab, 385 | BOOL bIsActive, 386 | const CMFCBaseTabCtrl* pTabWnd) 387 | { 388 | if (bIsActive) { 389 | pDC->FillSolidRect(rectTab, RGB(0x66,0x17,0xfc)); 390 | } 391 | else { 392 | pDC->FillSolidRect(rectTab, RGB(0xb4,0x86,0xf8)); 393 | } 394 | 395 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 396 | pDC->SelectObject(pen); 397 | 398 | if (pTabWnd->GetLocation() == CMFCBaseTabCtrl::LOCATION_BOTTOM) 399 | { 400 | pDC->MoveTo(CPoint(rectTab.left, rectTab.bottom)); 401 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.bottom)); 402 | } 403 | else { 404 | pDC->MoveTo(CPoint(rectTab.left, rectTab.top)); 405 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.top)); 406 | } 407 | 408 | // the right hand side of the tab 409 | pDC->MoveTo(CPoint(rectTab.right - 1, rectTab.top)); 410 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.bottom)); 411 | 412 | 413 | CString str; 414 | pTabWnd->GetTabLabel(iTab, str); 415 | 416 | if (!str.IsEmpty()) 417 | { 418 | rectTab.DeflateRect(1, 1); 419 | 420 | if ((rectTab.Width() % 2) == 0) 421 | { 422 | rectTab.right--; 423 | } 424 | 425 | rectTab.OffsetRect(0, -1); 426 | 427 | COLORREF clrTextOld = pDC->SetTextColor(GetSysColor(COLOR_WINDOWFRAME)); 428 | pDC->DrawText(str, rectTab, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); 429 | pDC->SetTextColor(clrTextOld); 430 | } 431 | } 432 | 433 | virtual void OnFillTab( 434 | CDC* pDC, 435 | CRect rectFill, 436 | CBrush* pbrFill, 437 | int iTab, 438 | BOOL bIsActive, 439 | const CMFCBaseTabCtrl* pTabWnd) 440 | { 441 | static_cast(pTabWnd); 442 | static_cast(bIsActive); 443 | static_cast(iTab); 444 | static_cast(pbrFill); 445 | CBrush brush(RGB(0x9e,0x13,0x2c)); 446 | pDC->FillRect(rectFill, &brush); 447 | } 448 | 449 | virtual void GetTabFrameColors( 450 | const CMFCBaseTabCtrl* pTabWnd, 451 | COLORREF& clrDark, 452 | COLORREF& clrBlack, 453 | COLORREF& clrHighlight, 454 | COLORREF& clrFace, 455 | COLORREF& clrDarkShadow, 456 | COLORREF& clrLight, 457 | CBrush*& pbrFace, 458 | CBrush*& pbrBlack) 459 | { 460 | static_cast(pTabWnd); 461 | clrDark = GetSysColor(COLOR_BTNSHADOW); 462 | clrBlack = GetSysColor(COLOR_BTNSHADOW); 463 | clrHighlight = GetSysColor(COLOR_BTNSHADOW); 464 | clrFace = GetSysColor(COLOR_BTNSHADOW); 465 | clrDarkShadow = GetSysColor(COLOR_BTNSHADOW); 466 | clrLight = GetSysColor(COLOR_BTNSHADOW); 467 | 468 | pbrFace = &m_tabFaceBrush; 469 | pbrBlack = &m_tabBlackBrush; 470 | } 471 | 472 | virtual COLORREF GetTabTextColor( 473 | const CMFCBaseTabCtrl* pTabWnd, 474 | int iTab, 475 | BOOL bIsActive) 476 | { 477 | static_cast(iTab); 478 | static_cast(pTabWnd); 479 | static_cast(bIsActive); 480 | return RGB(0x8f,0x42,0xc7); 481 | } 482 | 483 | virtual COLORREF GetPropertyGridGroupColor(CMFCPropertyGridCtrl* pPropList) 484 | { 485 | static_cast(pPropList); 486 | return RGB(0x68,0x54,0x1c); 487 | } 488 | 489 | virtual void OnDrawCaptionBarInfoArea( 490 | CDC* pDC, 491 | CMFCCaptionBar* pBar, 492 | CRect rect) 493 | { 494 | static_cast(pBar); 495 | pDC->FillSolidRect(rect, RGB(0xFF, 0x00, 0x00)); 496 | } 497 | 498 | virtual void OnDrawTabsButtonBorder( 499 | CDC* pDC, 500 | CRect& rect, 501 | CMFCButton* pButton, 502 | UINT uiState, 503 | CMFCBaseTabCtrl* pWndTab) override 504 | { 505 | static_cast(pButton); 506 | static_cast(rect); 507 | static_cast(uiState); 508 | CBrush brush(GetSysColor(COLOR_BTNSHADOW)); 509 | CRect tabRect; 510 | pWndTab->GetTabsRect(tabRect); 511 | pDC->FillRect(tabRect, &brush); 512 | } 513 | 514 | virtual void OnEraseTabsArea( 515 | CDC* pDC, 516 | CRect rect, 517 | const CMFCBaseTabCtrl* pTabWnd) 518 | { 519 | static_cast(pTabWnd); 520 | pDC->FillSolidRect(rect, RGB(0xf,0x0f,0xd87)); 521 | } 522 | 523 | void OnUpdateSystemColors() override 524 | { 525 | GetGlobalData()->clrBarFace = ::GetSysColor(COLOR_BTNFACE); 526 | GetGlobalData()->clrBtnFace = ::GetSysColor(COLOR_BTNFACE); 527 | 528 | GetGlobalData()->clrBarShadow = ::GetSysColor(COLOR_BTNSHADOW); 529 | GetGlobalData()->clrBtnShadow = ::GetSysColor(COLOR_BTNSHADOW); 530 | 531 | GetGlobalData()->clrBarDkShadow = ::GetSysColor(COLOR_3DDKSHADOW); 532 | GetGlobalData()->clrBtnDkShadow = ::GetSysColor(COLOR_3DDKSHADOW); 533 | 534 | GetGlobalData()->clrBarLight = ::GetSysColor(COLOR_3DLIGHT); 535 | GetGlobalData()->clrBtnLight = ::GetSysColor(COLOR_3DLIGHT); 536 | 537 | GetGlobalData()->clrBarHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT); 538 | GetGlobalData()->clrBtnHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT); 539 | 540 | GetGlobalData()->clrBarText = ::GetSysColor(COLOR_BTNTEXT); 541 | GetGlobalData()->clrBtnText = ::GetSysColor(COLOR_BTNTEXT); 542 | GetGlobalData()->clrGrayedText = ::GetSysColor(COLOR_GRAYTEXT); 543 | GetGlobalData()->clrWindowFrame = ::GetSysColor(COLOR_WINDOWFRAME); 544 | 545 | GetGlobalData()->clrHilite = ::GetSysColor(COLOR_HIGHLIGHT); 546 | GetGlobalData()->clrTextHilite = ::GetSysColor(COLOR_HIGHLIGHTTEXT); 547 | 548 | GetGlobalData()->clrBarWindow = RGB(0x85, 0x6e, 0x42); 549 | GetGlobalData()->clrWindow = RGB(0x85, 0x6e, 0x42); 550 | 551 | GetGlobalData()->clrWindowText = ::GetSysColor(COLOR_WINDOWTEXT); 552 | 553 | GetGlobalData()->clrCaptionText = ::GetSysColor(COLOR_CAPTIONTEXT); 554 | GetGlobalData()->clrMenuText = ::GetSysColor(COLOR_MENUTEXT); 555 | 556 | GetGlobalData()->clrActiveCaption = ::GetSysColor(COLOR_ACTIVECAPTION); 557 | GetGlobalData()->clrInactiveCaption = ::GetSysColor(COLOR_INACTIVECAPTION); 558 | 559 | GetGlobalData()->clrActiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTACTIVECAPTION); 560 | GetGlobalData()->clrInactiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION); 561 | 562 | GetGlobalData()->clrActiveBorder = ::GetSysColor(COLOR_ACTIVEBORDER); 563 | GetGlobalData()->clrInactiveBorder = ::GetSysColor(COLOR_INACTIVEBORDER); 564 | 565 | GetGlobalData()->clrInactiveCaptionText = ::GetSysColor(COLOR_INACTIVECAPTIONTEXT); 566 | GetGlobalData()->brBtnFace.DeleteObject(); 567 | GetGlobalData()->brBtnFace.CreateSolidBrush(GetGlobalData()->clrBtnFace); 568 | 569 | GetGlobalData()->brBarFace.DeleteObject(); 570 | GetGlobalData()->brBarFace.CreateSolidBrush(GetGlobalData()->clrBarFace); 571 | 572 | GetGlobalData()->brActiveCaption.DeleteObject(); 573 | GetGlobalData()->brActiveCaption.CreateSolidBrush(GetGlobalData()->clrActiveCaption); 574 | 575 | GetGlobalData()->brInactiveCaption.DeleteObject(); 576 | GetGlobalData()->brInactiveCaption.CreateSolidBrush(GetGlobalData()->clrInactiveCaption); 577 | 578 | GetGlobalData()->brHilite.DeleteObject(); 579 | GetGlobalData()->brHilite.CreateSolidBrush(GetGlobalData()->clrHilite); 580 | 581 | GetGlobalData()->brBlack.DeleteObject(); 582 | GetGlobalData()->brBlack.CreateSolidBrush(GetGlobalData()->clrBtnDkShadow); 583 | 584 | GetGlobalData()->brWindow.DeleteObject(); 585 | GetGlobalData()->brWindow.CreateSolidBrush(GetGlobalData()->clrWindow); 586 | 587 | GetGlobalData()->penHilite.DeleteObject(); 588 | GetGlobalData()->penHilite.CreatePen(PS_SOLID, 1, afxGlobalData.clrHilite); 589 | 590 | GetGlobalData()->penBarFace.DeleteObject(); 591 | GetGlobalData()->penBarFace.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarFace); 592 | 593 | GetGlobalData()->penBarShadow.DeleteObject(); 594 | GetGlobalData()->penBarShadow.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarShadow); 595 | 596 | // Windows 10 ribbon color 597 | m_clrWindows10Bar = RGB(0xF5, 0xF6, 0xF7); 598 | 599 | // Windows 10 file menu application button color 600 | m_clrWindows10ApplicationButton = RGB(0x19,0x79,0xCA); 601 | } 602 | 603 | virtual void OnDrawRibbonApplicationButton( 604 | CDC* pDC, 605 | CMFCRibbonButton* pButton) 606 | { 607 | pDC->FillSolidRect(pButton->GetRect(), m_clrWindows10ApplicationButton); 608 | } 609 | 610 | virtual void OnDrawDefaultRibbonImage( 611 | CDC* pDC, 612 | CRect rectImage, 613 | BOOL bIsDisabled, 614 | BOOL bIsPressed, 615 | BOOL bIsHighlighted) 616 | { 617 | static_cast(pDC); 618 | static_cast(rectImage); 619 | static_cast(bIsDisabled); 620 | static_cast(bIsPressed); 621 | static_cast(bIsHighlighted); 622 | return; 623 | } 624 | 625 | virtual void OnFillRibbonQuickAccessToolBarPopup( 626 | CDC* pDC, 627 | CMFCRibbonPanelMenuBar* pMenuBar, 628 | CRect rect) 629 | { 630 | static_cast(pMenuBar); 631 | pDC->FillSolidRect(rect, RGB(0xFF,0x00,0x00)); 632 | } 633 | 634 | public: 635 | inline const COLORREF GetBackground() const 636 | { 637 | return m_crlBkgn; 638 | } 639 | 640 | public: 641 | virtual BOOL IsToolbarRoundShape(CMFCToolBar* pToolBar) override 642 | { 643 | static_cast(pToolBar); 644 | return FALSE; 645 | } 646 | 647 | 648 | private: 649 | COLORREF m_crlBkgn; 650 | 651 | CBrush m_tabFaceBrush; 652 | CBrush m_tabBlackBrush; 653 | 654 | COLORREF m_clrWindows10Bar; 655 | COLORREF m_clrWindows10ApplicationButton; 656 | }; 657 | 658 | -------------------------------------------------------------------------------- /Windows10Style.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CWindows10Style : public CMFCVisualManagerOffice2007 4 | { 5 | DECLARE_DYNCREATE(CWindows10Style); 6 | 7 | CMFCToolBarImages m_uiElements; 8 | 9 | private: 10 | CWindows10Style(); 11 | 12 | public: 13 | virtual ~CWindows10Style(); 14 | 15 | // This is the color of a docking pane's caption 16 | virtual COLORREF OnDrawPaneCaption( 17 | CDC* pDC, 18 | CDockablePane* pBar, 19 | BOOL bActive, 20 | CRect rectCaption, 21 | CRect rectButtons) 22 | { 23 | static_cast(pBar); 24 | static_cast(bActive); 25 | static_cast(rectButtons); 26 | CBrush brush(GetSysColor(COLOR_INACTIVEBORDER)); 27 | pDC->FillRect(rectCaption, &brush); 28 | return static_cast(-1); 29 | } 30 | 31 | virtual COLORREF OnDrawPropertySheetListItem( 32 | CDC* pDC, 33 | CMFCPropertySheet* pParent, 34 | CRect rect, 35 | BOOL bIsHighlihted, 36 | BOOL bIsSelected) 37 | { 38 | static_cast(bIsHighlihted); 39 | static_cast(bIsSelected); 40 | static_cast(pParent); 41 | pDC->FillSolidRect(rect, RGB(0xFF, 0x00, 0x00)); 42 | return RGB(0x00, 0xFF, 0x00); 43 | } 44 | 45 | // This is the are behind the ribbon where there are no categories 46 | virtual void OnDrawRibbonCategory( 47 | CDC* pDC, 48 | CMFCRibbonCategory* pCategory, 49 | CRect rectCategory) 50 | { 51 | static_cast(pCategory); 52 | pDC->FillSolidRect(rectCategory, m_clrWindows10Bar); 53 | 54 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 55 | pDC->SelectObject(pen); 56 | pDC->MoveTo(CPoint(rectCategory.left, rectCategory.top)); 57 | pDC->LineTo(CPoint(rectCategory.right - 1, rectCategory.top)); 58 | } 59 | 60 | virtual COLORREF OnFillRibbonMainPanelButton( 61 | CDC* pDC, 62 | CMFCRibbonButton* pButton) 63 | { 64 | CString text = pButton->GetText(); 65 | if (!text.IsEmpty()) { 66 | pDC->FillSolidRect(pButton->GetRect(), m_clrWindows10Bar); 67 | return GetSysColor(COLOR_WINDOWTEXT); 68 | } 69 | return RGB(0xFE,0xFE,0xFF); 70 | } 71 | 72 | virtual void OnDrawRibbonMainPanelButtonBorder( 73 | CDC* pDC, 74 | CMFCRibbonButton* pButton 75 | ) 76 | { 77 | CString text = pButton->GetText(); 78 | if (!text.IsEmpty()) { 79 | pDC->SelectStockObject(BLACK_PEN); 80 | pDC->SelectStockObject(NULL_BRUSH); 81 | pDC->Rectangle(pButton->GetRect()); 82 | } 83 | } 84 | 85 | virtual void OnDrawRibbonMainPanelFrame( 86 | CDC* pDC, 87 | CMFCRibbonMainPanel* pPanel, 88 | CRect rect 89 | ) 90 | { 91 | static_cast(pPanel); 92 | pDC->FillSolidRect(rect, m_clrWindows10Bar); 93 | } 94 | 95 | virtual void OnFillRibbonMenuFrame( 96 | CDC* pDC, 97 | CMFCRibbonMainPanel* pPanel, 98 | CRect rect) 99 | { 100 | static_cast(rect); 101 | pDC->FillSolidRect(pPanel->GetRect(), RGB(0xFE, 0xFE, 0xFF)); 102 | } 103 | 104 | 105 | virtual void OnDrawRibbonRecentFilesFrame( 106 | CDC* pDC, 107 | CMFCRibbonMainPanel* pPanel, 108 | CRect rect) 109 | { 110 | static_cast(pPanel); 111 | pDC->FillSolidRect(rect, RGB(0xFF, 0, 0)); 112 | } 113 | 114 | virtual COLORREF OnFillRibbonButton( 115 | CDC* pDC, 116 | CMFCRibbonButton* pButton) 117 | { 118 | if (pButton->GetParentPanel() && pButton->GetParentPanel()->IsKindOf(RUNTIME_CLASS(CMFCRibbonMainPanel))) 119 | { 120 | // RHS of recent files does not have large icons 121 | if (pButton->IsLargeImage()) { 122 | if (pButton->IsHighlighted()) { 123 | // #EDF4FC 124 | pDC->FillSolidRect(pButton->GetRect(), RGB(0xED, 0xF4, 0xFC)); 125 | 126 | // #A8D2FD 127 | CPen pen(PS_SOLID, 1, RGB(0xA8, 0xD2, 0xFD)); 128 | pDC->SelectObject(pen); 129 | pDC->SelectStockObject(NULL_BRUSH); 130 | pDC->Rectangle(pButton->GetRect()); 131 | } 132 | else { 133 | pDC->FillSolidRect(pButton->GetRect(), RGB(0xFB, 0xFC, 0xFD)); 134 | } 135 | return GetSysColor(COLOR_WINDOWTEXT); 136 | } 137 | } 138 | return GetSysColor(COLOR_WINDOWTEXT); 139 | } 140 | 141 | virtual COLORREF OnDrawMenuLabel( 142 | CDC* pDC, 143 | CRect rect) 144 | { 145 | pDC->FillSolidRect(rect, m_clrWindows10Bar); 146 | return GetSysColor(COLOR_WINDOWTEXT); 147 | } 148 | 149 | virtual COLORREF GetMenuItemTextColor( 150 | CMFCToolBarMenuButton* pButton, 151 | BOOL bHighlighted, 152 | BOOL bDisabled) override 153 | { 154 | static_cast(pButton); 155 | static_cast(bHighlighted); 156 | static_cast(bDisabled); 157 | return GetSysColor(COLOR_MENUTEXT); 158 | } 159 | 160 | virtual void OnHighlightMenuItem( 161 | CDC* pDC, 162 | CMFCToolBarMenuButton* pButton, 163 | CRect rect, 164 | COLORREF& clrText) override 165 | { 166 | static_cast(pButton); 167 | 168 | // #EDF4FC 169 | pDC->FillSolidRect(rect, RGB(0xED, 0xF4, 0xFC)); 170 | 171 | // #A8D2FD 172 | CPen pen(PS_SOLID, 1, RGB(0xA8, 0xD2, 0xFD)); 173 | pDC->SelectObject(pen); 174 | pDC->SelectStockObject(NULL_BRUSH); 175 | pDC->Rectangle(rect); 176 | clrText = GetSysColor(COLOR_MENUTEXT); 177 | } 178 | 179 | virtual void OnDrawMenuCheck( 180 | CDC* pDC, 181 | CMFCToolBarMenuButton* pButton, 182 | CRect rect, 183 | BOOL bHighlight, 184 | BOOL bIsRadio) 185 | { 186 | static_cast(pButton); 187 | static_cast(bHighlight); 188 | static_cast(bIsRadio); 189 | 190 | rect.InflateRect(0, 1); 191 | 192 | if (bHighlight) 193 | { 194 | // #C2DEFC 195 | pDC->SelectStockObject(NULL_PEN); 196 | pDC->FillSolidRect(rect, RGB(0xC2, 0xDE, 0xFC)); 197 | 198 | // #5FA2E6 199 | CPen pen(PS_SOLID, 1, RGB(0x5F, 0xA2, 0xE6)); 200 | pDC->SelectObject(pen); 201 | pDC->SelectStockObject(NULL_BRUSH); 202 | pDC->Rectangle(rect); 203 | } 204 | else { 205 | // #CEE5FC 206 | pDC->SelectStockObject(NULL_PEN); 207 | pDC->FillSolidRect(rect, RGB(0xCE, 0xE5, 0xFC)); 208 | 209 | // #64A5E6 210 | CPen pen(PS_SOLID, 1, RGB(0x64, 0xA5, 0xE6)); 211 | pDC->SelectObject(pen); 212 | pDC->SelectStockObject(NULL_BRUSH); 213 | pDC->Rectangle(rect); 214 | } 215 | 216 | CSize size(m_uiElements.GetImageSize()); 217 | CRect imgRect(0, 0, size.cx, size.cy); 218 | 219 | if ((pButton->m_nStyle & TBBS_DISABLED) == TBBS_DISABLED) 220 | { 221 | imgRect.OffsetRect(0, size.cy); 222 | } 223 | 224 | m_uiElements.DrawEx(pDC, rect, 0,CMFCToolBarImages::ImageAlignHorzCenter, 225 | CMFCToolBarImages::ImageAlignVertCenter, imgRect); 226 | } 227 | 228 | // The ribbons tab at the top where the categories are 229 | virtual COLORREF OnDrawRibbonCategoryTab( 230 | CDC* pDC, 231 | CMFCRibbonTab* pTab, 232 | BOOL bIsActive) 233 | { 234 | // the background of the category tab 235 | if (bIsActive) { 236 | pDC->FillSolidRect(pTab->GetRect(), m_clrWindows10Bar); 237 | 238 | CPen pen(PS_SOLID,1,GetSysColor(COLOR_3DLIGHT)); 239 | pDC->SelectObject(pen); 240 | pDC->MoveTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 241 | pDC->LineTo(CPoint(pTab->GetRect().left, pTab->GetRect().top)); 242 | pDC->LineTo(CPoint(pTab->GetRect().right-1, pTab->GetRect().top)); 243 | pDC->LineTo(CPoint(pTab->GetRect().right-1, pTab->GetRect().bottom)); 244 | 245 | CPen pen2(PS_SOLID, 1, m_clrWindows10Bar); 246 | pDC->SelectObject(pen2); 247 | pDC->LineTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 248 | } 249 | else { 250 | CBrush brush(GetSysColor(COLOR_WINDOW)); 251 | pDC->FillRect(pTab->GetRect(), &brush); 252 | 253 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 254 | pDC->SelectObject(pen); 255 | pDC->MoveTo(CPoint(pTab->GetRect().left, pTab->GetRect().bottom)); 256 | pDC->LineTo(CPoint(pTab->GetRect().right - 1, pTab->GetRect().bottom)); 257 | 258 | pDC->SelectStockObject(BLACK_PEN); 259 | } 260 | // the color of the text on the tab 261 | if (bIsActive) { 262 | // the color of the selected tab text 263 | return GetSysColor(COLOR_WINDOWFRAME); 264 | } 265 | // the color of the non selected tab text 266 | return GetSysColor(COLOR_WINDOWFRAME); 267 | } 268 | 269 | virtual COLORREF OnDrawRibbonPanel( 270 | CDC* pDC, 271 | CMFCRibbonPanel* pPanel, 272 | CRect rectPanel, 273 | CRect rectCaption) 274 | { 275 | static_cast(pPanel); 276 | // the color of the ribbon 277 | pDC->FillSolidRect(rectPanel, m_clrWindows10Bar); 278 | pDC->FillSolidRect(rectCaption, m_clrWindows10Bar); 279 | 280 | // This is the color of controls on the ribbon 281 | return GetSysColor(COLOR_WINDOWFRAME); 282 | } 283 | 284 | // this is the caption at the bottom on each panel 285 | virtual void OnDrawRibbonPanelCaption( 286 | CDC* pDC, 287 | CMFCRibbonPanel* pPanel, 288 | CRect rectCaption) 289 | { 290 | pDC->FillSolidRect(rectCaption, m_clrWindows10Bar); 291 | 292 | CString str = pPanel->GetName(); 293 | 294 | if (!str.IsEmpty()) 295 | { 296 | rectCaption.DeflateRect(1, 1); 297 | 298 | if ((rectCaption.Width() % 2) == 0) 299 | { 300 | rectCaption.right--; 301 | } 302 | 303 | rectCaption.OffsetRect(0, -1); 304 | 305 | COLORREF clrTextOld = pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT)); 306 | pDC->DrawText(str, rectCaption, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); 307 | pDC->SetTextColor(clrTextOld); 308 | } 309 | 310 | // draw the separator on the right hand side 311 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 312 | pDC->SelectObject(pen); 313 | CRect panelRect = pPanel->GetRect(); 314 | pDC->MoveTo(panelRect.right - 1, panelRect.top + 2); 315 | pDC->LineTo(panelRect.right - 1, panelRect.bottom - 2); 316 | } 317 | 318 | // The color behind the category tabs 319 | virtual COLORREF OnDrawRibbonTabsFrame( 320 | CDC* pDC, 321 | CMFCRibbonBar* pWndRibbonBar, 322 | CRect rectTab) 323 | { 324 | static_cast(pWndRibbonBar); 325 | CBrush brush(GetSysColor(COLOR_WINDOW)); 326 | pDC->FillRect(rectTab, &brush); 327 | 328 | // color return is reserved by Microsoft 329 | return static_cast(-1); 330 | } 331 | 332 | virtual COLORREF OnDrawRibbonStatusBarPane( 333 | CDC* pDC, 334 | CMFCRibbonStatusBar* pBar, 335 | CMFCRibbonStatusBarPane* pPane) 336 | { 337 | static_cast(pBar); 338 | // this is the color of the names 339 | CBrush brush(GetSysColor(COLOR_WINDOW)); 340 | pDC->FillRect(pPane->GetRect(), &brush); 341 | 342 | // this is the text color 343 | return GetSysColor(COLOR_WINDOWTEXT); 344 | } 345 | 346 | virtual void OnFillBarBackground( 347 | CDC* pDC, 348 | CBasePane* pBar, 349 | CRect rectClient, 350 | CRect rectClip, 351 | BOOL bNCArea = FALSE) 352 | { 353 | static_cast(bNCArea); 354 | static_cast(rectClip); 355 | static_cast(pBar); 356 | CBrush brush(GetSysColor(COLOR_WINDOW)); 357 | pDC->FillRect(rectClient, &brush); 358 | } 359 | 360 | virtual BOOL OnEraseTabsFrame( 361 | CDC* pDC, 362 | CRect rect, 363 | const CMFCBaseTabCtrl* pTabWnd) 364 | { 365 | static_cast(pTabWnd); 366 | CBrush brush(GetSysColor(COLOR_WINDOW)); 367 | pDC->FillRect(rect, &brush); 368 | return TRUE; 369 | } 370 | 371 | virtual void OnDrawStatusBarSizeBox( 372 | CDC* pDC, 373 | CMFCStatusBar* pStatBar, 374 | CRect rectSizeBox) 375 | { 376 | static_cast(pStatBar); 377 | CBrush brush(GetSysColor(COLOR_WINDOW)); 378 | pDC->FillRect(rectSizeBox, &brush); 379 | } 380 | 381 | virtual void OnDrawTab( 382 | CDC* pDC, 383 | CRect rectTab, 384 | int iTab, 385 | BOOL bIsActive, 386 | const CMFCBaseTabCtrl* pTabWnd) 387 | { 388 | if (bIsActive) { 389 | pDC->FillSolidRect(rectTab, m_clrWindows10Bar); 390 | } 391 | else { 392 | pDC->FillSolidRect(rectTab, GetSysColor(COLOR_WINDOW)); 393 | } 394 | 395 | CPen pen(PS_SOLID, 1, GetSysColor(COLOR_3DLIGHT)); 396 | pDC->SelectObject(pen); 397 | 398 | if (pTabWnd->GetLocation() == CMFCBaseTabCtrl::LOCATION_BOTTOM) 399 | { 400 | pDC->MoveTo(CPoint(rectTab.left, rectTab.bottom)); 401 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.bottom)); 402 | } 403 | else { 404 | pDC->MoveTo(CPoint(rectTab.left, rectTab.top)); 405 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.top)); 406 | } 407 | 408 | // the right hand side of the tab 409 | pDC->MoveTo(CPoint(rectTab.right - 1, rectTab.top)); 410 | pDC->LineTo(CPoint(rectTab.right - 1, rectTab.bottom)); 411 | 412 | 413 | CString str; 414 | pTabWnd->GetTabLabel(iTab, str); 415 | 416 | if (!str.IsEmpty()) 417 | { 418 | rectTab.DeflateRect(1, 1); 419 | 420 | if ((rectTab.Width() % 2) == 0) 421 | { 422 | rectTab.right--; 423 | } 424 | 425 | rectTab.OffsetRect(0, -1); 426 | 427 | COLORREF clrTextOld = pDC->SetTextColor(GetSysColor(COLOR_WINDOWFRAME)); 428 | pDC->DrawText(str, rectTab, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX); 429 | pDC->SetTextColor(clrTextOld); 430 | } 431 | } 432 | 433 | virtual void OnFillTab( 434 | CDC* pDC, 435 | CRect rectFill, 436 | CBrush* pbrFill, 437 | int iTab, 438 | BOOL bIsActive, 439 | const CMFCBaseTabCtrl* pTabWnd) 440 | { 441 | static_cast(pTabWnd); 442 | static_cast(bIsActive); 443 | static_cast(iTab); 444 | static_cast(pbrFill); 445 | CBrush brush(GetSysColor(COLOR_BTNSHADOW)); 446 | pDC->FillRect(rectFill, &brush); 447 | } 448 | 449 | virtual void GetTabFrameColors( 450 | const CMFCBaseTabCtrl* pTabWnd, 451 | COLORREF& clrDark, 452 | COLORREF& clrBlack, 453 | COLORREF& clrHighlight, 454 | COLORREF& clrFace, 455 | COLORREF& clrDarkShadow, 456 | COLORREF& clrLight, 457 | CBrush*& pbrFace, 458 | CBrush*& pbrBlack) 459 | { 460 | static_cast(pTabWnd); 461 | clrDark = GetSysColor(COLOR_BTNSHADOW); 462 | clrBlack = GetSysColor(COLOR_BTNSHADOW); 463 | clrHighlight = GetSysColor(COLOR_BTNSHADOW); 464 | clrFace = GetSysColor(COLOR_BTNSHADOW); 465 | clrDarkShadow = GetSysColor(COLOR_BTNSHADOW); 466 | clrLight = GetSysColor(COLOR_BTNSHADOW); 467 | 468 | pbrFace = &m_tabFaceBrush; 469 | pbrBlack = &m_tabBlackBrush; 470 | } 471 | 472 | virtual COLORREF GetTabTextColor( 473 | const CMFCBaseTabCtrl* pTabWnd, 474 | int iTab, 475 | BOOL bIsActive) 476 | { 477 | static_cast(iTab); 478 | static_cast(pTabWnd); 479 | static_cast(bIsActive); 480 | return GetSysColor(COLOR_WINDOW); 481 | } 482 | 483 | virtual COLORREF GetPropertyGridGroupColor(CMFCPropertyGridCtrl* pPropList) 484 | { 485 | static_cast(pPropList); 486 | return m_clrWindows10Bar; 487 | } 488 | 489 | virtual void OnDrawCaptionBarInfoArea( 490 | CDC* pDC, 491 | CMFCCaptionBar* pBar, 492 | CRect rect) 493 | { 494 | static_cast(pBar); 495 | pDC->FillSolidRect(rect, RGB(0xFF, 0x00, 0x00)); 496 | } 497 | 498 | virtual void OnDrawTabsButtonBorder( 499 | CDC* pDC, 500 | CRect& rect, 501 | CMFCButton* pButton, 502 | UINT uiState, 503 | CMFCBaseTabCtrl* pWndTab) override 504 | { 505 | static_cast(pButton); 506 | static_cast(rect); 507 | static_cast(uiState); 508 | CBrush brush(GetSysColor(COLOR_BTNSHADOW)); 509 | CRect tabRect; 510 | pWndTab->GetTabsRect(tabRect); 511 | pDC->FillRect(tabRect, &brush); 512 | } 513 | 514 | virtual void OnEraseTabsArea( 515 | CDC* pDC, 516 | CRect rect, 517 | const CMFCBaseTabCtrl* pTabWnd) 518 | { 519 | static_cast(pTabWnd); 520 | pDC->FillSolidRect(rect, GetSysColor(COLOR_WINDOW)); 521 | } 522 | 523 | void OnUpdateSystemColors() override 524 | { 525 | GetGlobalData()->clrBarFace = ::GetSysColor(COLOR_BTNFACE); 526 | GetGlobalData()->clrBtnFace = ::GetSysColor(COLOR_BTNFACE); 527 | 528 | GetGlobalData()->clrBarShadow = ::GetSysColor(COLOR_BTNSHADOW); 529 | GetGlobalData()->clrBtnShadow = ::GetSysColor(COLOR_BTNSHADOW); 530 | 531 | GetGlobalData()->clrBarDkShadow = ::GetSysColor(COLOR_3DDKSHADOW); 532 | GetGlobalData()->clrBtnDkShadow = ::GetSysColor(COLOR_3DDKSHADOW); 533 | 534 | GetGlobalData()->clrBarLight = ::GetSysColor(COLOR_3DLIGHT); 535 | GetGlobalData()->clrBtnLight = ::GetSysColor(COLOR_3DLIGHT); 536 | 537 | GetGlobalData()->clrBarHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT); 538 | GetGlobalData()->clrBtnHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT); 539 | 540 | GetGlobalData()->clrBarText = ::GetSysColor(COLOR_BTNTEXT); 541 | GetGlobalData()->clrBtnText = ::GetSysColor(COLOR_BTNTEXT); 542 | GetGlobalData()->clrGrayedText = ::GetSysColor(COLOR_GRAYTEXT); 543 | GetGlobalData()->clrWindowFrame = ::GetSysColor(COLOR_WINDOWFRAME); 544 | 545 | GetGlobalData()->clrHilite = ::GetSysColor(COLOR_HIGHLIGHT); 546 | GetGlobalData()->clrTextHilite = ::GetSysColor(COLOR_HIGHLIGHTTEXT); 547 | 548 | GetGlobalData()->clrBarWindow = ::GetSysColor(COLOR_WINDOW); 549 | GetGlobalData()->clrWindow = ::GetSysColor(COLOR_WINDOW); 550 | 551 | GetGlobalData()->clrWindowText = ::GetSysColor(COLOR_WINDOWTEXT); 552 | 553 | GetGlobalData()->clrCaptionText = ::GetSysColor(COLOR_CAPTIONTEXT); 554 | GetGlobalData()->clrMenuText = ::GetSysColor(COLOR_MENUTEXT); 555 | 556 | GetGlobalData()->clrActiveCaption = ::GetSysColor(COLOR_ACTIVECAPTION); 557 | GetGlobalData()->clrInactiveCaption = ::GetSysColor(COLOR_INACTIVECAPTION); 558 | 559 | GetGlobalData()->clrActiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTACTIVECAPTION); 560 | GetGlobalData()->clrInactiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION); 561 | 562 | GetGlobalData()->clrActiveBorder = ::GetSysColor(COLOR_ACTIVEBORDER); 563 | GetGlobalData()->clrInactiveBorder = ::GetSysColor(COLOR_INACTIVEBORDER); 564 | 565 | GetGlobalData()->clrInactiveCaptionText = ::GetSysColor(COLOR_INACTIVECAPTIONTEXT); 566 | GetGlobalData()->brBtnFace.DeleteObject(); 567 | GetGlobalData()->brBtnFace.CreateSolidBrush(GetGlobalData()->clrBtnFace); 568 | 569 | GetGlobalData()->brBarFace.DeleteObject(); 570 | GetGlobalData()->brBarFace.CreateSolidBrush(GetGlobalData()->clrBarFace); 571 | 572 | GetGlobalData()->brActiveCaption.DeleteObject(); 573 | GetGlobalData()->brActiveCaption.CreateSolidBrush(GetGlobalData()->clrActiveCaption); 574 | 575 | GetGlobalData()->brInactiveCaption.DeleteObject(); 576 | GetGlobalData()->brInactiveCaption.CreateSolidBrush(GetGlobalData()->clrInactiveCaption); 577 | 578 | GetGlobalData()->brHilite.DeleteObject(); 579 | GetGlobalData()->brHilite.CreateSolidBrush(GetGlobalData()->clrHilite); 580 | 581 | GetGlobalData()->brBlack.DeleteObject(); 582 | GetGlobalData()->brBlack.CreateSolidBrush(GetGlobalData()->clrBtnDkShadow); 583 | 584 | GetGlobalData()->brWindow.DeleteObject(); 585 | GetGlobalData()->brWindow.CreateSolidBrush(GetGlobalData()->clrWindow); 586 | 587 | GetGlobalData()->penHilite.DeleteObject(); 588 | GetGlobalData()->penHilite.CreatePen(PS_SOLID, 1, afxGlobalData.clrHilite); 589 | 590 | GetGlobalData()->penBarFace.DeleteObject(); 591 | GetGlobalData()->penBarFace.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarFace); 592 | 593 | GetGlobalData()->penBarShadow.DeleteObject(); 594 | GetGlobalData()->penBarShadow.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarShadow); 595 | 596 | // Windows 10 ribbon color 597 | m_clrWindows10Bar = RGB(0xF5, 0xF6, 0xF7); 598 | 599 | // Windows 10 file menu application button color 600 | m_clrWindows10ApplicationButton = RGB(0x19,0x79,0xCA); 601 | } 602 | 603 | virtual void OnDrawRibbonApplicationButton( 604 | CDC* pDC, 605 | CMFCRibbonButton* pButton) 606 | { 607 | pDC->FillSolidRect(pButton->GetRect(), m_clrWindows10ApplicationButton); 608 | } 609 | 610 | virtual void OnDrawDefaultRibbonImage( 611 | CDC* pDC, 612 | CRect rectImage, 613 | BOOL bIsDisabled, 614 | BOOL bIsPressed, 615 | BOOL bIsHighlighted) 616 | { 617 | static_cast(pDC); 618 | static_cast(rectImage); 619 | static_cast(bIsDisabled); 620 | static_cast(bIsPressed); 621 | static_cast(bIsHighlighted); 622 | return; 623 | } 624 | 625 | virtual void OnFillRibbonQuickAccessToolBarPopup( 626 | CDC* pDC, 627 | CMFCRibbonPanelMenuBar* pMenuBar, 628 | CRect rect) 629 | { 630 | static_cast(pMenuBar); 631 | pDC->FillSolidRect(rect, RGB(0xFF,0x00,0x00)); 632 | } 633 | 634 | public: 635 | inline const COLORREF GetBackground() const 636 | { 637 | return m_crlBkgn; 638 | } 639 | 640 | public: 641 | virtual BOOL IsToolbarRoundShape(CMFCToolBar* pToolBar) override 642 | { 643 | static_cast(pToolBar); 644 | return FALSE; 645 | } 646 | 647 | 648 | private: 649 | COLORREF m_crlBkgn; 650 | 651 | CBrush m_tabFaceBrush; 652 | CBrush m_tabBlackBrush; 653 | 654 | COLORREF m_clrWindows10Bar; 655 | COLORREF m_clrWindows10ApplicationButton; 656 | }; 657 | 658 | -------------------------------------------------------------------------------- /RibbonExample.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #ifndef APSTUDIO_INVOKED 11 | #include "targetver.h" 12 | #endif 13 | #include "afxres.h" 14 | #include "verrsrc.h" 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | #undef APSTUDIO_READONLY_SYMBOLS 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | // English (United States) resources 21 | 22 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 23 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 24 | #pragma code_page(1252) 25 | 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // 28 | // Icon 29 | // 30 | 31 | // Icon with lowest ID value placed first to ensure application icon 32 | // remains consistent on all systems. 33 | IDR_MAINFRAME ICON "res\\RibbonExample.ico" 34 | 35 | IDR_RibbonExampleTYPE ICON "res\\RibbonExampleDoc.ico" 36 | 37 | IDI_FILE_VIEW ICON "res\\file_view.ico" 38 | 39 | IDI_FILE_VIEW_HC ICON "res\\file_view_hc.ico" 40 | 41 | IDI_CLASS_VIEW ICON "res\\class_view.ico" 42 | 43 | IDI_CLASS_VIEW_HC ICON "res\\class_view_hc.ico" 44 | 45 | IDI_OUTPUT_WND ICON "res\\output_wnd.ico" 46 | 47 | IDI_OUTPUT_WND_HC ICON "res\\output_wnd_hc.ico" 48 | 49 | IDI_PROPERTIES_WND ICON "res\\properties_wnd.ico" 50 | 51 | IDI_PROPERTIES_WND_HC ICON "res\\properties_wnd_hc.ico" 52 | 53 | 54 | ///////////////////////////////////////////////////////////////////////////// 55 | // 56 | // Bitmap 57 | // 58 | 59 | IDR_MAINFRAME BITMAP "res\\Toolbar.bmp" 60 | 61 | IDR_MAINFRAME_256 BITMAP "res\\Toolbar256.bmp" 62 | 63 | IDB_MAIN BITMAP "res\\main.bmp" 64 | 65 | IDB_FILELARGEA BITMAP "res\\filelarge.bmp" 66 | 67 | IDB_FILESMALL BITMAP "res\\filesmall.bmp" 68 | 69 | IDB_WRITELARGE BITMAP "res\\writelarge.bmp" 70 | 71 | IDB_WRITESMALL BITMAP "res\\writesmall.bmp" 72 | 73 | IDB_BUTTONS BITMAP "res\\buttons.bmp" 74 | 75 | IDR_SORT BITMAP "res\\sort.bmp" 76 | 77 | IDB_SORT_24 BITMAP "res\\sort_hc.bmp" 78 | 79 | IDB_FILE_VIEW BITMAP "res\\fileview.bmp" 80 | 81 | IDB_FILE_VIEW_24 BITMAP "res\\fileview_hc.bmp" 82 | 83 | IDB_CLASS_VIEW BITMAP "res\\classview.bmp" 84 | 85 | IDB_CLASS_VIEW_24 BITMAP "res\\classview_hc.bmp" 86 | 87 | IDR_EXPLORER BITMAP "res\\explorer.bmp" 88 | 89 | IDB_EXPLORER_24 BITMAP "res\\explorer_hc.bmp" 90 | 91 | IDR_MENU_IMAGES BITMAP "res\\menuimages.bmp" 92 | 93 | IDB_MENU_IMAGES_24 BITMAP "res\\menuimages_hc.bmp" 94 | 95 | IDR_PROPERTIES BITMAP "res\\properties.bmp" 96 | 97 | IDB_PROPERTIES_HC BITMAP "res\\properties_hc.bmp" 98 | 99 | 100 | ///////////////////////////////////////////////////////////////////////////// 101 | // 102 | // Toolbar 103 | // 104 | 105 | IDR_MAINFRAME TOOLBAR 16, 15 106 | BEGIN 107 | BUTTON ID_FILE_NEW 108 | BUTTON ID_FILE_OPEN 109 | BUTTON ID_FILE_SAVE 110 | SEPARATOR 111 | BUTTON ID_EDIT_CUT 112 | BUTTON ID_EDIT_COPY 113 | BUTTON ID_EDIT_PASTE 114 | SEPARATOR 115 | BUTTON ID_FILE_PRINT 116 | BUTTON ID_APP_ABOUT 117 | END 118 | 119 | IDR_MAINFRAME_256 TOOLBAR 16, 15 120 | BEGIN 121 | BUTTON ID_FILE_NEW 122 | BUTTON ID_FILE_OPEN 123 | BUTTON ID_FILE_SAVE 124 | SEPARATOR 125 | BUTTON ID_EDIT_CUT 126 | BUTTON ID_EDIT_COPY 127 | BUTTON ID_EDIT_PASTE 128 | SEPARATOR 129 | BUTTON ID_FILE_PRINT 130 | BUTTON ID_APP_ABOUT 131 | END 132 | 133 | IDR_SORT TOOLBAR 16, 15 134 | BEGIN 135 | BUTTON ID_SORT_MENU 136 | BUTTON ID_NEW_FOLDER 137 | END 138 | 139 | IDR_EXPLORER TOOLBAR 16, 15 140 | BEGIN 141 | BUTTON ID_PROPERTIES 142 | END 143 | 144 | IDR_MENU_IMAGES TOOLBAR 16, 15 145 | BEGIN 146 | BUTTON ID_WINDOW_MANAGER 147 | SEPARATOR 148 | BUTTON ID_WINDOW_CASCADE 149 | BUTTON ID_WINDOW_TILE_HORZ 150 | BUTTON ID_TOOLS_MACRO 151 | BUTTON ID_SORTING_SORTALPHABETIC 152 | BUTTON ID_SORTING_SORTBYTYPE 153 | BUTTON ID_SORTING_SORTBYACCESS 154 | BUTTON ID_SORTING_GROUPBYTYPE 155 | END 156 | 157 | IDR_PROPERTIES TOOLBAR 16, 15 158 | BEGIN 159 | BUTTON ID_EXPAND_ALL 160 | BUTTON ID_SORTPROPERTIES 161 | BUTTON ID_PROPERTIES1 162 | BUTTON ID_PROPERTIES2 163 | END 164 | 165 | 166 | ///////////////////////////////////////////////////////////////////////////// 167 | // 168 | // Menu 169 | // 170 | 171 | IDR_MAINFRAME MENU 172 | BEGIN 173 | POPUP "&File" 174 | BEGIN 175 | MENUITEM "&New\tCtrl+N", ID_FILE_NEW 176 | MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN 177 | MENUITEM "&Close", ID_FILE_CLOSE 178 | MENUITEM SEPARATOR 179 | MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP 180 | MENUITEM SEPARATOR 181 | MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED 182 | MENUITEM SEPARATOR 183 | MENUITEM "E&xit", ID_APP_EXIT 184 | END 185 | POPUP "&View" 186 | BEGIN 187 | MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR 188 | POPUP "&Application Look" 189 | BEGIN 190 | MENUITEM "Windows &2000", ID_VIEW_APPLOOK_WIN_2000 191 | MENUITEM "Office &XP", ID_VIEW_APPLOOK_OFF_XP 192 | MENUITEM "&Windows XP", ID_VIEW_APPLOOK_WIN_XP 193 | MENUITEM "Office 200&3", ID_VIEW_APPLOOK_OFF_2003 194 | MENUITEM "Visual Studio 200&5", ID_VIEW_APPLOOK_VS_2005 195 | MENUITEM "Visual Studio 200&8", ID_VIEW_APPLOOK_VS_2008 196 | POPUP "Office 200&7" 197 | BEGIN 198 | MENUITEM "&Blue Style", ID_VIEW_APPLOOK_OFF_2007_BLUE 199 | MENUITEM "B&lack Style", ID_VIEW_APPLOOK_OFF_2007_BLACK 200 | MENUITEM "&Silver Style", ID_VIEW_APPLOOK_OFF_2007_SILVER 201 | MENUITEM "&Aqua Style", ID_VIEW_APPLOOK_OFF_2007_AQUA 202 | END 203 | MENUITEM "Windows 10", ID_VIEW_APPLOOK_WINDOWS_10 204 | END 205 | END 206 | POPUP "&Help" 207 | BEGIN 208 | MENUITEM "&About RibbonExample...", ID_APP_ABOUT 209 | END 210 | END 211 | 212 | IDR_RibbonExampleTYPE MENU 213 | BEGIN 214 | POPUP "&File" 215 | BEGIN 216 | MENUITEM "&New\tCtrl+N", ID_FILE_NEW 217 | MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN 218 | MENUITEM "&Close", ID_FILE_CLOSE 219 | MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE 220 | MENUITEM "Save &As...", ID_FILE_SAVE_AS 221 | MENUITEM SEPARATOR 222 | MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT 223 | MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW 224 | MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP 225 | MENUITEM SEPARATOR 226 | MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED 227 | MENUITEM SEPARATOR 228 | MENUITEM "E&xit", ID_APP_EXIT 229 | END 230 | POPUP "&Edit" 231 | BEGIN 232 | MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO 233 | MENUITEM SEPARATOR 234 | MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT 235 | MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY 236 | MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE 237 | END 238 | POPUP "&View" 239 | BEGIN 240 | MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR 241 | POPUP "&Application Look" 242 | BEGIN 243 | MENUITEM "Windows &2000", ID_VIEW_APPLOOK_WIN_2000 244 | MENUITEM "Office &XP", ID_VIEW_APPLOOK_OFF_XP 245 | MENUITEM "&Windows XP", ID_VIEW_APPLOOK_WIN_XP 246 | MENUITEM "Office 200&3", ID_VIEW_APPLOOK_OFF_2003 247 | MENUITEM "Visual Studio 200&5", ID_VIEW_APPLOOK_VS_2005 248 | MENUITEM "Visual Studio 200&8", ID_VIEW_APPLOOK_VS_2008 249 | POPUP "Office 200&7" 250 | BEGIN 251 | MENUITEM "&Blue Style", ID_VIEW_APPLOOK_OFF_2007_BLUE 252 | MENUITEM "B&lack Style", ID_VIEW_APPLOOK_OFF_2007_BLACK 253 | MENUITEM "&Silver Style", ID_VIEW_APPLOOK_OFF_2007_SILVER 254 | MENUITEM "&Aqua Style", ID_VIEW_APPLOOK_OFF_2007_AQUA 255 | END 256 | MENUITEM "Windows 10", ID_VIEW_APPLOOK_WINDOWS_10 257 | END 258 | END 259 | POPUP "&Window" 260 | BEGIN 261 | MENUITEM "&New Window", ID_WINDOW_NEW 262 | END 263 | POPUP "&Help" 264 | BEGIN 265 | MENUITEM "&About RibbonExample...", ID_APP_ABOUT 266 | END 267 | END 268 | 269 | IDR_POPUP_EDIT MENU 270 | BEGIN 271 | POPUP "Edit" 272 | BEGIN 273 | MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT 274 | MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY 275 | MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE 276 | END 277 | END 278 | 279 | IDR_WINDOWS_MENU MENU 280 | BEGIN 281 | MENUITEM "&New Window", ID_WINDOW_NEW 282 | END 283 | 284 | IDR_POPUP_SORT MENU 285 | BEGIN 286 | POPUP "Sorting" 287 | BEGIN 288 | MENUITEM "&Sort Alphabeticaly", ID_SORTING_SORTALPHABETIC 289 | MENUITEM "Sort by &Type", ID_SORTING_SORTBYTYPE 290 | MENUITEM "Sort by Acc&ess", ID_SORTING_SORTBYACCESS 291 | MENUITEM "Group by t&ype", ID_SORTING_GROUPBYTYPE 292 | END 293 | END 294 | 295 | IDR_POPUP_EXPLORER MENU 296 | BEGIN 297 | POPUP "Explorer" 298 | BEGIN 299 | MENUITEM "&Open", ID_OPEN 300 | MENUITEM "Open &With....", ID_OPEN_WITH 301 | MENUITEM SEPARATOR 302 | MENUITEM "&Compile", ID_DUMMY_COMPILE 303 | MENUITEM SEPARATOR 304 | MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT 305 | MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY 306 | MENUITEM "&Remove", ID_EDIT_CLEAR 307 | MENUITEM SEPARATOR 308 | MENUITEM "&Properties...", ID_PROPERTIES 309 | END 310 | END 311 | 312 | IDR_OUTPUT_POPUP MENU 313 | BEGIN 314 | POPUP "Popup" 315 | BEGIN 316 | MENUITEM "&Copy", ID_EDIT_COPY 317 | MENUITEM "&Clear", ID_EDIT_CLEAR 318 | MENUITEM SEPARATOR 319 | MENUITEM "&Hide", ID_VIEW_OUTPUTWND 320 | END 321 | END 322 | 323 | IDR_HELP_MENU MENU 324 | BEGIN 325 | MENUITEM "&About RibbonExample...", ID_APP_ABOUT 326 | END 327 | 328 | IDR_THEME_MENU MENU 329 | BEGIN 330 | MENUITEM "Office 2007 (&Blue Style)", ID_VIEW_APPLOOK_OFF_2007_BLUE 331 | MENUITEM "Office 2007 (B&lack Style)", ID_VIEW_APPLOOK_OFF_2007_BLACK 332 | MENUITEM "Office 2007 (&Silver Style)", ID_VIEW_APPLOOK_OFF_2007_SILVER 333 | MENUITEM "Office 2007 (&Aqua Style)", ID_VIEW_APPLOOK_OFF_2007_AQUA 334 | MENUITEM "Win&dows 7", ID_VIEW_APPLOOK_WINDOWS_7 335 | END 336 | 337 | 338 | ///////////////////////////////////////////////////////////////////////////// 339 | // 340 | // Accelerator 341 | // 342 | 343 | IDR_MAINFRAME ACCELERATORS 344 | BEGIN 345 | "N", ID_FILE_NEW, VIRTKEY, CONTROL 346 | "O", ID_FILE_OPEN, VIRTKEY, CONTROL 347 | "S", ID_FILE_SAVE, VIRTKEY, CONTROL 348 | "P", ID_FILE_PRINT, VIRTKEY, CONTROL 349 | "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL 350 | "X", ID_EDIT_CUT, VIRTKEY, CONTROL 351 | "C", ID_EDIT_COPY, VIRTKEY, CONTROL 352 | "V", ID_EDIT_PASTE, VIRTKEY, CONTROL 353 | VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT 354 | VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT 355 | VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL 356 | VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT 357 | VK_F6, ID_NEXT_PANE, VIRTKEY 358 | VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT 359 | END 360 | 361 | 362 | ///////////////////////////////////////////////////////////////////////////// 363 | // 364 | // Dialog 365 | // 366 | 367 | IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 368 | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU 369 | CAPTION "About RibbonExample" 370 | FONT 8, "MS Shell Dlg", 0, 0, 0x1 371 | BEGIN 372 | ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 373 | LTEXT "RibbonExample, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX 374 | LTEXT "Copyright (C) 2017",IDC_STATIC,42,26,114,8 375 | DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP 376 | END 377 | 378 | 379 | ///////////////////////////////////////////////////////////////////////////// 380 | // 381 | // Version 382 | // 383 | 384 | VS_VERSION_INFO VERSIONINFO 385 | FILEVERSION 1,0,0,1 386 | PRODUCTVERSION 1,0,0,1 387 | FILEFLAGSMASK 0x3fL 388 | #ifdef _DEBUG 389 | FILEFLAGS 0x1L 390 | #else 391 | FILEFLAGS 0x0L 392 | #endif 393 | FILEOS 0x40004L 394 | FILETYPE 0x1L 395 | FILESUBTYPE 0x0L 396 | BEGIN 397 | BLOCK "StringFileInfo" 398 | BEGIN 399 | BLOCK "040904B0" 400 | BEGIN 401 | VALUE "CompanyName", "TODO: " 402 | VALUE "FileDescription", "RibbonExample" 403 | VALUE "FileVersion", "1.0.0.1" 404 | VALUE "InternalName", "RibbonExample.exe" 405 | VALUE "LegalCopyright", "TODO: (c) . All rights reserved." 406 | VALUE "OriginalFilename", "RibbonExample.exe" 407 | VALUE "ProductName", "TODO: " 408 | VALUE "ProductVersion", "1.0.0.1" 409 | END 410 | END 411 | BLOCK "VarFileInfo" 412 | BEGIN 413 | VALUE "Translation", 0x409, 1200 414 | END 415 | END 416 | 417 | 418 | ///////////////////////////////////////////////////////////////////////////// 419 | // 420 | // DESIGNINFO 421 | // 422 | 423 | #ifdef APSTUDIO_INVOKED 424 | GUIDELINES DESIGNINFO 425 | BEGIN 426 | IDD_ABOUTBOX, DIALOG 427 | BEGIN 428 | LEFTMARGIN, 7 429 | RIGHTMARGIN, 163 430 | TOPMARGIN, 7 431 | BOTTOMMARGIN, 55 432 | END 433 | END 434 | #endif // APSTUDIO_INVOKED 435 | 436 | 437 | ///////////////////////////////////////////////////////////////////////////// 438 | // 439 | // Ribbon 440 | // 441 | 442 | IDR_RIBBON RT_RIBBON_XML "res\\ribbon.mfcribbon-ms" 443 | 444 | 445 | ///////////////////////////////////////////////////////////////////////////// 446 | // 447 | // String Table 448 | // 449 | 450 | STRINGTABLE 451 | BEGIN 452 | IDP_OLE_INIT_FAILED "OLE initialization failed. Make sure that the OLE libraries are the correct version." 453 | END 454 | 455 | STRINGTABLE 456 | BEGIN 457 | IDR_MAINFRAME "RibbonExample" 458 | IDR_RibbonExampleTYPE "\nRibbonExample\nRibbonExample\n\n\nRibbonExample.Document\nRibbonExample.Document" 459 | ID_WINDOW_MANAGER "&Windows..." 460 | END 461 | 462 | STRINGTABLE 463 | BEGIN 464 | AFX_IDS_APP_TITLE "RibbonExample" 465 | AFX_IDS_IDLEMESSAGE "Ready" 466 | END 467 | 468 | STRINGTABLE 469 | BEGIN 470 | ID_INDICATOR_EXT "EXT" 471 | ID_INDICATOR_CAPS "CAP" 472 | ID_INDICATOR_NUM "NUM" 473 | ID_INDICATOR_SCRL "SCRL" 474 | ID_INDICATOR_OVR "OVR" 475 | ID_INDICATOR_REC "REC" 476 | END 477 | 478 | STRINGTABLE 479 | BEGIN 480 | ID_FILE_NEW "Create a new document\nNew" 481 | ID_FILE_OPEN "Open an existing document\nOpen" 482 | ID_FILE_CLOSE "Close the active document\nClose" 483 | ID_FILE_SAVE "Save the active document\nSave" 484 | ID_FILE_SAVE_AS "Save the active document with a new name\nSave As" 485 | ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup" 486 | ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup" 487 | ID_FILE_PRINT "Print the active document\nPrint" 488 | ID_FILE_PRINT_DIRECT "Print the active document using current options\nQuick Print" 489 | ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview" 490 | END 491 | 492 | STRINGTABLE 493 | BEGIN 494 | ID_APP_ABOUT "Display program information, version number and copyright\nAbout" 495 | ID_APP_EXIT "Quit the application; prompts to save documents\nExit" 496 | END 497 | 498 | STRINGTABLE 499 | BEGIN 500 | ID_FILE_MRU_FILE1 "Open this document" 501 | ID_FILE_MRU_FILE2 "Open this document" 502 | ID_FILE_MRU_FILE3 "Open this document" 503 | ID_FILE_MRU_FILE4 "Open this document" 504 | ID_FILE_MRU_FILE5 "Open this document" 505 | ID_FILE_MRU_FILE6 "Open this document" 506 | ID_FILE_MRU_FILE7 "Open this document" 507 | ID_FILE_MRU_FILE8 "Open this document" 508 | ID_FILE_MRU_FILE9 "Open this document" 509 | ID_FILE_MRU_FILE10 "Open this document" 510 | ID_FILE_MRU_FILE11 "Open this document" 511 | ID_FILE_MRU_FILE12 "Open this document" 512 | ID_FILE_MRU_FILE13 "Open this document" 513 | ID_FILE_MRU_FILE14 "Open this document" 514 | ID_FILE_MRU_FILE15 "Open this document" 515 | ID_FILE_MRU_FILE16 "Open this document" 516 | END 517 | 518 | STRINGTABLE 519 | BEGIN 520 | ID_NEXT_PANE "Switch to the next window pane\nNext Pane" 521 | ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane" 522 | END 523 | 524 | STRINGTABLE 525 | BEGIN 526 | ID_WINDOW_NEW "Open another window for the active document\nNew Window" 527 | ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" 528 | ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows" 529 | ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows" 530 | ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows" 531 | ID_WINDOW_SPLIT "Split the active window into panes\nSplit" 532 | END 533 | 534 | STRINGTABLE 535 | BEGIN 536 | ID_EDIT_CLEAR "Erase the selection\nErase" 537 | ID_EDIT_CLEAR_ALL "Erase everything\nErase All" 538 | ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy" 539 | ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut" 540 | ID_EDIT_FIND "Find the specified text\nFind" 541 | ID_EDIT_PASTE "Insert Clipboard contents\nPaste" 542 | ID_EDIT_REPEAT "Repeat the last action\nRepeat" 543 | ID_EDIT_REPLACE "Replace specific text with different text\nReplace" 544 | ID_EDIT_SELECT_ALL "Select the entire document\nSelect All" 545 | ID_EDIT_UNDO "Undo the last action\nUndo" 546 | ID_EDIT_REDO "Redo the previously undone action\nRedo" 547 | END 548 | 549 | STRINGTABLE 550 | BEGIN 551 | ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" 552 | ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle Status Bar" 553 | END 554 | 555 | STRINGTABLE 556 | BEGIN 557 | AFX_IDS_SCSIZE "Change the window size" 558 | AFX_IDS_SCMOVE "Change the window position" 559 | AFX_IDS_SCMINIMIZE "Reduce the window to an icon" 560 | AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" 561 | AFX_IDS_SCNEXTWINDOW "Switch to the next document window" 562 | AFX_IDS_SCPREVWINDOW "Switch to the previous document window" 563 | AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents" 564 | END 565 | 566 | STRINGTABLE 567 | BEGIN 568 | AFX_IDS_SCRESTORE "Restore the window to normal size" 569 | AFX_IDS_SCTASKLIST "Activate Task List" 570 | AFX_IDS_MDICHILD "Activate this window" 571 | END 572 | 573 | STRINGTABLE 574 | BEGIN 575 | AFX_IDS_PREVIEW_CLOSE "Close print preview mode\nCancel Preview" 576 | END 577 | 578 | STRINGTABLE 579 | BEGIN 580 | IDS_STATUS_PANE1 "Pane 1" 581 | IDS_STATUS_PANE2 "Pane 2" 582 | END 583 | 584 | STRINGTABLE 585 | BEGIN 586 | IDS_FILE_VIEW "File View" 587 | IDS_CLASS_VIEW "Class View" 588 | IDS_OUTPUT_WND "Output" 589 | IDS_PROPERTIES_WND "Properties" 590 | END 591 | 592 | STRINGTABLE 593 | BEGIN 594 | IDS_EXPLORER "Explorer" 595 | IDS_EDIT_MENU "Edit" 596 | END 597 | 598 | STRINGTABLE 599 | BEGIN 600 | IDS_BUILD_TAB "Build" 601 | IDS_DEBUG_TAB "Debug" 602 | IDS_FIND_TAB "Find" 603 | END 604 | 605 | #endif // English (United States) resources 606 | ///////////////////////////////////////////////////////////////////////////// 607 | 608 | 609 | ///////////////////////////////////////////////////////////////////////////// 610 | // English (United Kingdom) resources 611 | 612 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) 613 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK 614 | #pragma code_page(1252) 615 | 616 | #ifdef APSTUDIO_INVOKED 617 | ///////////////////////////////////////////////////////////////////////////// 618 | // 619 | // TEXTINCLUDE 620 | // 621 | 622 | 1 TEXTINCLUDE 623 | BEGIN 624 | "resource.h\0" 625 | END 626 | 627 | 2 TEXTINCLUDE 628 | BEGIN 629 | "#ifndef APSTUDIO_INVOKED\r\n" 630 | "#include ""targetver.h""\r\n" 631 | "#endif\r\n" 632 | "#include ""afxres.h""\r\n" 633 | "#include ""verrsrc.h""\r\n" 634 | "\0" 635 | END 636 | 637 | 3 TEXTINCLUDE 638 | BEGIN 639 | "#define _AFX_NO_OLE_RESOURCES\r\n" 640 | "#define _AFX_NO_TRACKER_RESOURCES\r\n" 641 | "#define _AFX_NO_PROPERTY_RESOURCES\r\n" 642 | "\r\n" 643 | "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" 644 | "LANGUAGE 9, 1\r\n" 645 | "#include ""res\\RibbonExample.rc2"" // non-Microsoft Visual C++ edited resources\r\n" 646 | "#include ""afxres.rc"" // Standard components\r\n" 647 | "#include ""afxprint.rc"" // printing/print preview resources\r\n" 648 | "#if !defined(_AFXDLL)\r\n" 649 | "#include ""afxribbon.rc"" // MFC ribbon and control bar resources\r\n" 650 | "#endif\r\n" 651 | "#endif\r\n" 652 | "\0" 653 | END 654 | 655 | #endif // APSTUDIO_INVOKED 656 | 657 | 658 | ///////////////////////////////////////////////////////////////////////////// 659 | // 660 | // PNG 661 | // 662 | 663 | IDB_FILELARGE PNG "res\\filelarge.png" 664 | 665 | IDB_UI_ELEMENTS PNG "res\\ui_elements.png" 666 | 667 | #endif // English (United Kingdom) resources 668 | ///////////////////////////////////////////////////////////////////////////// 669 | 670 | 671 | 672 | #ifndef APSTUDIO_INVOKED 673 | ///////////////////////////////////////////////////////////////////////////// 674 | // 675 | // Generated from the TEXTINCLUDE 3 resource. 676 | // 677 | #define _AFX_NO_OLE_RESOURCES 678 | #define _AFX_NO_TRACKER_RESOURCES 679 | #define _AFX_NO_PROPERTY_RESOURCES 680 | 681 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 682 | LANGUAGE 9, 1 683 | #include "res\RibbonExample.rc2" // non-Microsoft Visual C++ edited resources 684 | #include "afxres.rc" // Standard components 685 | #include "afxprint.rc" // printing/print preview resources 686 | #if !defined(_AFXDLL) 687 | #include "afxribbon.rc" // MFC ribbon and control bar resources 688 | #endif 689 | #endif 690 | 691 | ///////////////////////////////////////////////////////////////////////////// 692 | #endif // not APSTUDIO_INVOKED 693 | 694 | --------------------------------------------------------------------------------