// MainFrm.cpp : implementation of the CMainFrame class // // (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 "CommandBarsSample.h" #include "MainFrm.h" #include "GalleryItems.h" #include "ActionSampleFrame.h" #include "ActionSampleView.h" #include "RebarSampleFrame.h" #include "ControlsSampleFrame.h" #include "CustomThemeSampleFrame.h" #include "DialogSampleDlg.h" #include "TabbedToolbarSample.h" #include "TabbedToolbarView.h" #include "ControlSelector.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CXTPMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) //{{AFX_MSG_MAP(CMainFrame) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code ! ON_WM_CREATE() ON_WM_DESTROY() ON_COMMAND(ID_OPTIONS_STYLE_THEMEDIALOG, OnThemeSelectTheme) ON_WM_XTP_THEMECHANGED() ON_XTP_CREATECOMMANDBAR() ON_XTP_CREATECONTROL() ON_UPDATE_COMMAND_UI(IDR_OPTIONS, OnUpdateCombo) ON_UPDATE_COMMAND_UI(IDR_COMBOBOX, OnUpdateCombo) ON_XTP_EXECUTE(IDR_COMBOBOX, OnCombo) ON_COMMAND(ID_STYLES_CHANGE, OnStylesChange) ON_COMMAND(ID_SHAPES, OnStylesChange) ON_COMMAND(ID_ACTIONSAMPLE, OnActionSample) ON_COMMAND(ID_SAMPLES_REBAR, OnReBarSample) ON_COMMAND(ID_SAMPLES_CONTROLS, OnControlsSample) ON_COMMAND(ID_SAMPLES_CUSTOMTHEMES, OnCustomThemesSample) ON_COMMAND(ID_SAMPLES_DIALOG, OnDialogSample) ON_COMMAND(ID_SAMPLES_TABS, OnTabbedToolbarSample) ON_XTP_EXECUTE(ID_GALLERY_STYLESET, OnGalleryStyleSet) ON_UPDATE_COMMAND_UI(ID_GALLERY_STYLESET, OnUpdateGalleryStyleSet) ON_XTP_EXECUTE(ID_GALLERY_STYLES, OnGalleryStyles) ON_UPDATE_COMMAND_UI(ID_GALLERY_STYLES, OnUpdateGalleryStyles) ON_UPDATE_COMMAND_UI(ID_OPTIONS_RIGHTTOLEFT, OnUpdateOptionsRighttoleft) ON_COMMAND(ID_OPTIONS_RIGHTTOLEFT, OnOptionsRightToLeft) ON_COMMAND(XTP_ID_CUSTOMIZE, OnCustomize) ON_COMMAND(ID_TOOLS_CUSTOMIZE, OnCustomize) ON_XTP_EXECUTE(ID_GALLERY_SHAPES, OnGalleryShapes) ON_UPDATE_COMMAND_UI(ID_GALLERY_SHAPES, OnUpdateGalleryShapes) // Font ON_COMMAND_RANGE(ID_OPTIONS_FONT_SYSTEM, ID_OPTIONS_FONT_EXTRALARGE, OnOptionsFont) ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FONT_SYSTEM, ID_OPTIONS_FONT_EXTRALARGE, OnUpdateOptionsFont) ON_UPDATE_COMMAND_UI(ID_OPTIONS_ANIMATION, OnUpdateOptionsAnimation) ON_COMMAND(ID_OPTIONS_ANIMATION, OnOptionsAnimation) ON_COMMAND(ID_OPTIONS_FRAMETHEME, OnFrameTheme) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FRAMETHEME, OnUpdateFrameTheme) ON_COMMAND(ID_OPTIONS_FONT_AUTORESIZEICONS, OnAutoResizeIcons) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FONT_AUTORESIZEICONS, OnUpdateAutoResizeIcons) ON_COMMAND(ID_OPTIONS_DPI_ICON_SCALING, OnDpiIconsScaling) ON_UPDATE_COMMAND_UI(ID_OPTIONS_DPI_ICON_SCALING, OnUpdateDpiIconsScaling) ON_COMMAND_RANGE(ID_OPTIONS_STYLE_VS_2015_CLOSED, ID_OPTIONS_STYLE_VS_2015_DEBUG, OnOptionsStyleVisualStudio) ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_STYLE_VS_2015_CLOSED, ID_OPTIONS_STYLE_VS_2015_DEBUG, OnUpdateOptionsStyleVisualStudio) ON_COMMAND_RANGE(ID_SWITCH_PRINTLAYOUT, ID_SWITCH_WEBLAYOUT, OnIndicatorButton) ON_UPDATE_COMMAND_UI_RANGE(ID_SWITCH_PRINTLAYOUT, ID_SWITCH_WEBLAYOUT, OnUpdateIndicatorButton) //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT uHideCmds[] = { ID_FILE_CLOSE, ID_FILE_SAVE, ID_FILE_SAVE_AS, ID_FILE_PRINT, ID_FILE_PRINT_PREVIEW, ID_FILE_PRINT_SETUP, ID_EDIT_CUT, ID_EDIT_COPY, ID_EDIT_PASTE, ID_EDIT_FIND }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { m_bCreated = FALSE; // TODO: add member initialization code here TCHAR szStylesPath[_MAX_PATH]; VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szStylesPath, _MAX_PATH)); CString csStylesPath(szStylesPath); int nIndex = csStylesPath.ReverseFind(_T('\\')); if (nIndex > 0) { csStylesPath = csStylesPath.Left(nIndex); } else { csStylesPath.Empty(); } m_csStylesPath += csStylesPath + _T("\\Styles\\"); m_pItemsStyles = 0; m_pItemsStyleSet = 0; m_pItemsFontFace = 0; m_pItemsFontSize = 0; m_pItemsFontBackColor = 0; m_pItemsFontTextColor = 0; m_Theme = xtpThemeDlgNativeWindows; m_pActionFrame = 0; m_pReBarsFrame = 0; m_pControlsFrame = 0; m_pCustomThemeFrame = 0; m_pTabbedToolbarFrame = 0; m_nVs2015Style = ID_OPTIONS_STYLE_VS_2015_CLOSED; m_nPaneID = 0; } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!InitCommandBars()) return -1; if (!CreateStatusBar()) return -1; CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); pMenuBar->SetFlags(xtpFlagAddMDISysPopup); CreateGalleries(); CXTPToolBar* pStandardBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pStandardBar || !pStandardBar->LoadToolBar(IDR_MAINFRAME, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } CXTPImageManager* pImgMgr = pCommandBars->GetImageManager(); if (pImgMgr) { pImgMgr->RemoveAll(); CString type(_T("RT_XAML")); // resource type UINT nWidth = 0; 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_OPEN_FILLED, ID_FILE_OPEN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_SAVE_FILLED, ID_FILE_SAVE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_SAVE_AS_FILLED, 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_BLANK, ID_EDIT_PASTE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_COMMAND_UNDO_2, ID_EDIT_UNDO, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_COMMAND_REDO_2, 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_BUTTON_HELP, ID_APP_ABOUT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_BOLD, ID_FONT_BOLD, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_ITALIC, ID_FONT_ITALIC, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_UNDERLINE, ID_FONT_UNDERLINE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_STRIKETHROUGH, ID_FONT_STRIKETHROUGH, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_SUPERSCRIPT, ID_FONT_SUPERSCRIPT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_SUBSCRIPT, ID_FONT_SUBSCRIPT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_SIZE_INCREASE, ID_FONT_INCREASE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_CHARACTER_SIZE_DECREASE, ID_FONT_DECREASE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_ALIGN_LEFT, ID_PARAGRAPH_LEFT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_ALIGN_CENTER, ID_PARAGRAPH_CENTER, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_ALIGN_RIGHT, ID_PARAGRAPH_RIGHT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_ALIGN_JUSTIFIED, ID_PARAGRAPH_JUSTIFY, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_SPACING, ID_PARAGRAPH_LINESPACING, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_LIST_BULLETS, ID_PARAGRAPH_BULLET, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_LIST_NUMBERS, ID_PARAGRAPH_NUMBERING, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_LIST_MULTILEVEL, ID_PARAGRAPH_LIST, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_INDENT_LEFT, ID_PARAGRAPH_INCREASEINDENT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PARAGRAPH_INDENT_RIGHT, ID_PARAGRAPH_DECREASEINDENT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_ERASER, ID_FONT_CLEAR, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_TABLE, ID_INSERT_TABLE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_INSERT_SHAPES_FILLED, ID_SHAPES, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_EXIT, ID_APP_EXIT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_FIND, ID_EDIT_FIND, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_REPLACE, ID_EDIT_REPLACE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_POINTER, ID_EDIT_SELECT_ALL, 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_CLOSE, ID_FILE_CLOSE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_GRID, ID_VIEW_GRID, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_PAGE_SIZE, ID_VIEW_RULER, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_TEXT_WRAPPING, ID_VIEW_WORDWRAP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_LIST_NUMBERS, ID_VIEW_LINENUMBER, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_ZOOM_IN, ID_VIEW_ZOOM_IN, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_ZOOM_OUT, ID_VIEW_ZOOM_OUT, nWidth); nWidth = XTP_DPI_X(32); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_STYLES, ID_STYLES_CHANGE, nWidth); 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_OPEN_FILLED, ID_FILE_OPEN, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_SAVE_FILLED, ID_FILE_SAVE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_SAVE_AS_FILLED, 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_BLANK, ID_EDIT_PASTE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_COMMAND_UNDO_2, ID_EDIT_UNDO, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_COMMAND_REDO_2, 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_BUTTON_HELP, ID_APP_ABOUT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_BOLD, ID_FONT_BOLD, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_ITALIC, ID_FONT_ITALIC, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_UNDERLINE, ID_FONT_UNDERLINE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_STRIKETHROUGH, ID_FONT_STRIKETHROUGH, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_SUPERSCRIPT, ID_FONT_SUPERSCRIPT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_SUBSCRIPT, ID_FONT_SUBSCRIPT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_SIZE_INCREASE, ID_FONT_INCREASE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_CHARACTER_SIZE_DECREASE, ID_FONT_DECREASE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_ALIGN_LEFT, ID_PARAGRAPH_LEFT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_ALIGN_CENTER, ID_PARAGRAPH_CENTER, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_ALIGN_RIGHT, ID_PARAGRAPH_RIGHT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_ALIGN_JUSTIFIED, ID_PARAGRAPH_JUSTIFY, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_SPACING, ID_PARAGRAPH_LINESPACING, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_LIST_BULLETS, ID_PARAGRAPH_BULLET, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_LIST_NUMBERS, ID_PARAGRAPH_NUMBERING, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_LIST_MULTILEVEL, ID_PARAGRAPH_LIST, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_INDENT_LEFT, ID_PARAGRAPH_INCREASEINDENT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PARAGRAPH_INDENT_RIGHT, ID_PARAGRAPH_DECREASEINDENT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_ERASER, ID_FONT_CLEAR, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_TABLE, ID_INSERT_TABLE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_INSERT_SHAPES_FILLED, ID_SHAPES, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_EXIT, ID_APP_EXIT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_FIND, ID_EDIT_FIND, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_REPLACE, ID_EDIT_REPLACE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_POINTER, ID_EDIT_SELECT_ALL, 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_CLOSE, ID_FILE_CLOSE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_GRID, ID_VIEW_GRID, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_PAGE_SIZE, ID_VIEW_RULER, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_TEXT_WRAPPING, ID_VIEW_WORDWRAP, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_LIST_NUMBERS, ID_VIEW_LINENUMBER, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_ZOOM_IN, ID_VIEW_ZOOM_IN, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_ZOOM_OUT, ID_VIEW_ZOOM_OUT, nWidth, xtpImageDisabled); nWidth = XTP_DPI_X(32); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_STYLES, ID_STYLES_CHANGE, nWidth, xtpImageDisabled); } const int nIconsCount = 188; UINT* uiOffice2013 = new UINT[nIconsCount]; ::ZeroMemory(uiOffice2013, sizeof(UINT) * nIconsCount); uiOffice2013[138] = ID_FONT_HIGHLIGHTCOLOR; uiOffice2013[39] = ID_FONT_COLOR; pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME, uiOffice2013, nIconsCount, CSize(16, 16)); pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME_24, uiOffice2013, nIconsCount, CSize(24, 24)); pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME_32, uiOffice2013, nIconsCount, CSize(32, 32)); pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME_40, uiOffice2013, nIconsCount, CSize(40, 40)); pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME_48, uiOffice2013, nIconsCount, CSize(48, 48)); pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME_64, uiOffice2013, nIconsCount, CSize(64, 64)); delete[] uiOffice2013; pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; UINT switches[] = { ID_SWITCH_PRINTLAYOUT, ID_SWITCH_FULLSCREENREADING, ID_SWITCH_WEBLAYOUT, ID_SWITCH_OUTLINE, ID_SWITCH_DRAFT }; pCommandBars->GetImageManager()->SetIcons(IDB_STATUSBAR_VIEWSWITCH, switches, sizeof(switches) / sizeof(UINT), 0); pCommandBars->GetCommandBarsOptions()->bAlwaysShowFullMenus = FALSE; pCommandBars->HideCommands(uHideCmds, _countof(uHideCmds)); CXTPToolBar* pViewBar = (CXTPToolBar*)pCommandBars->Add(_T("View"), xtpBarTop); if (!pViewBar || !pViewBar->LoadToolBar(IDR_VIEWBAR, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } DockRightOf(pViewBar, pStandardBar); CXTPToolBar* pParagraphBar = (CXTPToolBar*)pCommandBars->Add(_T("Paragraph"), xtpBarTop); if (!pParagraphBar || !pParagraphBar->LoadToolBar(IDR_TOOLBAR_PARAGRAPH, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } DockRightOf(pParagraphBar, pViewBar); CXTPToolBar* pFormatBar = (CXTPToolBar*)pCommandBars->Add(_T("Format"), xtpBarBottom); if (!pFormatBar || !pFormatBar->LoadToolBar(IDR_TOOLBAR_FORMAT, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } pCommandBars->DockCommandBar(pFormatBar, xtpBarTop); CXTPToolBar* pStylesBar = (CXTPToolBar*)pCommandBars->Add(_T("Styles"), xtpBarTop); if (!pStylesBar || !pStylesBar->LoadToolBar(IDR_TOOLBAR_STYLES, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } pStylesBar->SetIconSize(CSize(32, 32)); DockRightOf(pStylesBar, pFormatBar); if (!CreateMiniToolBar()) { TRACE0("Failed to create toolbar\n"); return -1; } if (!CreateMessageBar()) { TRACE0("Failed to create toolbar\n"); return -1; } CXTPDialogBar* pBar = (CXTPDialogBar*)pCommandBars->Add(_T("Styles"), xtpBarLeft, RUNTIME_CLASS(CXTPDialogBar)); pBar->SetBarID(200); pBar->EnableDocking(xtpFlagAlignLeft | xtpFlagAlignRight | xtpFlagFloating | xtpFlagStretched); pBar->ModifyStyle(0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS); m_wndStyles.Create(CStylesDlg::IDD, pBar); m_wndStyles.ShowWindow(SW_SHOW); CXTPClientRect rcStyles(m_wndStyles); pBar->SetWidth(rcStyles.Width()); pBar->SetChild(&m_wndStyles); // exclude unused themes. m_dlgTheme.ExcludeTheme(XTP_EXCLUDE_THEME_CUSTOM | XTP_EXCLUDE_THEME_VISUALSTUDIO2012); // create theme dialog. VERIFY(m_dlgTheme.Create(IDD_THEME_DIALOG, this)); // set startup theme m_dlgTheme.SetTheme(xtpThemeDlgOffice2016, xtpThemeColor2016Colorful, xtpThemeAccentOutlook, xtpThemeRibbonBackUndef, TRUE); // enable auto preview. m_dlgTheme.EnableAutoPreview(TRUE); m_bCreated = TRUE; m_wndClient.Attach(this); return 0; } // Before self destroying destroy all child forms void CMainFrame::OnDestroy() { if (m_pActionFrame) m_pActionFrame->DestroyWindow(); if (m_pReBarsFrame) m_pReBarsFrame->DestroyWindow(); if (m_pControlsFrame) m_pControlsFrame->DestroyWindow(); if (m_pCustomThemeFrame) m_pCustomThemeFrame->DestroyWindow(); if (m_pTabbedToolbarFrame) m_pTabbedToolbarFrame->DestroyWindow(); CMDIFrameWnd::OnDestroy(); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if (!CMDIFrameWnd::PreCreateWindow(cs)) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return TRUE; } XTPPaintTheme GetPaintTheme(int nTheme, int nSubTheme) { switch (nTheme) { case xtpThemeDlgOffice2000: return xtpThemeOffice2000; case xtpThemeDlgOfficeXP: return xtpThemeOfficeXP; case xtpThemeDlgOffice2003: return xtpThemeOffice2003; case xtpThemeDlgOffice2007: return xtpThemeResource; case xtpThemeDlgOffice2010: return xtpThemeResource; case xtpThemeDlgOffice2013: return xtpThemeOffice2013; case xtpThemeDlgOffice2016: return xtpThemeOffice2013; case xtpThemeDlgVisualStudio2012: return (nSubTheme == xtpThemeVisualStudio2012Dark) ? xtpThemeVisualStudio2012Dark : xtpThemeVisualStudio2012Light; case xtpThemeDlgVisualStudio2015: return xtpThemeVisualStudio2015; case xtpThemeDlgVisualStudio2017: return xtpThemeVisualStudio2017; case xtpThemeDlgVisualStudio2019: return xtpThemeVisualStudio2019; case xtpThemeDlgVisualStudio2022: return xtpThemeVisualStudio2022; case xtpThemeDlgNativeWindows: return xtpThemeResource; case xtpThemeDlgNativeWindows10: return xtpThemeNativeWindows10; case xtpThemeDlgNativeWindows11: return xtpThemeNativeWindows11; case xtpThemeDlgVisualStudio6: return xtpThemeVisualStudio6; case xtpThemeDlgVisualStudio2005: return xtpThemeVisualStudio2005; case xtpThemeDlgVisualStudio2008: return xtpThemeVisualStudio2008; case xtpThemeDlgVisualStudio2010: return xtpThemeVisualStudio2010; } return xtpThemeNone; } #ifdef _XTP_INCLUDE_CONTROLS XTPControlTheme GetControlsTheme(int nTheme, int nSubTheme) { switch (nTheme) { case xtpThemeDlgOffice2000: return xtpControlThemeOffice2000; case xtpThemeDlgOfficeXP: return xtpControlThemeOfficeXP; case xtpThemeDlgOffice2003: return xtpControlThemeOffice2003; case xtpThemeDlgOffice2007: return xtpControlThemeResource; case xtpThemeDlgOffice2010: return xtpControlThemeResource; case xtpThemeDlgOffice2013: return xtpControlThemeOffice2013; case xtpThemeDlgOffice2016: return xtpControlThemeOffice2013; case xtpThemeDlgVisualStudio2012: return (nSubTheme == xtpThemeVisualStudio2012Dark) ? xtpControlThemeVisualStudio2012Dark : xtpControlThemeVisualStudio2012Light; case xtpThemeDlgVisualStudio2015: return xtpControlThemeVisualStudio2015; case xtpThemeDlgVisualStudio2017: return xtpControlThemeVisualStudio2017; case xtpThemeDlgVisualStudio2019: return xtpControlThemeVisualStudio2019; case xtpThemeDlgVisualStudio2022: return xtpControlThemeVisualStudio2022; case xtpThemeDlgNativeWindows: return xtpControlThemeResource; case xtpThemeDlgNativeWindows10: return xtpControlThemeNativeWindows10; case xtpThemeDlgNativeWindows11: return xtpControlThemeNativeWindows11; case xtpThemeDlgVisualStudio6: return xtpControlThemeDefault; case xtpThemeDlgVisualStudio2005: return xtpControlThemeVisualStudio2005; case xtpThemeDlgVisualStudio2008: return xtpControlThemeVisualStudio2008; case xtpThemeDlgVisualStudio2010: return xtpControlThemeVisualStudio2010; } return xtpControlThemeOffice2000; } #endif void CMainFrame::SetTheme(int nTheme, LPCTSTR lpszINI /*=NULL*/, int nSubTheme /*= 0*/) { GetCommandBars()->EnableFrameTheme(FALSE); // load resource DLL. if (lpszINI != NULL) XTPThemeDLL()->SetHandle(lpszINI); CXTPCommandBars* pCommandBars = GetCommandBars(); _ASSERTE(pCommandBars != NULL); if (!pCommandBars) return; CXTPPaintManager::SetTheme(GetPaintTheme(nTheme, nSubTheme)); pCommandBars->SetAllCaps( nTheme == xtpThemeDlgOffice2013 || nTheme == xtpThemeDlgVisualStudio2015 || nTheme == xtpThemeDlgVisualStudio2017 || nTheme == xtpThemeDlgVisualStudio2019 || nTheme == xtpThemeDlgVisualStudio2022); pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; pCommandBars->GetPaintManager()->m_bEnableAnimation = TRUE; if (nTheme >= xtpThemeDlgOffice2013) { pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipOffice2013); } else { pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipResource); } switch (nTheme) { case xtpThemeDlgOfficeXP: case xtpThemeDlgOffice2007: case xtpThemeDlgOffice2010: case xtpThemeDlgOffice2013: case xtpThemeDlgOffice2016: case xtpThemeDlgVisualStudio2012: case xtpThemeDlgVisualStudio2015: case xtpThemeDlgVisualStudio2017: case xtpThemeDlgVisualStudio2019: case xtpThemeDlgVisualStudio2022: case xtpThemeDlgNativeWindows: case xtpThemeDlgNativeWindows10: case xtpThemeDlgNativeWindows11: CXTPCommandBarsFrameHook::m_bAllowDwm = FALSE; GetCommandBars()->EnableFrameTheme(TRUE); break; default: CXTPCommandBarsFrameHook::m_bAllowDwm = TRUE; GetCommandBars()->EnableFrameTheme(NULL); break; } m_wndStyles.RefreshMetrics(m_Theme); if (m_pActionFrame != NULL) ((CActionSampleFrame*)m_pActionFrame)->RefreshTheme(m_Theme); if (m_pControlsFrame != NULL) ((CControlsSampleFrame*)m_pControlsFrame)->RefreshTheme(m_Theme); if (m_pTabbedToolbarFrame != NULL) ((CTabbedToolbarSampleFrame*)m_pTabbedToolbarFrame)->RefreshTheme(m_Theme); if (m_Theme == xtpThemeDlgVisualStudio2015 || m_Theme == xtpThemeDlgVisualStudio2017 || m_Theme == xtpThemeDlgVisualStudio2019 || m_Theme == xtpThemeDlgVisualStudio2022) OnOptionsStyleVisualStudio(m_nVs2015Style); pCommandBars->GetPaintManager()->RefreshMetrics(); pCommandBars->GetImageManager()->RefreshAll(); pCommandBars->RedrawCommandBars(); #ifdef _XTP_INCLUDE_CONTROLS SendMessageToDescendants(WM_XTP_SETCONTROLTHEME, GetControlsTheme(nTheme, nSubTheme), 0); #endif if (m_bCreated) { UpdateMDIChildrenTheme(); } SendMessage(WM_NCPAINT); RedrawWindow(0, 0, RDW_ALLCHILDREN | RDW_INVALIDATE); } void CMainFrame::OnThemeSelectTheme() { m_dlgTheme.ShowWindow(SW_SHOW); } LRESULT CMainFrame::OnThemeChanged(WPARAM wParam, LPARAM lParam) { THEME_COLOR* pThemeColor = reinterpret_cast(lParam); int nTheme = pThemeColor->nTheme; int nColor = pThemeColor->nColor; int nAccent = pThemeColor->nAccent; m_Theme = (XTPThemeDlg)nTheme; XTPGetApplication()->SetAmbientProperty(xtpApplicationAccentColor, static_cast(pThemeColor->nAccent)); XTPGetApplication()->SetAmbientProperty(xtpApplicationUseSystemAccentColor, static_cast(pThemeColor->bUseSystemAccent)); switch (nTheme) { case xtpThemeDlgOffice2000: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgOfficeXP: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgOffice2003: SetTheme(nTheme, xtpIniOffice2010Blue); break; case xtpThemeDlgOffice2007: { switch (nColor) { case xtpThemeColor2007Blue: SetTheme(nTheme, xtpIniOffice2007Blue); break; case xtpThemeColor2007Silver: SetTheme(nTheme, xtpIniOffice2007Silver); break; case xtpThemeColor2007Black: SetTheme(nTheme, xtpIniOffice2007Black); break; case xtpThemeColor2007Aqua: SetTheme(nTheme, xtpIniOffice2007Aqua); break; case xtpThemeColor2007System: SetTheme(xtpThemeDlgOfficeXP, _T("")); break; } } break; case xtpThemeDlgOffice2010: { switch (nColor) { case xtpThemeColor2010Blue: SetTheme(nTheme, xtpIniOffice2010Blue); break; case xtpThemeColor2010Silver: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeColor2010Black: SetTheme(nTheme, xtpIniOffice2010Black); break; } } break; case xtpThemeDlgOffice2013: { switch (nColor) { case xtpThemeColor2013White: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2013Access); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2013Excel); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2013OneNote); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2013Outlook); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2013PowerPoint); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2013Publisher); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2013Word); break; } } break; case xtpThemeColor2013GrayLight: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2013AccessGrayLight); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2013ExcelGrayLight); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2013OneNoteGrayLight); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2013OutlookGrayLight); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2013PowerPointGrayLight); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2013PublisherGrayLight); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2013WordGrayLight); break; } } break; case xtpThemeColor2013GrayDark: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2013AccessGrayDark); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2013ExcelGrayDark); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2013OneNoteGrayDark); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2013OutlookGrayDark); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2013PowerPointGrayDark); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2013PublisherGrayDark); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2013WordGrayDark); break; } } break; } } break; case xtpThemeDlgOffice2016: { switch (nColor) { case xtpThemeColor2016Black: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2016AccessBlack); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2016ExcelBlack); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2016OneNoteBlack); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2016OutlookBlack); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2016PowerPointBlack); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2016PublisherBlack); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2016WordBlack); break; } } break; case xtpThemeColor2016White: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2016AccessWhite); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2016ExcelWhite); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2016OneNoteWhite); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2016OutlookWhite); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2016PowerPointWhite); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2016PublisherWhite); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2016WordWhite); break; } } break; case xtpThemeColor2016Colorful: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2016AccessColorful); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2016ExcelColorful); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2016OneNoteColorful); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2016OutlookColorful); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2016PowerPointColorful); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2016PublisherColorful); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2016WordColorful); break; } } break; case xtpThemeColor2016GrayDark: { switch (nAccent) { case xtpThemeAccentAccess: SetTheme(nTheme, xtpIniOffice2016AccessDarkGray); break; case xtpThemeAccentExcel: SetTheme(nTheme, xtpIniOffice2016ExcelDarkGray); break; case xtpThemeAccentOneNote: SetTheme(nTheme, xtpIniOffice2016OneNoteDarkGray); break; case xtpThemeAccentOutlook: SetTheme(nTheme, xtpIniOffice2016OutlookDarkGray); break; case xtpThemeAccentPowerPoint: SetTheme(nTheme, xtpIniOffice2016PowerPointDarkGray); break; case xtpThemeAccentPublisher: SetTheme(nTheme, xtpIniOffice2016PublisherDarkGray); break; case xtpThemeAccentWord: SetTheme(nTheme, xtpIniOffice2016WordDarkGray); break; } } break; } } break; case xtpThemeDlgVisualStudio2015: { switch (nColor) { case xtpThemeColor2015Blue: SetTheme(nTheme, xtpIniVisualStudio2015Blue); break; case xtpThemeColor2015Dark: SetTheme(nTheme, xtpIniVisualStudio2015Dark); break; case xtpThemeColor2015Light: SetTheme(nTheme, xtpIniVisualStudio2015Light); break; } } break; case xtpThemeDlgVisualStudio2017: { switch (nColor) { case xtpThemeColor2017Blue: SetTheme(nTheme, xtpIniVisualStudio2017Blue); break; case xtpThemeColor2017BlueExtra: SetTheme(nTheme, xtpIniVisualStudio2017BlueExtra); break; case xtpThemeColor2017Dark: SetTheme(nTheme, xtpIniVisualStudio2017Dark); break; case xtpThemeColor2017Light: SetTheme(nTheme, xtpIniVisualStudio2017Light); break; } } break; case xtpThemeDlgVisualStudio2019: { switch (nColor) { case xtpThemeColor2019Blue: SetTheme(nTheme, xtpIniVisualStudio2019Blue); break; case xtpThemeColor2019BlueExtra: SetTheme(nTheme, xtpIniVisualStudio2019BlueExtra); break; case xtpThemeColor2019Dark: SetTheme(nTheme, xtpIniVisualStudio2019Dark); break; case xtpThemeColor2019Light: SetTheme(nTheme, xtpIniVisualStudio2019Light); break; } } break; case xtpThemeDlgVisualStudio2022: { switch (nColor) { case xtpThemeColor2022Blue: SetTheme(nTheme, xtpIniVisualStudio2022Blue); break; case xtpThemeColor2022BlueExtra: SetTheme(nTheme, xtpIniVisualStudio2022BlueExtra); break; case xtpThemeColor2022Dark: SetTheme(nTheme, xtpIniVisualStudio2022Dark); break; case xtpThemeColor2022Light: SetTheme(nTheme, xtpIniVisualStudio2022Light); break; } } break; case xtpThemeDlgNativeWindows: SetTheme(nTheme, xtpIniWindows7Blue); break; case xtpThemeDlgNativeWindows10: { switch (nColor) { case xtpThemeColorWindows10Light: SetTheme(nTheme, xtpIniWindows10Light); break; case xtpThemeColorWindows10Dark: SetTheme(nTheme, xtpIniWindows10Dark); break; } } break; case xtpThemeDlgNativeWindows11: { switch (nColor) { case xtpThemeColorWindows11Light: SetTheme(nTheme, xtpIniWindows11Light); break; case xtpThemeColorWindows11Dark: SetTheme(nTheme, xtpIniWindows11Dark); break; } } break; case xtpThemeDlgVisualStudio6: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgVisualStudio2005: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgVisualStudio2008: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgVisualStudio2010: SetTheme(nTheme, xtpIniOffice2010Silver); break; case xtpThemeDlgVisualStudio2012: { switch (nColor) { case xtpThemeColor2012Light: SetTheme(xtpThemeDlgVisualStudio2012, xtpIniVisualStudio2012Light, xtpThemeVisualStudio2012Light); break; case xtpThemeColor2012Dark: SetTheme(xtpThemeDlgVisualStudio2012, xtpIniVisualStudio2012Dark, xtpThemeVisualStudio2012Dark); break; } } break; } return 0; } int CMainFrame::OnCreateCommandBar(LPCREATEBARSTRUCT lpCreatePopup) { if (lpCreatePopup->bPopup && _tcscmp(lpCreatePopup->lpcstrCaption, _T("Additional Samples")) == 0) { CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(GetCommandBars()); pPopupBar->SetTearOffPopup(_T("Additional Samples Bar"), 1000); lpCreatePopup->pCommandBar = pPopupBar; return TRUE; } return FALSE; } BOOL CMainFrame::CreateStatusBar() { if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return FALSE; // fail to create } CXTPStatusBarPane* pPane; pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_PAGENUMBER); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(TRUE); pPane->SetCaption(_T("&Page Number")); pPane->SetValue(_T("1 of 1")); pPane->SetText(_T("Page: 1 of 1")); pPane->SetTooltip(_T("Page number in document")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_WORDCOUNT); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(TRUE); pPane->SetCaption(_T("&Word Count")); pPane->SetValue(_T("1")); pPane->SetText(_T("Words: 1")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_LANGUAGE); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(TRUE); pPane->SetCaption(_T("&Language")); pPane->SetValue(_T("English (U.S.)")); pPane->SetText(_T("English (U.S.)")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_TRACKCHANGES); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(TRUE); pPane->SetCaption(_T("&Track Changes")); pPane->SetValue(_T("Off")); pPane->SetText(_T("Track Changes: Off")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_CAPSLOCK); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(TRUE); pPane->ShowBorders(FALSE); pPane->SetCaption(_T("&Caps Lock")); pPane->SetValue(_T("Off")); pPane->SetText(_T("Caps Lock")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_OVERTYPE); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetBeginGroup(FALSE); pPane->SetCaption(_T("&Overtype")); pPane->SetValue(_T("Insert")); pPane->SetText(_T("Insert")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_MACRORECORDING); pPane->SetButton(); pPane->SetPadding(XTP_DPI_X(4), 0, XTP_DPI_X(4), 0); pPane->SetBeginGroup(FALSE); pPane->SetCaption(_T("&Macro Recording")); pPane->SetValue(_T("Not Recording")); CXTPStatusBarProgressPane* pProgressPane = (CXTPStatusBarProgressPane*)m_wndStatusBar.AddIndicator(new CXTPStatusBarProgressPane(), ID_INDICATOR_PROGRESS); pProgressPane->SetBeginGroup(FALSE); pProgressPane->SetCaption(_T("&ProgressBar")); pProgressPane->SetWidth(XTP_DPI_X(100)); pProgressPane->SetPos(30); pProgressPane->SetPadding(XTP_DPI_X(3), 0, XTP_DPI_X(3), 0); pProgressPane->SetVisible(FALSE); pPane = m_wndStatusBar.AddIndicator(0); pPane->SetWidth(1); pPane->SetStyle(SBPS_STRETCH | SBPS_NOBORDERS); pPane->SetBeginGroup(TRUE); static UINT switches[] = { ID_SWITCH_PRINTLAYOUT, ID_SWITCH_FULLSCREENREADING, ID_SWITCH_WEBLAYOUT, }; CXTPStatusBarSwitchPane* pSwitchPane = (CXTPStatusBarSwitchPane*)m_wndStatusBar.AddIndicator( new CXTPStatusBarSwitchPane(), ID_INDICATOR_VIEWSHORTCUTS); pSwitchPane->SetDark(); pSwitchPane->SetSwitches(switches, sizeof(switches) / sizeof(UINT)); pSwitchPane->SetChecked(ID_SWITCH_PRINTLAYOUT); pSwitchPane->SetBeginGroup(TRUE); pSwitchPane->SetCaption(_T("&View Shortcuts")); pPane = m_wndStatusBar.AddIndicator(ID_INDICATOR_ZOOM); pPane->SetDark(); pPane->SetText(_T("100%")); pPane->SetButton(); pPane->SetTextAlignment(DT_CENTER); pPane->SetPadding(XTP_DPI_X(8), 0, XTP_DPI_X(8), 0); pPane->SetWidth(pPane->GetBestFit()); pPane->SetTooltip(_T("Zoom level. Click to open the Zoom dialog box.")); pPane->SetCaption(_T("&Zoom")); pPane->SetBeginGroup(FALSE); CXTPStatusBarSliderPane* pZoomPane = (CXTPStatusBarSliderPane*)m_wndStatusBar.AddIndicator( new CXTPStatusBarSliderPane(), ID_INDICATOR_ZOOMSLIDER); pZoomPane->SetDark(); pZoomPane->SetBeginGroup(FALSE); pZoomPane->SetWidth(XTP_DPI_X(130)); pZoomPane->SetPos(500); // We will convert 0 -> 10%, 500 -> 100 %, 1000 -> 500 % pZoomPane->SetRange(0, 1000); pZoomPane->SetCaption(_T("&Zoom Slider")); pZoomPane->SetTooltip(_T("Zoom")); pZoomPane->SetTooltipPart(XTP_HTSCROLLUP, _T("Zoom Out")); pZoomPane->SetTooltipPart(XTP_HTSCROLLDOWN, _T("Zoom In")); m_wndStatusBar.SetDrawDisabledText(FALSE); m_wndStatusBar.SetRibbonDividerIndex(pSwitchPane->GetIndex() - 1); m_wndStatusBar.EnableCustomization(); return TRUE; } int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl) { if (lpCreateControl->nID == IDR_OPTIONS) { CXTPControlPopup* pControl = CXTPControlPopup::CreateControlPopup(xtpControlPopup); pControl->SetFlags(xtpFlagRightAlign); CMenu mnuOptions; mnuOptions.LoadMenu(IDR_MENU_OPTIONS); pControl->SetCommandBar(mnuOptions.GetSubMenu(0)); pControl->SetCaption(_T("Options")); lpCreateControl->pControl = pControl; return TRUE; } if (lpCreateControl->nID == ID_APP_ABOUT) { CXTPControlButton* pButton = (CXTPControlButton*)CXTPControlButton::CreateObject(); pButton->SetID(lpCreateControl->nID); pButton->SetFlags(xtpFlagRightAlign); pButton->SetStyle(xtpButtonIcon); lpCreateControl->pControl = pButton; return TRUE; } if (lpCreateControl->nID == IDR_COMBOBOX) { CXTPControlComboBox* pCombo = new CXTPControlComboBox(); pCombo->SetDropDownListStyle(); pCombo->EnableAutoComplete(); pCombo->SetWidth(XTP_DPI_X(145)); pCombo->InsertString(0, _T("Quick Action")); pCombo->InsertString(1, _T("Quick Action #1")); pCombo->InsertString(2, _T("Quick Action #2")); pCombo->SetCurSel(0); pCombo->SetFlags(xtpFlagRightAlign); DWORD style = pCombo->GetEditStyle(); pCombo->SetEditStyle(style | ES_RIGHT); lpCreateControl->pControl = pCombo; return TRUE; } if (lpCreateControl->nID == ID_STYLES_CHANGE) { lpCreateControl->controlType = xtpControlButtonPopup; lpCreateControl->buttonStyle = xtpButtonIconAndCaptionBelow; return TRUE; } if (lpCreateControl->nID == ID_GALLERY_STYLESET) { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(200, 22 * 7 + 2)); pControlGallery->SetResizable(); pControlGallery->ShowLabels(TRUE); pControlGallery->SetItems(m_pItemsStyleSet); lpCreateControl->pControl = pControlGallery; return TRUE; } if (lpCreateControl->nID == ID_GALLERY_STYLES) { if (lpCreateControl->bToolBar) { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(235, 60)); pControlGallery->SetResizable(); pControlGallery->SetItemsMargin(0, 1, 0, 1); pControlGallery->ShowLabels(FALSE); pControlGallery->ShowBorders(TRUE); pControlGallery->SetItems(m_pItemsStyles); CMenu menu; menu.LoadMenu(ID_STYLES_QUICKSTYLES); CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(GetCommandBars()); pPopupBar->LoadMenu(menu.GetSubMenu(0)); pControlGallery->SetCommandBar(pPopupBar); pPopupBar->InternalRelease(); lpCreateControl->pControl = pControlGallery; } else { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetResizable(); pControlGallery->SetControlSize(CSize(235 + 72, 56 * 3)); pControlGallery->SetItems(m_pItemsStyles); lpCreateControl->pControl = pControlGallery; } return TRUE; } if (lpCreateControl->nID == ID_FONT_FACE) { CXTPControlComboBox* pComboFont = new CXTPControlComboBox(); pComboFont->SetDropDownListStyle(); pComboFont->EnableAutoComplete(); pComboFont->SetWidth(XTP_DPI_X(145)); CXTPPopupBar* pPopupBar = CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar( GetCommandBars()); pComboFont->SetCommandBar(pPopupBar); CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(290, 508)); pControlGallery->SetResizable(FALSE, TRUE); pControlGallery->ShowLabels(TRUE); pControlGallery->SetItems(m_pItemsFontFace); pPopupBar->GetControls()->Add(pControlGallery, ID_FONT_FACE_GALLERY); pPopupBar->InternalRelease(); pComboFont->SetCaption(_T("Font")); lpCreateControl->pControl = pComboFont; return TRUE; } if (lpCreateControl->nID == ID_FONT_SIZE) { CXTPControlComboBox* pComboFont = new CXTPControlComboBox(); pComboFont->SetDropDownListStyle(); pComboFont->SetWidth(XTP_DPI_X(45)); CXTPPopupBar* pPopupBar = CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar( GetCommandBars()); pComboFont->SetCommandBar(pPopupBar); CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(42, 16 * 17)); pControlGallery->SetResizable(FALSE, TRUE); pControlGallery->SetItems(m_pItemsFontSize); pPopupBar->GetControls()->Add(pControlGallery, ID_FONT_SIZE_GALLERY); pPopupBar->InternalRelease(); pComboFont->SetCaption(_T("Size")); lpCreateControl->pControl = pComboFont; return TRUE; } if (lpCreateControl->nID == ID_FONT_HIGHLIGHTCOLOR) { CXTPControlPopupColor* pPopupColor = new CXTPControlPopupColor(); CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupBar::CreatePopupBar(GetCommandBars()); CMenu menu; menu.LoadMenu(ID_GALLERY_FONTBACKCOLOR); pColorBar->LoadMenu(menu.GetSubMenu(0)); pPopupColor->SetCommandBar(pColorBar); pColorBar->EnableCustomization(FALSE); pColorBar->InternalRelease(); pPopupColor->SetFlags(xtpFlagWrapRow); lpCreateControl->pControl = pPopupColor; return TRUE; } if (lpCreateControl->nID == ID_GALLERY_FONTBACKCOLOR) { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(30 * 5, 30 * 3 + 2)); pControlGallery->ShowScrollBar(FALSE); pControlGallery->SetItems(m_pItemsFontBackColor); lpCreateControl->pControl = pControlGallery; return TRUE; } if (lpCreateControl->nID == ID_FONT_COLOR) { CXTPControlPopupColor* pPopupColor = new CXTPControlPopupColor(); CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupBar::CreatePopupBar(GetCommandBars()); CMenu menu; menu.LoadMenu(ID_FONT_COLOR_GALLERY); pColorBar->LoadMenu(menu.GetSubMenu(0)); pPopupColor->SetCommandBar(pColorBar); pColorBar->EnableCustomization(FALSE); pColorBar->InternalRelease(); lpCreateControl->pControl = pPopupColor; return TRUE; } if (lpCreateControl->nID == ID_FONT_COLOR_GALLERY) { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->ShowLabels(TRUE); pControlGallery->ShowScrollBar(FALSE); pControlGallery->SetItems(m_pItemsFontTextColor); pControlGallery->SetControlSize(7, 10, XTP_DPI(CSize(17, 17))); lpCreateControl->pControl = pControlGallery; return TRUE; } if (lpCreateControl->nID == ID_INSERT_TABLE) { CXTPControlPopup* pButtonTable = CXTPControlPopup::CreateControlPopup(xtpControlPopup); pButtonTable->SetStyle(xtpButtonIcon); CXTPPopupToolBar* pTableBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pTableBar->EnableCustomization(FALSE); pTableBar->SetBorders(XTP_DPI(CRect(2, 2, 2, 2))); pTableBar->DisableShadow(); pTableBar->GetControls()->Add(new CControlTable(), ID_INSERT_TABLE); CXTPControlStatic* pControlTableInfo = (CXTPControlStatic*)pTableBar->GetControls()->Add( new CXTPControlStatic(), ID_INSERT_TABLE); pControlTableInfo->SetFlags(xtpFlagManualUpdate); pButtonTable->SetCommandBar(pTableBar); pTableBar->InternalRelease(); lpCreateControl->pControl = pButtonTable; return TRUE; } if (!lpCreateControl->bToolBar) return FALSE; CXTPToolBar* pToolBar = DYNAMIC_DOWNCAST(CXTPToolBar, lpCreateControl->pCommandBar); if (!pToolBar) return FALSE; if (lpCreateControl->nID == ID_EDIT_UNDO && pToolBar->GetBarID() == IDR_MAINFRAME) { CXTPControlPopup* pButtonUndo = CXTPControlPopup::CreateControlPopup( xtpControlSplitButtonPopup); CXTPPopupToolBar* pUndoBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pUndoBar->EnableCustomization(FALSE); pUndoBar->SetBorders(XTP_DPI(CRect(2, 2, 2, 2))); pUndoBar->DisableShadow(); CXTPControlListBox* pControlListBox = (CXTPControlListBox*)pUndoBar->GetControls()->Add( new CXTPControlListBox(), ID_EDIT_UNDO); pControlListBox->SetWidth(XTP_DPI_X(140)); pControlListBox->SetLinesMinMax(1, 6); pControlListBox->SetMultiplSel(TRUE); CXTPControlStatic* pControlListBoxInfo = (CXTPControlStatic*)pUndoBar->GetControls()->Add(new CXTPControlStatic(), ID_EDIT_UNDO); pControlListBoxInfo->SetWidth(XTP_DPI_X(140)); pButtonUndo->SetCommandBar(pUndoBar); pUndoBar->InternalRelease(); lpCreateControl->pControl = pButtonUndo; return TRUE; } if (lpCreateControl->nID == ID_SHAPES) { CXTPControlPopup* pButton = new CXTPControlPopup(); pButton->SetCaption(_T("Shapes")); pButton->SetStyle(xtpButtonIcon); CXTPPopupBar* pPopupBar = (CXTPPopupBar*)CXTPPopupBar::CreatePopupBar(GetCommandBars()); pButton->SetCommandBar(pPopupBar); CXTPControlGallery* pControlGallery = new CXTPControlGallery(); _ASSERTE(pControlGallery); pControlGallery->SetControlSize(CSize(200, 200)); pControlGallery->SetResizable(); pControlGallery->ShowLabels(TRUE); pControlGallery->SetItems(m_pItemsShapes); pPopupBar->GetControls()->Add(pControlGallery, ID_GALLERY_SHAPES); pPopupBar->InternalRelease(); lpCreateControl->pControl = pButton; return TRUE; } if (lpCreateControl->nID == ID_GALLERY_SHAPES) { CXTPControlGallery* pControlGallery = new CXTPControlGallery(); _ASSERTE(pControlGallery); pControlGallery->SetControlSize(CSize(200, 200)); pControlGallery->SetResizable(); pControlGallery->ShowLabels(TRUE); pControlGallery->SetItems(m_pItemsShapes); lpCreateControl->pControl = pControlGallery; return TRUE; } return FALSE; } void CMainFrame::CreateGalleries() { int item = 0; CXTPImageManager* pImgMgr = NULL; CString t(_T("RT_XAML")); UINT w = 0; m_pItemsShapes = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_GALLERY_SHAPES); pImgMgr = m_pItemsShapes->GetImageManager(); w = XTP_DPI_X(16); m_nShape = 0; pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_0, IDR_GALLERY_SHAPES_ITEM_0, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_1, IDR_GALLERY_SHAPES_ITEM_1, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_2, IDR_GALLERY_SHAPES_ITEM_2, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_3, IDR_GALLERY_SHAPES_ITEM_3, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_4, IDR_GALLERY_SHAPES_ITEM_4, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_5, IDR_GALLERY_SHAPES_ITEM_5, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_6, IDR_GALLERY_SHAPES_ITEM_6, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_7, IDR_GALLERY_SHAPES_ITEM_7, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_8, IDR_GALLERY_SHAPES_ITEM_8, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_9, IDR_GALLERY_SHAPES_ITEM_9, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_10, IDR_GALLERY_SHAPES_ITEM_10, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_11, IDR_GALLERY_SHAPES_ITEM_11, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_12, IDR_GALLERY_SHAPES_ITEM_12, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_13, IDR_GALLERY_SHAPES_ITEM_13, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_14, IDR_GALLERY_SHAPES_ITEM_14, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_15, IDR_GALLERY_SHAPES_ITEM_15, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_16, IDR_GALLERY_SHAPES_ITEM_16, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_17, IDR_GALLERY_SHAPES_ITEM_17, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_18, IDR_GALLERY_SHAPES_ITEM_18, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_19, IDR_GALLERY_SHAPES_ITEM_19, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_20, IDR_GALLERY_SHAPES_ITEM_20, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_21, IDR_GALLERY_SHAPES_ITEM_21, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_22, IDR_GALLERY_SHAPES_ITEM_22, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_23, IDR_GALLERY_SHAPES_ITEM_23, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_24, IDR_GALLERY_SHAPES_ITEM_24, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_25, IDR_GALLERY_SHAPES_ITEM_25, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_26, IDR_GALLERY_SHAPES_ITEM_26, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_27, IDR_GALLERY_SHAPES_ITEM_27, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_28, IDR_GALLERY_SHAPES_ITEM_28, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_29, IDR_GALLERY_SHAPES_ITEM_29, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_30, IDR_GALLERY_SHAPES_ITEM_30, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_31, IDR_GALLERY_SHAPES_ITEM_31, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_32, IDR_GALLERY_SHAPES_ITEM_32, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_33, IDR_GALLERY_SHAPES_ITEM_33, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_34, IDR_GALLERY_SHAPES_ITEM_34, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_35, IDR_GALLERY_SHAPES_ITEM_35, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_36, IDR_GALLERY_SHAPES_ITEM_36, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_37, IDR_GALLERY_SHAPES_ITEM_37, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_38, IDR_GALLERY_SHAPES_ITEM_38, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_39, IDR_GALLERY_SHAPES_ITEM_39, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_40, IDR_GALLERY_SHAPES_ITEM_40, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_41, IDR_GALLERY_SHAPES_ITEM_41, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_42, IDR_GALLERY_SHAPES_ITEM_42, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_43, IDR_GALLERY_SHAPES_ITEM_43, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_44, IDR_GALLERY_SHAPES_ITEM_44, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_45, IDR_GALLERY_SHAPES_ITEM_45, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_46, IDR_GALLERY_SHAPES_ITEM_46, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_47, IDR_GALLERY_SHAPES_ITEM_47, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_48, IDR_GALLERY_SHAPES_ITEM_48, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_49, IDR_GALLERY_SHAPES_ITEM_49, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_50, IDR_GALLERY_SHAPES_ITEM_50, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_51, IDR_GALLERY_SHAPES_ITEM_51, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_52, IDR_GALLERY_SHAPES_ITEM_52, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_53, IDR_GALLERY_SHAPES_ITEM_53, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_54, IDR_GALLERY_SHAPES_ITEM_54, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_55, IDR_GALLERY_SHAPES_ITEM_55, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_56, IDR_GALLERY_SHAPES_ITEM_56, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_57, IDR_GALLERY_SHAPES_ITEM_57, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_58, IDR_GALLERY_SHAPES_ITEM_58, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_59, IDR_GALLERY_SHAPES_ITEM_59, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_60, IDR_GALLERY_SHAPES_ITEM_60, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_61, IDR_GALLERY_SHAPES_ITEM_61, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_62, IDR_GALLERY_SHAPES_ITEM_62, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_63, IDR_GALLERY_SHAPES_ITEM_63, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_64, IDR_GALLERY_SHAPES_ITEM_64, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_65, IDR_GALLERY_SHAPES_ITEM_65, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_66, IDR_GALLERY_SHAPES_ITEM_66, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_67, IDR_GALLERY_SHAPES_ITEM_67, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_68, IDR_GALLERY_SHAPES_ITEM_68, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_69, IDR_GALLERY_SHAPES_ITEM_69, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_70, IDR_GALLERY_SHAPES_ITEM_70, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_SHAPES_ITEM_71, IDR_GALLERY_SHAPES_ITEM_71, w); m_pItemsShapes->SetItemSize(CSize(20, 20)); CXTPControlGalleryItem* pItem = m_pItemsShapes->AddLabel(0); pItem->SetCaption(_T("Letters")); for (item = IDR_GALLERY_LETTERS_ITEM_FIRST; item <= IDR_GALLERY_LETTERS_ITEM_LAST; item++) m_pItemsShapes->AddItem(item, item); pItem = m_pItemsShapes->AddLabel(0); pItem->SetCaption(_T("Numbers")); for (item = IDR_GALLERY_NUMBERS_ITEM_FIRST; item <= IDR_GALLERY_NUMBERS_ITEM_LAST; item++) m_pItemsShapes->AddItem(item, item); pItem = m_pItemsShapes->AddLabel(0); pItem->SetCaption(_T("Symbols")); for (item = IDR_GALLERY_SHAPES_ITEM_FIRST; item <= IDR_GALLERY_SHAPES_ITEM_LAST; item++) m_pItemsShapes->AddItem(item, item); m_pItemsStyles = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_GALLERY_STYLES); pImgMgr = m_pItemsStyles->GetImageManager(); w = XTP_DPI_X(64); m_nStyle = 0; pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_0, ID_GALLERY_STYLES_ITEM_0, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_1, ID_GALLERY_STYLES_ITEM_1, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_2, ID_GALLERY_STYLES_ITEM_2, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_3, ID_GALLERY_STYLES_ITEM_3, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_4, ID_GALLERY_STYLES_ITEM_4, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_5, ID_GALLERY_STYLES_ITEM_5, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_6, ID_GALLERY_STYLES_ITEM_6, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_7, ID_GALLERY_STYLES_ITEM_7, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_8, ID_GALLERY_STYLES_ITEM_8, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_9, ID_GALLERY_STYLES_ITEM_9, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_10, ID_GALLERY_STYLES_ITEM_10, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_11, ID_GALLERY_STYLES_ITEM_11, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_12, ID_GALLERY_STYLES_ITEM_12, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_13, ID_GALLERY_STYLES_ITEM_13, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_14, ID_GALLERY_STYLES_ITEM_14, w); pImgMgr->SetVectorIcon(t, IDR_XAML_ICON_GALLERY_STYLES_ITEM_15, ID_GALLERY_STYLES_ITEM_15, w); m_pItemsStyles->SetItemSize(CSize(72, 56)); for (item = ID_GALLERY_STYLES_ITEM_FIRST; item <= ID_GALLERY_STYLES_ITEM_LAST; item++) m_pItemsStyles->AddItem(item, item); m_pItemsStyleSet = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_GALLERY_STYLESET); m_nStyleSet = 0; m_pItemsStyleSet->SetItemSize(CSize(0, 22)); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(0, _T("Classic"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(1, _T("Default"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(2, _T("Distinctive"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(3, _T("Elegant"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(4, _T("Fancy"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(5, _T("Formal"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(6, _T("Manuscript"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(7, _T("Modern"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(8, _T("Simple"))); m_pItemsStyleSet->AddItem(new CGalleryItemStyleSet(9, _T("Traditional"))); m_pItemsFontFace = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_FONT_FACE_GALLERY); m_pItemsFontFace->SetItemSize(CSize(0, 26)); CGalleryItemFontFace::AddFontItems(m_pItemsFontFace); m_pItemsFontSize = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_FONT_SIZE_GALLERY); m_pItemsFontSize->SetItemSize(CSize(0, 17)); m_pItemsFontSize->AddItem(_T("8")); m_pItemsFontSize->AddItem(_T("9")); m_pItemsFontSize->AddItem(_T("10")); m_pItemsFontSize->AddItem(_T("11")); m_pItemsFontSize->AddItem(_T("12")); m_pItemsFontSize->AddItem(_T("14")); m_pItemsFontSize->AddItem(_T("16")); m_pItemsFontSize->AddItem(_T("18")); m_pItemsFontSize->AddItem(_T("20")); m_pItemsFontSize->AddItem(_T("22")); m_pItemsFontSize->AddItem(_T("24")); m_pItemsFontSize->AddItem(_T("26")); m_pItemsFontSize->AddItem(_T("28")); m_pItemsFontSize->AddItem(_T("36")); m_pItemsFontSize->AddItem(_T("48")); m_pItemsFontSize->AddItem(_T("72")); m_pItemsFontBackColor = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_GALLERY_FONTBACKCOLOR); m_pItemsFontBackColor->SetItemSize(CSize(30, 30)); CGalleryItemFontColor::AddStandardBackColors(m_pItemsFontBackColor); m_pItemsFontTextColor = CXTPControlGalleryItems::CreateItems(GetCommandBars(), ID_FONT_COLOR_GALLERY); m_pItemsFontTextColor->SetItemSize(XTP_DPI(CSize(17, 17))); pItem = m_pItemsFontTextColor->AddLabel(0); pItem->SetCaption(_T("Theme Colors")); CGalleryItemFontColor::AddThemeColors(m_pItemsFontTextColor, 0); pItem = m_pItemsFontTextColor->AddLabel(0); pItem->SetCaption(_T("Standard Colors")); CGalleryItemFontColor::AddStandardColors(m_pItemsFontTextColor); } void CMainFrame::OnCombo(NMHDR* pNMHDR, LRESULT* pResult) { REPORT_NOT_IMPLEMENTED(); *pResult = TRUE; // Handled } void CMainFrame::OnGalleryStyles(NMHDR* pNMHDR, LRESULT* pResult) { NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR; CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, tagNMCONTROL->pControl); if (pGallery) { CXTPControlGalleryItem* pItem = pGallery->GetItem(pGallery->GetSelectedItem()); if (pItem) { m_nStyle = pItem->GetID(); REPORT_NOT_IMPLEMENTED(); } *pResult = TRUE; // Handled } } void CMainFrame::OnUpdateGalleryStyles(CCmdUI* pCmdUI) { CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmdUI)); if (pGallery) { pGallery->SetCheckedItem(m_nStyle); } pCmdUI->Enable(TRUE); } void CMainFrame::OnGalleryStyleSet(NMHDR* pNMHDR, LRESULT* pResult) { NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR; CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, tagNMCONTROL->pControl); if (pGallery) { CXTPControlGalleryItem* pItem = pGallery->GetItem(pGallery->GetSelectedItem()); if (pItem) { m_nStyleSet = pItem->GetID(); } *pResult = TRUE; // Handled } } void CMainFrame::OnUpdateGalleryStyleSet(CCmdUI* pCmdUI) { CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmdUI)); if (pGallery) { pGallery->SetCheckedItem(m_nStyleSet); } pCmdUI->Enable(TRUE); } void CMainFrame::OnStylesChange() { // TODO: Add your command handler code here } void CMainFrame::OnUpdateOptionsRighttoleft(CCmdUI* pCmdUI) { if (XTPSystemVersion()->IsLayoutRTLSupported()) { pCmdUI->SetCheck(GetExStyle() & WS_EX_LAYOUTRTL ? TRUE : FALSE); } else { pCmdUI->Enable(FALSE); } } void CMainFrame::OnOptionsRightToLeft() { if (GetExStyle() & WS_EX_LAYOUTRTL) { GetCommandBars()->SetLayoutRTL(FALSE); ModifyStyleEx(WS_EX_LAYOUTRTL, 0); } else { GetCommandBars()->SetLayoutRTL(TRUE); ModifyStyleEx(0, WS_EX_LAYOUTRTL); } RecalcLayout(FALSE); } XTPControlTheme CMainFrame::GetCustomizeDialogTheme() { XTPControlTheme controlTheme = xtpControlThemeDefault; XTPPaintTheme commandBarsTheme = GetCommandBars()->GetPaintManager()->GetCurrentTheme(); switch (commandBarsTheme) { case xtpThemeResource: controlTheme = xtpControlThemeResource; break; case xtpThemeRibbon: controlTheme = xtpControlThemeResource; break; // case xtpThemeOffice2013: case xtpThemeOffice2016: controlTheme = xtpControlThemeOffice2016; break; case xtpThemeVisualStudio2015: controlTheme = xtpControlThemeVisualStudio2015; break; case xtpThemeVisualStudio2017: controlTheme = xtpControlThemeVisualStudio2017; break; case xtpThemeVisualStudio2019: controlTheme = xtpControlThemeVisualStudio2019; break; case xtpThemeVisualStudio2022: controlTheme = xtpControlThemeVisualStudio2022; break; case xtpThemeNativeWindows10: controlTheme = xtpControlThemeNativeWindows10; break; case xtpThemeNativeWindows11: controlTheme = xtpControlThemeNativeWindows11; break; default: controlTheme = xtpControlThemeDefault; break; } return controlTheme; } void CMainFrame::OnCustomize() { CXTPCustomizeSheet cs(GetCommandBars()); cs.SetTheme(GetCustomizeDialogTheme()); CXTPCustomizeOptionsPage pageOptions(&cs); cs.AddPage(&pageOptions); CXTPCustomizeCommandsPage* pCommands = cs.GetCommandsPage(); pCommands->AddCategories(IDR_MAINFRAME); pCommands->InsertAllCommandsCategory(); pCommands->InsertBuiltInMenus(IDR_MAINFRAME); pCommands->InsertNewMenuCategory(); cs.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CMDIFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers void CMainFrame::OnActionSample() { if (m_pActionFrame) { m_pActionFrame->ActivateFrame(); return; } CCreateContext contextT; // if no context specified, generate one from the // currently selected client if possible. contextT.m_pLastView = NULL; contextT.m_pCurrentFrame = NULL; contextT.m_pNewDocTemplate = NULL; contextT.m_pCurrentDoc = NULL; contextT.m_pNewViewClass = RUNTIME_CLASS(CActionSampleView); m_pActionFrame = new CActionSampleFrame(this); ((CActionSampleFrame*)m_pActionFrame)->m_Theme = m_Theme; DWORD dwStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; m_pActionFrame->LoadFrame(IDR_ACTIONSAMPLE, dwStyle, 0, &contextT); m_pActionFrame->InitialUpdateFrame(NULL, TRUE); CActionSampleView* m_pActionSampleView = DYNAMIC_DOWNCAST(CActionSampleView, m_pActionFrame->GetActiveView()); if (m_pActionSampleView) m_pActionSampleView->RefreshMetrics(m_Theme); } void CMainFrame::OnReBarSample() { if (m_pReBarsFrame) { m_pReBarsFrame->ActivateFrame(); return; } CCreateContext contextT; // if no context specified, generate one from the // currently selected client if possible. contextT.m_pLastView = NULL; contextT.m_pCurrentFrame = NULL; contextT.m_pNewDocTemplate = NULL; contextT.m_pCurrentDoc = NULL; contextT.m_pNewViewClass = RUNTIME_CLASS(CRichEditView); m_pReBarsFrame = new CReBarSampleFrame(this); ((CReBarSampleFrame*)m_pReBarsFrame)->m_Theme = m_Theme; DWORD dwStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; m_pReBarsFrame->LoadFrame(IDR_REBARSFRAME, dwStyle, 0, &contextT); m_pReBarsFrame->InitialUpdateFrame(NULL, FALSE); CRect rec; m_pReBarsFrame->GetWindowRect(&rec); m_pReBarsFrame->MoveWindow(rec.left, rec.top, rec.Width() / 2, rec.Height() / 2); m_pReBarsFrame->ShowWindow(SW_SHOW); } void CMainFrame::OnControlsSample() { if (m_pControlsFrame) { m_pControlsFrame->ActivateFrame(); return; } CCreateContext contextT; // if no context specified, generate one from the // currently selected client if possible. contextT.m_pLastView = NULL; contextT.m_pCurrentFrame = NULL; contextT.m_pNewDocTemplate = NULL; contextT.m_pCurrentDoc = NULL; contextT.m_pNewViewClass = RUNTIME_CLASS(CRichEditView); m_pControlsFrame = new CControlsSampleFrame(this); ((CControlsSampleFrame*)m_pControlsFrame)->m_Theme = m_Theme; DWORD dwStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; m_pControlsFrame->LoadFrame(IDR_CONTROLSFRAME, dwStyle, 0, &contextT); m_pControlsFrame->InitialUpdateFrame(NULL, FALSE); CRect rec; m_pControlsFrame->GetWindowRect(&rec); m_pControlsFrame->MoveWindow(rec.left, rec.top, rec.Width() / 2, rec.Height() / 2); m_pControlsFrame->ShowWindow(SW_SHOW); } void CMainFrame::OnCustomThemesSample() { if (m_pCustomThemeFrame) { m_pCustomThemeFrame->ActivateFrame(); return; } CCreateContext contextT; // if no context specified, generate one from the // currently selected client if possible. contextT.m_pLastView = NULL; contextT.m_pCurrentFrame = NULL; contextT.m_pNewDocTemplate = NULL; contextT.m_pCurrentDoc = NULL; contextT.m_pNewViewClass = RUNTIME_CLASS(CRichEditView); m_pCustomThemeFrame = new CCustomThemeSampleFrame(this); DWORD dwStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; m_pCustomThemeFrame->LoadFrame(IDR_CUSTOMTHEMEFRAME, dwStyle, 0, &contextT); m_pCustomThemeFrame->InitialUpdateFrame(NULL, FALSE); CRect rec; m_pCustomThemeFrame->GetWindowRect(&rec); m_pCustomThemeFrame->MoveWindow(rec.left, rec.top, rec.Width() / 2, rec.Height() / 2); m_pCustomThemeFrame->ShowWindow(SW_SHOW); } void CMainFrame::OnDialogSample() { CDialogSampleDlg dlg; dlg.m_Theme = m_Theme; dlg.RefreshMetrics(); dlg.DoModal(); } void CMainFrame::OnTabbedToolbarSample() { if (m_pTabbedToolbarFrame) { m_pTabbedToolbarFrame->ActivateFrame(); return; } CCreateContext contextT; // if no context specified, generate one from the // currently selected client if possible. contextT.m_pLastView = NULL; contextT.m_pCurrentFrame = NULL; contextT.m_pNewDocTemplate = NULL; contextT.m_pCurrentDoc = NULL; contextT.m_pNewViewClass = RUNTIME_CLASS(CTabbedToolbarView); m_pTabbedToolbarFrame = new CTabbedToolbarSampleFrame(this); ((CTabbedToolbarSampleFrame*)m_pTabbedToolbarFrame)->m_Theme = m_Theme; DWORD dwStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE; m_pTabbedToolbarFrame->LoadFrame(IDR_TABBEDTOOLBAR, dwStyle, 0, &contextT); m_pTabbedToolbarFrame->InitialUpdateFrame(NULL, TRUE); CTabbedToolbarView* m_pTabbedToolbarView = DYNAMIC_DOWNCAST(CTabbedToolbarView, m_pTabbedToolbarFrame->GetActiveView()); if (m_pTabbedToolbarView) m_pTabbedToolbarView->RefreshMetrics(m_Theme); } int nFonts[] = { 0, 11, 13, 16 }; void CMainFrame::OnOptionsFont(UINT nID) { int nFontHeight = XTP_DPI_Y(nFonts[nID - ID_OPTIONS_FONT_SYSTEM]); GetCommandBars()->SetFontHeight(nFontHeight); } void CMainFrame::OnUpdateOptionsFont(CCmdUI* pCmdUI) { int nFontHeight = XTP_DPI_Y(nFonts[pCmdUI->m_nID - ID_OPTIONS_FONT_SYSTEM]); pCmdUI->SetCheck(GetCommandBars()->GetFontHeight() == nFontHeight ? TRUE : FALSE); } void CMainFrame::OnOptionsAnimation() { GetCommandBars()->GetPaintManager()->m_bEnableAnimation ^= 1; } void CMainFrame::OnUpdateOptionsAnimation(CCmdUI* pCmdUI) { pCmdUI->SetCheck(GetCommandBars()->GetPaintManager()->m_bEnableAnimation); } void CMainFrame::OnFrameTheme() { BOOL bEnable = GetCommandBars()->IsEnableFrameTheme() ^ 1; GetCommandBars()->EnableFrameTheme(bEnable); } void CMainFrame::OnUpdateFrameTheme(CCmdUI* pCmdUI) { switch (m_Theme) { case xtpThemeDlgOffice2007: case xtpThemeDlgOffice2010: case xtpThemeDlgOffice2013: case xtpThemeDlgOffice2016: case xtpThemeDlgVisualStudio2012: case xtpThemeDlgVisualStudio2015: case xtpThemeDlgVisualStudio2017: case xtpThemeDlgVisualStudio2019: case xtpThemeDlgVisualStudio2022: case xtpThemeDlgNativeWindows10: case xtpThemeDlgNativeWindows11: pCmdUI->Enable(TRUE); break; default: pCmdUI->Enable(FALSE); } pCmdUI->SetCheck(GetCommandBars()->IsEnableFrameTheme()); } void CMainFrame::OnAutoResizeIcons() { GetCommandBars()->GetPaintManager()->m_bAutoResizeIcons ^= 1; GetCommandBars()->RedrawCommandBars(); } void CMainFrame::OnUpdateAutoResizeIcons(CCmdUI* pCmdUI) { pCmdUI->SetCheck(GetCommandBars()->GetPaintManager()->m_bAutoResizeIcons); } void CMainFrame::OnDpiIconsScaling() { CXTPCommandBars* pCommandBars = GetCommandBars(); ASSERT_VALID(pCommandBars); CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions(); ASSERT_VALID(pOptions); pOptions->EnableDpiBitmapScaling(!pOptions->IsDpiBitmapScalingEnabled()); pCommandBars->RedrawCommandBars(); } void CMainFrame::OnUpdateDpiIconsScaling(CCmdUI* pCmdUI) { CXTPCommandBars* pCommandBars = GetCommandBars(); ASSERT_VALID(pCommandBars); CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions(); ASSERT_VALID(pOptions); pCmdUI->SetCheck(pOptions->IsDpiBitmapScalingEnabled()); } void CMainFrame::OnOptionsStyleVisualStudio(UINT nID) { m_nVs2015Style = nID; switch (m_nVs2015Style) { case ID_OPTIONS_STYLE_VS_2015_CLOSED: XTPGetApplication()->SetAmbientProperty(xtpApplicationStateColor, LONG(COLORREF_NULL)); // OR: // XTPSetVSStateColor(GetCommandBars()); break; case ID_OPTIONS_STYLE_VS_2015_OPEN: XTPGetApplication()->SetAmbientProperty(xtpApplicationStateColor, LONG(RGB(0, 122, 204))); // OR: // XTPSetVSStateColor(GetCommandBars(), RGB(0, 122, 204)); break; case ID_OPTIONS_STYLE_VS_2015_DEBUG: XTPGetApplication()->SetAmbientProperty(xtpApplicationStateColor, LONG(RGB(202, 81, 0))); // OR: // XTPSetVSStateColor(GetCommandBars(), RGB(202, 81, 0)); break; } } void CMainFrame::OnUpdateOptionsStyleVisualStudio(CCmdUI* pCmdUI) { if (m_Theme == xtpThemeDlgVisualStudio2015 || m_Theme == xtpThemeDlgVisualStudio2017 || m_Theme == xtpThemeDlgVisualStudio2019 || m_Theme == xtpThemeDlgVisualStudio2022) pCmdUI->Enable(TRUE); else pCmdUI->Enable(FALSE); pCmdUI->SetRadio(pCmdUI->m_nID == m_nVs2015Style); } BOOL CMainFrame::CreateMiniToolBar() { CXTPCommandBars* pCommandBars = GetCommandBars(); ASSERT_VALID(pCommandBars); CXTPMiniToolBar* pMiniToolBar = CXTPMiniToolBar::CreateMiniToolBar(pCommandBars); if (pMiniToolBar) { pMiniToolBar->SetBarID(IDR_MENU_MINITOOLBAR); pMiniToolBar->SetTitle(_T("MiniBar")); CXTPControlComboBox* pComboFont = new CXTPControlComboBox(); if (pComboFont) { pMiniToolBar->GetControls()->Add(pComboFont, ID_FONT_FACE); pComboFont->SetDropDownListStyle(); pComboFont->EnableAutoComplete(); pComboFont->SetWidth(XTP_DPI_X(82)); CXTPPopupBar* pGalleryFont = CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar(pCommandBars); if (pGalleryFont) { pComboFont->SetCommandBar(pGalleryFont); CXTPControlGallery* pControlGallery = new CXTPControlGallery(); if (pControlGallery) { pControlGallery->SetControlSize(CSize(290, 508)); pControlGallery->SetResizable(FALSE, TRUE); pControlGallery->ShowLabels(TRUE); pControlGallery->SetItems(m_pItemsFontFace); pGalleryFont->GetControls()->Add(pControlGallery, ID_FONT_FACE_GALLERY); } pGalleryFont->InternalRelease(); } } CXTPControlComboBox* pComboFontSize = new CXTPControlComboBox(); if (pComboFontSize) { pMiniToolBar->GetControls()->Add(pComboFontSize, ID_FONT_SIZE); pComboFontSize->SetDropDownListStyle(); pComboFontSize->SetWidth(XTP_DPI_X(43)); CXTPPopupBar* pGalleryFontSize = CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar(pCommandBars); if (pGalleryFontSize) { pComboFontSize->SetCommandBar(pGalleryFontSize); CXTPControlGallery* pControlGallery = new CXTPControlGallery(); if (pControlGallery) { pControlGallery->SetControlSize(CSize(42, 16 * 17)); pControlGallery->SetResizable(FALSE, TRUE); pControlGallery->SetItems(m_pItemsFontSize); pGalleryFontSize->GetControls()->Add(pControlGallery, ID_FONT_SIZE_GALLERY); } pGalleryFontSize->InternalRelease(); } } pMiniToolBar->GetControls()->Add(xtpControlButton, ID_FONT_INCREASE); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_FONT_DECREASE); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_FONT_BOLD); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_FONT_ITALIC); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_FONT_UNDERLINE); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_PARAGRAPH_LEFT); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_PARAGRAPH_CENTER); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_PARAGRAPH_RIGHT); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_PARAGRAPH_INCREASEINDENT); pMiniToolBar->GetControls()->Add(xtpControlButton, ID_PARAGRAPH_DECREASEINDENT); pMiniToolBar->GetControls()->CreateOriginalControls(); pMiniToolBar->SetWidth(XTP_DPI_X(23) * 8); CMenu contextMenu; _ASSERTE(contextMenu.LoadMenu(IDR_MENU_CONTEXT)); pCommandBars->GetContextMenus()->Add(IDR_MENU_CONTEXT, _T("Context Menu"), contextMenu.GetSubMenu(0)); pCommandBars->GetContextMenus()->Add(pMiniToolBar); } return TRUE; } void CMainFrame::OnUpdateCombo(CCmdUI* pCmdUI) { pCmdUI->Enable(TRUE); } BOOL CMainFrame::CreateMessageBar() { if (!m_wndMessageBar.Create(GetCommandBars())) return FALSE; m_wndMessageBar.AddButton(SC_CLOSE, NULL, _T("Close Message Bar")); m_wndMessageBar.AddButton(XTP_ID_CUSTOMIZE, _T("Options..."), _T("Show more options")); #ifndef _XTP_INCLUDE_MARKUP m_wndMessageBar.SetMessage(_T("SECURITY WARNING. Certain content has been disabled")); #else m_wndMessageBar.EnableMarkup(); m_wndMessageBar.SetMessage( _T("") _T(" ") _T(" SECURITY ") _T("WARNING") _T(" Certain content ") _T("has been disabled.") _T("")); #endif return TRUE; } void CMainFrame::OnGalleryShapes(NMHDR* pNMHDR, LRESULT* pResult) { NMXTPCONTROL* tagNMCONTROL = reinterpret_cast(pNMHDR); CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, tagNMCONTROL->pControl); if (pGallery) { CXTPControlGalleryItem* pItem = pGallery->GetItem(pGallery->GetSelectedItem()); if (pItem) { m_nShape = pItem->GetID(); REPORT_NOT_IMPLEMENTED(); } *pResult = TRUE; // Handled } } void CMainFrame::OnUpdateGalleryShapes(CCmdUI* pCmdUI) { CXTPControlGallery* pGallery = DYNAMIC_DOWNCAST(CXTPControlGallery, CXTPControl::FromUI(pCmdUI)); if (pGallery) { pGallery->SetCheckedItem(m_nShape); } pCmdUI->Enable(TRUE); } void CMainFrame::OnIndicatorButton(UINT nID) { m_nPaneID = nID; REPORT_NOT_IMPLEMENTED(); CXTPStatusBarSwitchPane* pSwitchPane = (CXTPStatusBarSwitchPane*)m_wndStatusBar.FindPane( ID_INDICATOR_VIEWSHORTCUTS); pSwitchPane->SetChecked(nID); }; void CMainFrame::OnUpdateIndicatorButton(CCmdUI* pCmdUI) { pCmdUI->SetCheck(pCmdUI->m_nID == m_nPaneID); };