// 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 "CommandBarIcons.h" #include "MainFrm.h" #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_WM_GETMINMAXINFO() ON_WM_CLOSE() //}}AFX_MSG_MAP ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize) ON_COMMAND(ID_VIEW_RTL, OnViewRTL) ON_UPDATE_COMMAND_UI(ID_VIEW_RTL, OnUpdateViewRTL) ON_COMMAND(ID_THEME, OnThemeDlg) ON_COMMAND(ID_PROPERTIES, OnPropertiesDlg) ON_UPDATE_COMMAND_UI(ID_PROPERTIES, OnUpdateProperties) ON_XTP_CREATECONTROL() ON_WM_XTP_THEMECHANGED() 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() : m_bRTL(FALSE) , m_bThemeApplied(FALSE) , m_nAppliedTheme(xtpThemeNone) { // TODO: add member initialization code here } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; 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; CXTPCommandBar* pMenuBar = GetCommandBars()->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage); CXTPToolBar* pStandardBar = (CXTPToolBar*)GetCommandBars()->Add(_T("Standard"), xtpBarTop); if (!pStandardBar || !pStandardBar->LoadToolBar(IDR_MAINFRAME, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } // Load the previous state for command bars. LoadCommandBars(_T("CommandBars")); InitThemeDlg(); m_wndProperties.Create(IDD_DIALOG_PROPERTIES, this); m_wndProperties.CenterWindow(this); m_wndProperties.ShowWindow(SW_SHOW); CenterWindow(); return 0; } void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { lpMMI->ptMinTrackSize.x = XTP_DPI_X(1280); lpMMI->ptMinTrackSize.y = XTP_DPI_Y(720); CXTPFrameWnd::OnGetMinMaxInfo(lpMMI); } void CMainFrame::InitThemeDlg() { // exclude unused themes. m_dlgTheme.ExcludeTheme(XTP_EXCLUDE_THEME_VISUALSTUDIO2012 | XTP_EXCLUDE_THEME_CUSTOM); // create theme dialog. VERIFY(m_dlgTheme.Create(IDD_THEME_DIALOG, this)); // set startup theme m_dlgTheme.SetTheme(xtpThemeDlgOffice2016, xtpThemeColor2016Colorful, xtpThemeAccentWord, xtpThemeRibbonBackNone, TRUE); // enable auto preview. m_dlgTheme.EnableAutoPreview(TRUE); } void CMainFrame::EnableTheme(XTPPaintTheme nTheme, LPCTSTR lpzThemeSettings, BOOL bEnable /*= TRUE*/) { ASSERT(NULL != lpzThemeSettings); switch (nTheme) { case xtpThemeNone: EnableNoStyle(bEnable); break; case xtpThemeDlgOffice2000: EnableStyleOffice2000(); break; case xtpThemeDlgOfficeXP: EnableStyleOfficeXP(); break; case xtpThemeDlgOffice2003: EnableStyleOffice2003(); break; case xtpThemeOffice2013: if (0 < _tcsstr(lpzThemeSettings, _T("OFFICE2013"))) { EnableStyleOffice2013(bEnable); } else if (0 < _tcsstr(lpzThemeSettings, _T("OFFICE2016"))) { EnableStyleOffice2016(bEnable); } else { ASSERT(!"Unexpected theme settings"); } break; case xtpThemeVisualStudio6: EnableStyleVisualStudio2003(bEnable); break; case xtpThemeVisualStudio2005: EnableStyleVisualStudio2005(bEnable); break; case xtpThemeVisualStudio2008: EnableStyleVisualStudio2008(bEnable); break; case xtpThemeVisualStudio2010: EnableStyleVisualStudio2010(bEnable); break; case xtpThemeVisualStudio2015: EnableStyleVisualStudio2015(bEnable); break; case xtpThemeVisualStudio2017: EnableStyleVisualStudio2017(bEnable); break; case xtpThemeVisualStudio2019: EnableStyleVisualStudio2019(bEnable); break; case xtpThemeVisualStudio2022: EnableStyleVisualStudio2022(bEnable); break; case xtpThemeNativeWindows10: EnableStyleWindows10(bEnable); break; case xtpThemeNativeWindows11: EnableStyleWindows11(bEnable); break; case xtpThemeResource: if (0 < _tcsstr(lpzThemeSettings, _T("OFFICE2007"))) { EnableStyleOffice2007(bEnable); } else if (0 < _tcsstr(lpzThemeSettings, _T("OFFICE2010"))) { EnableStyleOffice2010(bEnable); } else if (0 < _tcsstr(lpzThemeSettings, _T("WINDOWS7"))) { EnableStyleWindows7(bEnable); } else { ASSERT(!"Unexpected theme settings"); } break; case xtpThemeOffice2007System: EnableStyleOffice2007System(bEnable); break; default: ASSERT(!"Unsupported theme"); break; } } void CMainFrame::UpdateTheme() { XTPPaintTheme nNewTheme = theApp.GetAppTheme(); CString strNewThemeSettings = theApp.GetAppThemeSettings(); if (m_bThemeApplied && m_nAppliedTheme == nNewTheme && m_strAppliedThemeSettings == strNewThemeSettings) { // No change required. return; } CWaitCursor wait; // Enable new theme. EnableTheme(nNewTheme, strNewThemeSettings); m_nAppliedTheme = nNewTheme; m_strAppliedThemeSettings = strNewThemeSettings; CXTPCommandBars* pCommandBars = GetCommandBars(); pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; pCommandBars->GetPaintManager()->RefreshMetrics(); pCommandBars->GetImageManager()->RefreshAll(); pCommandBars->RedrawCommandBars(); SendMessage(WM_NCPAINT); RedrawWindow(0, 0, RDW_ALLCHILDREN | RDW_INVALIDATE); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if (!CXTPFrameWnd::PreCreateWindow(cs)) return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU | FWS_ADDTOTITLE; cs.lpszClass = _T("XTPMainFrame"); CXTPDrawHelpers::RegisterWndClass(AfxGetInstanceHandle(), cs.lpszClass, CS_DBLCLKS, AfxGetApp()->LoadIcon(IDR_MAINFRAME)); cs.cx = XTP_DPI_X(1280); cs.cy = XTP_DPI_Y(720); 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. void CMainFrame::OnPropertiesDlg() { if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) { m_wndProperties.ShowWindow(SW_HIDE); } else { if (!m_wndProperties.GetSafeHwnd()) { m_wndProperties.Create(IDD_DIALOG_PROPERTIES, this); m_wndProperties.UpdateAll(); } m_wndProperties.ShowWindow(SW_SHOW); } } void CMainFrame::OnUpdateProperties(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()); } void CMainFrame::OnThemeDlg() { m_dlgTheme.ShowWindow(SW_SHOW); } int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl) { if (lpCreateControl->bToolBar) { if (lpCreateControl->nID == ID_PROPERTIES) { CXTPControlButton* pButton = (CXTPControlButton*)CXTPControlButton::CreateObject(); lpCreateControl->pControl = pButton; pButton->SetID(lpCreateControl->nID); pButton->SetStyle(xtpButtonIconAndCaption); return TRUE; } } return FALSE; } void CMainFrame::OnClose() { // Save the current state for command bars. SaveCommandBars(_T("CommandBars")); CFrameWnd::OnClose(); } void CMainFrame::OnCustomize() { // Get a pointer to the command bars object. CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars == NULL) return; // Instantiate the customize dialog. 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* pPageCommands = dlg.GetCommandsPage(); pPageCommands->AddCategories(IDR_MAINFRAME); // Initialize the commands page page. pPageCommands->InsertAllCommandsCategory(); pPageCommands->InsertBuiltInMenus(IDR_MAINFRAME); pPageCommands->InsertNewMenuCategory(); // Display the customize dialog. dlg.DoModal(); } void CMainFrame::OnViewRTL() { m_bRTL = !m_bRTL; // Apply RTL style to other components if (m_bRTL) { ModifyStyleEx(0, WS_EX_LAYOUTRTL); m_wndProperties.ModifyStyleEx(0, WS_EX_LAYOUTRTL); } else { ModifyStyleEx(WS_EX_LAYOUTRTL, 0); m_wndProperties.ModifyStyleEx(WS_EX_LAYOUTRTL, 0); } GetCommandBars()->SetLayoutRTL(m_bRTL); } void CMainFrame::OnUpdateViewRTL(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_bRTL); } void CMainFrame::SetTooltipStyle(XTPToolTipStyle nStyle) { CXTPToolTipContext* pToolTipContext = NULL; // Update tooltip styles. pToolTipContext = m_wndStatusBar.GetToolTipContext(); if (NULL != pToolTipContext) { pToolTipContext->SetStyle(nStyle); } pToolTipContext = GetCommandBars()->GetToolTipContext(); if (NULL != pToolTipContext) { pToolTipContext->SetStyle(nStyle); } } void CMainFrame::DisableStyle() { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); DisableFrameTheme(); } void CMainFrame::EnableNoStyle(BOOL bEnable /*= TRUE*/) { if (bEnable) { CXTPCommandBarsFrameHook::m_bAllowDwm = FALSE; EnableFrameTheme(GetCommandBars()); // if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) // m_wndProperties.UpdateAll(-1); } else { DisableFrameTheme(); } } void CMainFrame::EnableStyleOffice2000(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleOfficeXP(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(3); } else { DisableStyle(); } } void CMainFrame::EnableStyleOffice2003(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleOffice2007(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice2007); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleOffice2007System(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleOffice2010(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleOffice2013(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(TRUE); m_wndStatusBar.SetAllCaps(TRUE); SetTooltipStyle(xtpToolTipOffice2013); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(1); } else { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); DisableStyle(); } } void CMainFrame::EnableStyleOffice2016(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(TRUE); m_wndStatusBar.SetAllCaps(TRUE); SetTooltipStyle(xtpToolTipOffice2016); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(1); } else { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2003(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(2); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2005(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(3); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2008(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(3); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2010(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipOffice); EnableFrameTheme(NULL); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(3); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2015(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(TRUE); m_wndStatusBar.SetAllCaps(TRUE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(0); } else { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2017(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(0); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2019(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(0); } else { DisableStyle(); } } void CMainFrame::EnableStyleVisualStudio2022(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(0); } else { DisableStyle(); } } void CMainFrame::EnableStyleWindows7(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipLuna); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(3); } else { DisableStyle(); } } void CMainFrame::EnableStyleWindows10(BOOL bEnable /*= TRUE*/) { if (bEnable) { // TODO: Leave COLORREF_NULL as an accent color to get system accent color // or specify any custom RGB accent color value. XTPGetApplication()->SetAmbientProperty(xtpApplicationAccentColor, COleVariant(static_cast(COLORREF_NULL), VT_I4)); GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(1); } else { DisableStyle(); } } void CMainFrame::EnableStyleWindows11(BOOL bEnable /*= TRUE*/) { if (bEnable) { GetCommandBars()->SetAllCaps(FALSE); m_wndStatusBar.SetAllCaps(FALSE); SetTooltipStyle(xtpToolTipStandard); EnableFrameTheme(NULL); EnableFrameTheme(GetCommandBars()); if (m_wndProperties.GetSafeHwnd() && m_wndProperties.IsWindowVisible()) m_wndProperties.UpdateAll(1); } else { DisableStyle(); } } LRESULT CMainFrame::OnThemeChanged(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); CWaitCursor wait; // Disable previous theme. EnableTheme(m_nAppliedTheme, m_strAppliedThemeSettings, FALSE); THEME_COLOR* pThemeColor = reinterpret_cast(lParam); int nTheme = pThemeColor->nTheme; int nColor = pThemeColor->nColor; int nAccent = pThemeColor->nAccent; XTPGetApplication()->SetAmbientProperty(xtpApplicationAccentColor, static_cast(pThemeColor->nAccent)); XTPGetApplication()->SetAmbientProperty(xtpApplicationUseSystemAccentColor, static_cast(pThemeColor->bUseSystemAccent)); switch (nTheme) { case xtpThemeDlgOffice2000: theApp.SetAppTheme(xtpThemeOffice2000); break; case xtpThemeDlgOfficeXP: theApp.SetAppTheme(xtpThemeOfficeXP); break; case xtpThemeDlgOffice2003: theApp.SetAppTheme(xtpThemeOffice2003); break; case xtpThemeDlgNativeWindows: theApp.SetAppTheme(xtpThemeResource, xtpIniWindows7Blue); break; case xtpThemeDlgOffice2007: { switch (nColor) { case xtpThemeColor2007Blue: theApp.SetAppTheme(xtpThemeOffice2007, xtpIniOffice2007Blue); break; case xtpThemeColor2007Silver: theApp.SetAppTheme(xtpThemeOffice2007, xtpIniOffice2007Silver); break; case xtpThemeColor2007Black: theApp.SetAppTheme(xtpThemeOffice2007, xtpIniOffice2007Black); break; case xtpThemeColor2007Aqua: theApp.SetAppTheme(xtpThemeOffice2007, xtpIniOffice2007Aqua); break; case xtpThemeColor2007System: theApp.SetAppTheme(xtpThemeOffice2007System); break; } } break; case xtpThemeDlgOffice2010: { switch (nColor) { case xtpThemeColor2010Blue: theApp.SetAppTheme(xtpThemeResource, xtpIniOffice2010Blue); break; case xtpThemeColor2010Silver: theApp.SetAppTheme(xtpThemeResource, xtpIniOffice2010Silver); break; case xtpThemeColor2010Black: theApp.SetAppTheme(xtpThemeResource, xtpIniOffice2010Black); break; } } break; case xtpThemeDlgOffice2013: { switch (nColor) { case xtpThemeColor2013White: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013Access); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013Excel); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013OneNote); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013Outlook); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013PowerPoint); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013Publisher); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013Word); break; } } break; case xtpThemeColor2013GrayLight: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013AccessGrayLight); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013ExcelGrayLight); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013OneNoteGrayLight); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013OutlookGrayLight); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013PowerPointGrayLight); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013PublisherGrayLight); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013WordGrayLight); break; } } break; case xtpThemeColor2013GrayDark: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013AccessGrayDark); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013ExcelGrayDark); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013OneNoteGrayDark); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013OutlookGrayDark); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013PowerPointGrayDark); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013PublisherGrayDark); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2013, xtpIniOffice2013WordGrayDark); break; } } break; } } break; case xtpThemeDlgOffice2016: { switch (nColor) { case xtpThemeColor2016Black: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016AccessBlack); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016ExcelBlack); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OneNoteBlack); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OutlookBlack); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PowerPointBlack); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PublisherBlack); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016WordBlack); break; } } break; case xtpThemeColor2016White: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016AccessWhite); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016ExcelWhite); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OneNoteWhite); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OutlookWhite); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PowerPointWhite); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PublisherWhite); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016WordWhite); break; } } break; case xtpThemeColor2016Colorful: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016AccessColorful); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016ExcelColorful); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OneNoteColorful); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OutlookColorful); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PowerPointColorful); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PublisherColorful); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016WordColorful); break; } } break; case xtpThemeColor2016GrayDark: { switch (nAccent) { case xtpThemeAccentAccess: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016AccessDarkGray); break; case xtpThemeAccentExcel: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016ExcelDarkGray); break; case xtpThemeAccentOneNote: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OneNoteDarkGray); break; case xtpThemeAccentOutlook: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016OutlookDarkGray); break; case xtpThemeAccentPowerPoint: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PowerPointDarkGray); break; case xtpThemeAccentPublisher: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016PublisherDarkGray); break; case xtpThemeAccentWord: theApp.SetAppTheme(xtpThemeOffice2016, xtpIniOffice2016WordDarkGray); break; } } break; } } break; case xtpThemeDlgVisualStudio6: theApp.SetAppTheme(xtpThemeVisualStudio6); break; case xtpThemeDlgVisualStudio2005: theApp.SetAppTheme(xtpThemeVisualStudio2005); break; case xtpThemeDlgVisualStudio2008: theApp.SetAppTheme(xtpThemeVisualStudio2008); break; case xtpThemeDlgVisualStudio2010: theApp.SetAppTheme(xtpThemeVisualStudio2010); break; case xtpThemeDlgVisualStudio2015: { switch (nColor) { case xtpThemeColor2015Blue: theApp.SetAppTheme(xtpThemeVisualStudio2015, xtpIniVisualStudio2015Blue); break; case xtpThemeColor2015Dark: theApp.SetAppTheme(xtpThemeVisualStudio2015, xtpIniVisualStudio2015Dark); break; case xtpThemeColor2015Light: theApp.SetAppTheme(xtpThemeVisualStudio2015, xtpIniVisualStudio2015Light); break; } } break; case xtpThemeDlgVisualStudio2017: { switch (nColor) { case xtpThemeColor2017Blue: theApp.SetAppTheme(xtpThemeVisualStudio2017, xtpIniVisualStudio2017Blue); break; case xtpThemeColor2017BlueExtra: theApp.SetAppTheme(xtpThemeVisualStudio2017, xtpIniVisualStudio2017BlueExtra); break; case xtpThemeColor2017Dark: theApp.SetAppTheme(xtpThemeVisualStudio2017, xtpIniVisualStudio2017Dark); break; case xtpThemeColor2017Light: theApp.SetAppTheme(xtpThemeVisualStudio2017, xtpIniVisualStudio2017Light); break; } } break; case xtpThemeDlgVisualStudio2019: { switch (nColor) { case xtpThemeColor2019Blue: theApp.SetAppTheme(xtpThemeVisualStudio2019, xtpIniVisualStudio2019Blue); break; case xtpThemeColor2019BlueExtra: theApp.SetAppTheme(xtpThemeVisualStudio2019, xtpIniVisualStudio2019BlueExtra); break; case xtpThemeColor2019Dark: theApp.SetAppTheme(xtpThemeVisualStudio2019, xtpIniVisualStudio2019Dark); break; case xtpThemeColor2019Light: theApp.SetAppTheme(xtpThemeVisualStudio2019, xtpIniVisualStudio2019Light); break; } } break; case xtpThemeDlgVisualStudio2022: { switch (nColor) { case xtpThemeColor2022Blue: theApp.SetAppTheme(xtpThemeVisualStudio2022, xtpIniVisualStudio2022Blue); break; case xtpThemeColor2022BlueExtra: theApp.SetAppTheme(xtpThemeVisualStudio2022, xtpIniVisualStudio2022BlueExtra); break; case xtpThemeColor2022Dark: theApp.SetAppTheme(xtpThemeVisualStudio2022, xtpIniVisualStudio2022Dark); break; case xtpThemeColor2022Light: theApp.SetAppTheme(xtpThemeVisualStudio2022, xtpIniVisualStudio2022Light); break; } } break; case xtpThemeDlgNativeWindows10: { switch (nColor) { case xtpThemeColorWindows10Light: XTPGetApplication()->SetAmbientProperty(xtpApplicationAccentColor, static_cast( pThemeColor->nAccent)); theApp.SetAppTheme(xtpThemeNativeWindows10, xtpIniWindows10Light); break; case xtpThemeColorWindows10Dark: XTPGetApplication()->SetAmbientProperty(xtpApplicationAccentColor, static_cast( pThemeColor->nAccent)); theApp.SetAppTheme(xtpThemeNativeWindows10, xtpIniWindows10Dark); break; } } break; case xtpThemeDlgNativeWindows11: { switch (nColor) { case xtpThemeColorWindows11Light: theApp.SetAppTheme(xtpThemeNativeWindows11, xtpIniWindows11Light); break; case xtpThemeColorWindows11Dark: theApp.SetAppTheme(xtpThemeNativeWindows11, xtpIniWindows11Dark); break; } } break; } UpdateTheme(); return 0; }