BOOL CMainFrame::CreateStatusBar() { if (!m_wndStatusBar.Create(this)) { return FALSE; } m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE_OBJECTCOUNT, _T("Object Count: None"), TRUE), _T("Object Count: None")); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE_SELECTEDOBJECTCOUNT, _T("Selected Count: None"), TRUE), _T("Selected Count: None")); { // <Snippet2> CMFCRibbonButtonsGroup* pSBGroup = new CMFCRibbonButtonsGroup; CMFCToolBarImages images; images.SetImageSize(CSize(14, 14)); CMFCToolBarImages hotimages; hotimages.SetImageSize(CSize(14, 14)); if (images.Load(IDB_STATUSBAR_1) && hotimages.Load(IDB_STATUSBAR_2)) { pSBGroup->SetImages(&images, &hotimages, NULL); } pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, _T(""), 0)); pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_SUMMARYINFO, _T(""), 1)); // CMFCRibbonStatusBar m_wndStatusBar m_wndStatusBar.AddExtendedElement(pSBGroup, _T("View Shortcuts")); // </Snippet2> } { CMFCRibbonButtonsGroup* pSBGroup = new CMFCRibbonButtonsGroup; CMFCToolBarImages images; images.SetImageSize(CSize(14, 14)); if (images.Load(IDB_STATUSBAR_2)) { pSBGroup->SetImages(&images, NULL, NULL); } pSBGroup->AddButton(new CMFCRibbonButton(ID_VIEW_GRID, _T(""), 0)); pSBGroup->AddButton(new CMFCRibbonButton(ID_VIEW_SHOWOBJECTS, _T(""), 1)); m_wndStatusBar.AddExtendedElement(pSBGroup, _T("View Shortcuts")); } return TRUE; }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007)); CMDITabInfo mdiTabParams; mdiTabParams.m_bTabIcons = TRUE; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; mdiTabParams.m_bAutoColor = TRUE; EnableMDITabbedGroups (TRUE, mdiTabParams); CDockingManager::SetDockingMode (DT_SMART); m_wndRibbonBar.Create (this); InitRibbon (); 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 } // Load control bar icons: CMFCToolBarImages imagesWorkspace; imagesWorkspace.SetImageSize (CSize (16, 16)); imagesWorkspace.SetTransparentColor (RGB (255, 0, 255)); imagesWorkspace.Load (IDB_WORKSPACE); if (!m_wndWorkSpace.Create (_T("View 1"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_WORKSPACE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Workspace bar\n"); return FALSE; // fail to create } m_wndWorkSpace.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE); if (!m_wndWorkSpace2.Create (_T("View 2"), this, CRect (0, 0, 200, 200), TRUE, ID_VIEW_WORKSPACE2, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create Workspace bar 2\n"); return FALSE; // fail to create } m_wndWorkSpace2.SetIcon (imagesWorkspace.ExtractIcon (1), FALSE); if (!m_wndOutput.Create (_T("Output"), this, CRect (0, 0, 150, 150), TRUE /* Has gripper */, ID_VIEW_OUTPUT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI)) { TRACE0("Failed to create output bar\n"); return -1; // fail to create } m_wndOutput.SetIcon (imagesWorkspace.ExtractIcon (2), FALSE); m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY); m_wndWorkSpace2.EnableDocking(CBRS_ALIGN_ANY); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); EnableAutoHidePanes(CBRS_ALIGN_ANY); DockPane (&m_wndWorkSpace); m_wndWorkSpace2.AttachToTabWnd (&m_wndWorkSpace, DM_STANDARD, FALSE, NULL); DockPane(&m_wndOutput); // Enable windows manager: EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); return 0; }