// ActionSampleFrame.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 "CommandBarsSample.h" #include "MainFrm.h" #include "ActionSampleFrame.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ////////////////////////////////////////////////////////////////////////// // CActionSampleFrame BEGIN_MESSAGE_MAP(CActionSampleFrame, CXTPFrameWnd) //{{AFX_MSG_MAP(CActionSampleFrame) ON_WM_CREATE() ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() void CActionSampleFrame::OnDestroy() { ((CMainFrame*)m_pOwnerFrame)->m_pActionFrame = NULL; CFrameWnd::OnDestroy(); } int CActionSampleFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CXTPFrameWnd::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 } // Initialize the command bars if (!InitCommandBars()) return -1; // Get a pointer to the command bars object. CXTPCommandBars* pCommandBars = GetCommandBars(); if (pCommandBars == NULL) { TRACE0("Failed to create command bars object.\n"); return -1; // fail to create } // Add the menu bar CXTPToolBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_ACTIONSAMPLE); if (pMenuBar == NULL) { TRACE0("Failed to create menu bar.\n"); return -1; // fail to create } pCommandBars->EnableActions(); // Optional: // Add standard actions, if you going to localize them. pCommandBars->GetActions()->Add(XTP_ID_CUSTOMIZE); pCommandBars->GetActions()->Add(XTP_ID_CUSTOMIZE_RESET); pCommandBars->GetActions()->Add(XTP_ID_CUSTOMIZE_ADDORREMOVE); pCommandBars->GetActions()->Add(XTP_ID_TOOLBAR_EXPAND); pCommandBars->GetActions()->Add(XTP_ID_TOOLBAR_HIDE); CXTPToolBar* pStandardBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pStandardBar || !pStandardBar->LoadToolBar(IDR_ACTIONS_TOOLBAR, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; } pCommandBars->GetPaintManager()->m_bAutoResizeIcons = TRUE; pCommandBars->EnableFrameTheme(m_Theme > xtpThemeDlgOffice2003); pStandardBar->EnableAnimation(); return 0; } void CActionSampleFrame::RefreshTheme(XTPThemeDlg nTheme) { m_Theme = nTheme; switch (nTheme) { case xtpThemeDlgOffice2007: case xtpThemeDlgOffice2010: case xtpThemeDlgOffice2013: case xtpThemeDlgOffice2016: case xtpThemeDlgVisualStudio2012: case xtpThemeDlgVisualStudio2015: case xtpThemeDlgVisualStudio2017: case xtpThemeDlgVisualStudio2019: case xtpThemeDlgVisualStudio2022: case xtpThemeDlgNativeWindows: case xtpThemeDlgNativeWindows10: case xtpThemeDlgNativeWindows11: GetCommandBars()->EnableFrameTheme(TRUE); break; default: GetCommandBars()->EnableFrameTheme(NULL); break; } GetCommandBars()->RedrawCommandBars(); m_wndStatusBar.Invalidate(TRUE); } ///////////////////////////////////////////////////////////////////////////// // CActionSampleFrame diagnostics #ifdef _DEBUG void CActionSampleFrame::AssertValid() const { CXTPFrameWnd::AssertValid(); } void CActionSampleFrame::Dump(CDumpContext& dc) const { CXTPFrameWnd::Dump(dc); } #endif //_DEBUG