// MainFrm.cpp // // (c)1998-2025 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// #include "StdAfx.h" #include "GridSample.h" #include "FolderView.h" #include "GridSampleDoc.h" #include "GridSampleView.h" #include "MainFrm.h" #ifndef WM_DWMCOLORIZATIONCOLORCHANGED # define WM_DWMCOLORIZATIONCOLORCHANGED 0x320 #endif #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_COMMAND_EX(ID_TEST_FIELDCHOOSER, OnBarCheck) ON_COMMAND_EX(ID_TEST_FILTERWINDOW, OnBarCheck) ON_UPDATE_COMMAND_UI(ID_TEST_FIELDCHOOSER, OnUpdateControlBarMenu) ON_UPDATE_COMMAND_UI(ID_TEST_FILTERWINDOW, OnUpdateControlBarMenu) ON_MESSAGE(WM_DWMCOLORIZATIONCOLORCHANGED, OnColorizationColorChanged) //}}AFX_MSG_MAP #if defined(_XTP_INCLUDE_COMMANDBARS) && defined(XTP_INCLUDE_CONTROLS) ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize) #endif #ifdef _XTP_INCLUDE_DOCKINGPANE ON_MESSAGE(XTPWM_DOCKINGPANE_NOTIFY, OnDockingPaneNotify) #endif END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() #ifdef _XTP_INCLUDE_DOCKINGPANE : m_pFolderView(NULL) #endif { #if defined(_XTP_INCLUDE_SKINFRAMEWORK) && !defined(_XTP_EXCLUDE_SKINFRAMEWORK) XTPSkinManager()->SetAutoApplyNewWindows(TRUE); #endif } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { // XTPResourceManager()->SetResourceFile(_T("Translations\\ToolkitPro.ResourceUk.dll")); // XTPResourceManager()->SetResourceFile(_T("Translations\\ToolkitPro.ResourceDe.dll")); // XTPResourceManager()->SetResourceFile(_T("Translations\\ToolkitPro.ResourceEs.dll")); // XTPResourceManager()->SetResourceFile(_T("Translations\\ToolkitPro.ResourceFr.dll")); // XTPResourceManager()->SetResourceFile(_T("Translations\\ToolkitPro.ResourceZhCn.dll")); if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; #ifndef _XTP_INCLUDE_COMMANDBARS if (!m_wndToolBar.Create(this, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); #else if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } if (!InitCommandBars()) return -1; CXTPCommandBars* pCommandBars = GetCommandBars(); pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); CXTPToolBar* pStandardBar = pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pStandardBar || !pStandardBar->LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; } SetTheme(xtpThemeOffice2013, xtpIniOffice2016OutlookColorful); pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; // Load the previous state for command bars. LoadCommandBars(_T("CommandBars")); #endif EnableDocking(CBRS_ALIGN_ANY); // Initialize dialog bar m_wndFieldChooser if (!m_wndFieldChooser.Create(this, IDD_FIELDCHOOSER, CBRS_LEFT | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE, ID_TEST_FIELDCHOOSER)) return -1; // fail to create // Initialize dialog bar m_wndFilterEdit if (!m_wndFilterEdit.Create(this, IDD_FILTEREDIT, CBRS_LEFT | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE, ID_TEST_FILTERWINDOW)) return -1; // fail to create // docking for field chooser m_wndFieldChooser.EnableDocking(0); m_wndFieldChooser.SetWindowText(_T("Field Chooser")); ShowControlBar(&m_wndFieldChooser, FALSE, FALSE); FloatControlBar(&m_wndFieldChooser, CPoint(100, GetSystemMetrics(SM_CYSCREEN) / 3)); // docking for filter editing m_wndFilterEdit.EnableDocking(CBRS_ALIGN_TOP); m_wndFilterEdit.SetWindowText(_T("Filter text")); ShowControlBar(&m_wndFilterEdit, FALSE, FALSE); FloatControlBar(&m_wndFilterEdit, CPoint(400, GetSystemMetrics(SM_CYSCREEN) / 3)); // Docking Pane sample, remove && 0 to see the pane #if defined(_XTP_INCLUDE_DOCKINGPANE) && 0 m_paneManager.InstallDockingPanes(this); m_paneManager.SetTheme(xtpPaneThemeOffice2013); m_paneManager.SetFloatingFrameCaption(_T("Panes")); m_paneManager.SetStickyFloatingFrames(TRUE); m_paneManager.EnableFloatingFrameTheme(TRUE); m_paneManager.SetSideDockingMargin(CRect(2, 2, 2, 2)); m_paneManager.EnableSideDocking(); m_paneManager.EnableKeyboardNavigate(); CXTPDockingPane* pPaneFolders = m_paneManager.CreatePane(IDR_PANE_FOLDER, CRect(0, 0, 200, 150), xtpPaneDockLeft); #endif return 0; } LRESULT CMainFrame::OnColorizationColorChanged(WPARAM /*wParam*/, LPARAM /*lParam*/) { XTPGetApplication()->TriggerAmbientPropertyUpdate(xtpApplicationAccentColor); RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_FRAME); return Default(); } #if defined(_XTP_INCLUDE_COMMANDBARS) && defined(_XTP_INCLUDE_CONTROLS) void CMainFrame::OnCustomize() { // Get a pointer to the command bars object. CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars != NULL) { // Instantiate the customize dialog object. CXTPCustomizeSheet dlg(pCommandBars); // Add the options page to the customize dialog. CXTPCustomizeOptionsPage pageOptions(&dlg); dlg.AddPage(&pageOptions); // Add the commands page to the customize dialog. CXTPCustomizeCommandsPage* pCommands = dlg.GetCommandsPage(); pCommands->AddCategories(IDR_MAINFRAME); // Use the command bar manager to initialize the // customize dialog. pCommands->InsertAllCommandsCategory(); pCommands->InsertBuiltInMenus(IDR_MAINFRAME); pCommands->InsertNewMenuCategory(); // Display the dialog. dlg.DoModal(); } } #endif BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if (!CFrameWnd::PreCreateWindow(cs)) return FALSE; cs.lpszClass = _T("XTPMainFrame"); CXTPDrawHelpers::RegisterWndClass(AfxGetInstanceHandle(), cs.lpszClass, CS_DBLCLKS, AfxGetApp()->LoadIcon(IDR_MAINFRAME)); cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers #ifdef _XTP_INCLUDE_DOCKINGPANE LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam) { BOOL bHandled = FALSE; # if 0 if (XTP_DPN_SHOWWINDOW == wParam) { bHandled = TRUE; CXTPDockingPane *pPane = reinterpret_cast(lParam); if (!pPane->IsValid()) { if (NULL == m_pFolderView) { m_pFolderView = DYNAMIC_DOWNCAST(CFolderView, pPane->AttachView(this, RUNTIME_CLASS(CFolderView))); } else { pPane->Attach(m_pFolderView->GetParent()); } } } # endif return bHandled; } #endif void CMainFrame::SetTheme(XTPPaintTheme paintTheme, LPCTSTR lpszINI /*=NULL*/) { #ifdef _XTP_INCLUDE_COMMANDBARS EnableFrameTheme(FALSE); #endif XTPThemeDLL()->SetHandle(lpszINI); #ifdef _XTP_INCLUDE_COMMANDBARS switch (paintTheme) { case xtpThemeOffice2013: case xtpThemeVisualStudio2015: case xtpThemeVisualStudio2017: case xtpThemeVisualStudio2019: case xtpThemeVisualStudio2022: case xtpThemeNativeWindows10: case xtpThemeNativeWindows11: m_bAllowDwm = FALSE; break; default: m_bAllowDwm = TRUE; break; } CXTPCommandBars* pCommandBars = GetCommandBars(); _ASSERTE(NULL != pCommandBars); CXTPImageManager* pImgMgr = pCommandBars->GetImageManager(); _ASSERTE(NULL != pImgMgr); pImgMgr->RemoveAll(); CString strINI = lpszINI; pCommandBars->SetAllCaps((strINI.Find(_T("2013")) != -1) || (strINI.Find(_T("2015")) != -1) || (strINI.Find(_T("2017")) != -1) || (strINI.Find(_T("2019")) != -1) || (strINI.Find(_T("2022")) != -1)); UINT uiSystemMenu[] = { ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, ID_EDIT_CUT, ID_EDIT_COPY, ID_EDIT_PASTE, ID_FILE_PRINT, ID_APP_ABOUT }; CString type(_T("RT_XAML")); // resource type UINT nWidth = 0; switch (paintTheme) { case xtpThemeOffice2013: // Normal icons nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_DOCUMENT, ID_FILE_NEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_FOLDER_OPEN, ID_FILE_OPEN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_SAVE, ID_FILE_SAVE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_SAVE_AS, ID_FILE_SAVE_AS, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLIPBOARD_CUT, ID_EDIT_CUT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLIPBOARD_COPY, ID_EDIT_COPY, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLIPBOARD_PASTE, ID_EDIT_PASTE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_COMMAND_UNDO, ID_EDIT_UNDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_COMMAND_REDO, ID_EDIT_REDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PRINTER, ID_FILE_PRINT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PRINT_SETUP, ID_FILE_PRINT_SETUP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PRINT_PREVIEW, ID_FILE_PRINT_PREVIEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_EXIT, ID_APP_EXIT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_BUTTON_HELP, ID_APP_ABOUT, nWidth); nWidth = XTP_DPI_X(32); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_DOCUMENT, ID_FILE_NEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_FOLDER_OPEN, ID_FILE_OPEN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_SAVE, ID_FILE_SAVE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_SAVE_AS, ID_FILE_SAVE_AS, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_CLIPBOARD_CUT, ID_EDIT_CUT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_CLIPBOARD_COPY, ID_EDIT_COPY, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_CLIPBOARD_PASTE, ID_EDIT_PASTE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_COMMAND_UNDO, ID_EDIT_UNDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_COMMAND_REDO, ID_EDIT_REDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_PRINTER, ID_FILE_PRINT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_PRINT_SETUP, ID_FILE_PRINT_SETUP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_PRINT_PREVIEW, ID_FILE_PRINT_PREVIEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_EXIT, ID_APP_EXIT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_NORMAL_BUTTON_HELP, ID_APP_ABOUT, nWidth); // Disabled icons nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_DOCUMENT, ID_FILE_NEW, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_FOLDER_OPEN, ID_FILE_OPEN, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_SAVE, ID_FILE_SAVE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_SAVE_AS, ID_FILE_SAVE_AS, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CLIPBOARD_CUT, ID_EDIT_CUT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CLIPBOARD_COPY, ID_EDIT_COPY, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CLIPBOARD_PASTE, ID_EDIT_PASTE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_COMMAND_UNDO, ID_EDIT_UNDO, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_COMMAND_REDO, ID_EDIT_REDO, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PRINTER, ID_FILE_PRINT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PRINT_SETUP, ID_FILE_PRINT_SETUP, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PRINT_PREVIEW, ID_FILE_PRINT_PREVIEW, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_EXIT, ID_APP_EXIT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_BUTTON_HELP, ID_APP_ABOUT, nWidth, xtpImageDisabled); nWidth = XTP_DPI_X(32); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_DOCUMENT, ID_FILE_NEW, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_FOLDER_OPEN, ID_FILE_OPEN, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_SAVE, ID_FILE_SAVE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_SAVE_AS, ID_FILE_SAVE_AS, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_CLIPBOARD_CUT, ID_EDIT_CUT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_CLIPBOARD_COPY, ID_EDIT_COPY, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_CLIPBOARD_PASTE, ID_EDIT_PASTE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_COMMAND_UNDO, ID_EDIT_UNDO, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_COMMAND_REDO, ID_EDIT_REDO, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_PRINTER, ID_FILE_PRINT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_PRINT_SETUP, ID_FILE_PRINT_SETUP, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_LARGE_ICON_DISABLED_PRINT_PREVIEW, ID_FILE_PRINT_PREVIEW, nWidth, xtpImageDisabled); break; case xtpThemeVisualStudio2015: case xtpThemeVisualStudio2017: case xtpThemeVisualStudio2019: case xtpThemeVisualStudio2022: case xtpThemeNativeWindows10: case xtpThemeNativeWindows11: { if (XTPResourceImages()->m_strIniFileName == xtpIniVisualStudio2015Dark || XTPResourceImages()->m_strIniFileName == xtpIniVisualStudio2017Dark || XTPResourceImages()->m_strIniFileName == xtpIniVisualStudio2019Dark || XTPResourceImages()->m_strIniFileName == xtpIniVisualStudio2022Dark) { nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_NEWFILE, ID_FILE_NEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_FOLDEROPEN, ID_FILE_OPEN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_SAVE, ID_FILE_SAVE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_SAVEAS, ID_FILE_SAVE_AS, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_CUT, ID_EDIT_CUT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_COPY, ID_EDIT_COPY, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_PASTE, ID_EDIT_PASTE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_UNDO, ID_EDIT_UNDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_REDO, ID_EDIT_REDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_PRINT, ID_FILE_PRINT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_PRINTSETUP, ID_FILE_PRINT_SETUP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015DARK_ICON_NORMAL_PRINTPREVIEW, ID_FILE_PRINT_PREVIEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_EXIT, ID_APP_EXIT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_BUTTON_HELP, ID_APP_ABOUT, nWidth); } else { nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_NEWFILE, ID_FILE_NEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_FOLDEROPEN, ID_FILE_OPEN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_SAVE, ID_FILE_SAVE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_SAVEAS, ID_FILE_SAVE_AS, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_CUT, ID_EDIT_CUT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_COPY, ID_EDIT_COPY, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_PASTE, ID_EDIT_PASTE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_UNDO, ID_EDIT_UNDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_REDO, ID_EDIT_REDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_PRINT, ID_FILE_PRINT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_PRINTSETUP, ID_FILE_PRINT_SETUP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_VS2015LIGHT_ICON_NORMAL_PRINTPREVIEW, ID_FILE_PRINT_PREVIEW, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CLOSE_WINDOW, ID_FILE_CLOSE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_EXIT, ID_APP_EXIT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_BUTTON_HELP, ID_APP_ABOUT, nWidth); } } break; default: pImgMgr->SetIcons(IDR_MAINFRAME); break; } if (lpszINI != NULL) { CXTPPaintManager::SetTheme(paintTheme); EnableFrameTheme(pCommandBars); } else { CXTPPaintManager::SetTheme(paintTheme); EnableFrameTheme(NULL); } switch (paintTheme) { case xtpThemeOffice2013: case xtpThemeVisualStudio2015: case xtpThemeVisualStudio2017: case xtpThemeVisualStudio2019: case xtpThemeVisualStudio2022: case xtpThemeNativeWindows10: case xtpThemeNativeWindows11: { for (int i = 0; i < pCommandBars->GetCount(); i++) { CXTPToolBar* pToolBar = pCommandBars->GetAt(i); pToolBar->SetFlags(xtpFlagAlignTop, xtpFlagAlignBottom | xtpFlagAlignLeft | xtpFlagAlignRight | xtpFlagFloating); if (xtpBarTypeMenuBar == pToolBar->GetType()) { pToolBar->SetShowGripper(FALSE); } else { pToolBar->SetShowGripper(TRUE); } } SetFrameIcon(CSize(20, 20)); } break; default: for (int i = 0; i < pCommandBars->GetCount(); i++) { CXTPToolBar* pToolBar = pCommandBars->GetAt(i); pToolBar->SetFlags(xtpFlagAlignTop | xtpFlagAlignBottom | xtpFlagAlignLeft | xtpFlagAlignRight | xtpFlagFloating, 0); pToolBar->SetShowGripper(TRUE); } SetFrameIcon(CSize(16, 16)); break; } pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; pCommandBars->GetPaintManager()->RefreshMetrics(); pCommandBars->RedrawCommandBars(); #else UNREFERENCED_PARAMETER(paintTheme); #endif } #ifdef _XTP_INCLUDE_COMMANDBARS BOOL CMainFrame::SetFrameIcon(CSize szIcon) { CXTPCommandBars* pCommandBars = GetCommandBars(); if (!pCommandBars) return FALSE; CXTPPaintManager* pPaintManager = pCommandBars->GetPaintManager(); if (!pPaintManager) return FALSE; CXTPFramePaintManager* pFramePaintManager = pPaintManager->GetFramePaintManager(); if (!pFramePaintManager) return FALSE; HICON hIcon = NULL; hIcon = (HICON)::LoadImage(theApp.m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, szIcon.cx, szIcon.cy, LR_SHARED); if (hIcon) { pFramePaintManager->SetIcon(hIcon, szIcon); } return TRUE; } #endif