// RebarSampleFrame.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 "RebarSampleFrame.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, }; ////////////////////////////////////////////////////////////////////////// // CRebarSampleFrame BEGIN_MESSAGE_MAP(CReBarSampleFrame, CXTPFrameWnd) //{{AFX_MSG_MAP(CReBarSampleFrame) ON_WM_CREATE() ON_WM_DESTROY() ON_COMMAND_RANGE(ID_WEBBROWSER_BACK, ID_GOTO_URL, OnToolbarCommands) ON_XTP_CREATECONTROL() //}}AFX_MSG_MAP END_MESSAGE_MAP() void CReBarSampleFrame::OnDestroy() { ((CMainFrame*)m_pOwnerFrame)->m_pReBarsFrame = NULL; CFrameWnd::OnDestroy(); } int CReBarSampleFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CXTPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // 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 } CXTPToolBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_REBARSFRAME); if (!pMenuBar) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CXTPToolBar* pToolBar = pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pToolBar || !pToolBar->LoadToolBar(IDR_REBAR_MAIN, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CXTPToolBar* pWebBar = pCommandBars->Add(_T("Web"), xtpBarTop); if (!pWebBar || !pWebBar->LoadToolBar(IDR_TOOLBAR_WEB, FALSE)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CXTPImageManager* pImgMgr = pCommandBars->GetImageManager(); if (pImgMgr) { CString type(_T("RT_XAML")); // resource type UINT nWidth = 0; nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_ARROW_LEFT_2, ID_WEBBROWSER_BACK, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_ARROW_RIGHT_2, ID_WEBBROWSER_FORWARD, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_CANCEL, ID_WEBBROWSER_STOP, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_REFRESH, ID_WEBBROWSER_REFRESH, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_HOME, ID_WEBBROWSER_HOME, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_BROWSE, ID_WEBBROWSER_SEARCH, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_STAR, ID_WEBBROWSER_FAVORITES, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_TOOLS, ID_WEBBROWSER_ORGANIZE, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_UPDATE, ID_WEBBROWSER_SYNC, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_ARROW_DOWN_2, ID_WEBBROWSER_PREV, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_INTERNET_ARROW_UP_2, ID_WEBBROWSER_NEXT, nWidth); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_NORMAL_OVERLAYS_FONT_BOLD_INTERNET, ID_WEBBROWSER_FONT, nWidth); nWidth = XTP_DPI_X(16); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_ARROW_LEFT_2, ID_WEBBROWSER_BACK, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_ARROW_RIGHT_2, ID_WEBBROWSER_FORWARD, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_CANCEL, ID_WEBBROWSER_STOP, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_REFRESH, ID_WEBBROWSER_REFRESH, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_HOME, ID_WEBBROWSER_HOME, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_BROWSE, ID_WEBBROWSER_SEARCH, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_STAR, ID_WEBBROWSER_FAVORITES, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_TOOLS, ID_WEBBROWSER_ORGANIZE, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_UPDATE, ID_WEBBROWSER_SYNC, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_ARROW_DOWN_2, ID_WEBBROWSER_PREV, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_INTERNET_ARROW_UP_2, ID_WEBBROWSER_NEXT, nWidth, xtpImageDisabled); pImgMgr->SetVectorIcon(type, IDR_XAML_SMALL_ICON_DISABLED_OVERLAYS_FONT_BOLD_INTERNET, ID_WEBBROWSER_FONT, nWidth, xtpImageDisabled); } if (!m_wndReBar.Create(this) || !m_wndReBar.AddToolBar(pMenuBar) || !m_wndReBar.AddToolBar(pToolBar, RBBS_GRIPPERALWAYS | RBBS_BREAK) || !m_wndReBar.AddToolBar(pWebBar)) { TRACE0("Failed to create rebar\n"); return -1; // fail to create } m_wndStatusBar.SetCommandBars(pCommandBars); // pCommandBars->SetPaintManager(new CXTPCommandBarsNativeXPTheme()); pCommandBars->RedrawCommandBars(); return 0; } void CReBarSampleFrame::OnToolbarCommands(UINT) { } int CReBarSampleFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl) { if (lpCreateControl->bToolBar) { CXTPToolBar* pToolBar = DYNAMIC_DOWNCAST(CXTPToolBar, lpCreateControl->pCommandBar); if (!pToolBar) return FALSE; if (lpCreateControl->nID == ID_GOTO_URL && pToolBar->GetBarID() == IDR_TOOLBAR_WEB) { CXTPControlComboBox* pComboUrl = (CXTPControlComboBox*) CXTPControlComboBox::CreateObject(); pComboUrl->AddString(_T("http://www.codejock.com")); pComboUrl->AddString(_T("ms-help://MS.VSCC/vsccCommon/html/vsccCommon_Start_Page.htm")); pComboUrl->SetWidth(XTP_DPI_X(200)); pComboUrl->SetDropDownWidth(XTP_DPI_X(300)); pComboUrl->SetDropDownListStyle(); pComboUrl->SetFlags(xtpFlagManualUpdate); pComboUrl->SetEditText(_T("http://www.codejock.com")); lpCreateControl->pControl = pComboUrl; return TRUE; } } return FALSE; } ///////////////////////////////////////////////////////////////////////////// // CReBarSampleFrame diagnostics #ifdef _DEBUG void CReBarSampleFrame::AssertValid() const { CXTPFrameWnd::AssertValid(); } void CReBarSampleFrame::Dump(CDumpContext& dc) const { CXTPFrameWnd::Dump(dc); } #endif //_DEBUG