bool CPromFrame::CreateFileBar(CToolBar& tb, UINT resourceID, const char *title) { if (!tb.Create(this) || !tb.LoadToolBar(resourceID)) { TRACE0("Failed to create toolbar\n"); return false; // fail to create } tb.SetBarStyle(tb.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); if (title) { tb.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); ShowControlBar(&tb,FALSE,FALSE); DockControlBar(&tb); tb.SetWindowText(title); } return true; }
bool CMainFrame::CreateToolbars() { DWORD style = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC; CRect rc(0, 0, 0, 0); for (int iBar = 0; iBar < TOOLBARS; iBar++) { const BAR_INFO& info = m_ToolbarInfo[iBar]; CToolBar *pBar = STATIC_DOWNCAST(CToolBar, GetBarAtOffset(info.Offset)); if (!pBar->CreateEx(this, TBSTYLE_FLAT, style, rc, info.BarID)) return(FALSE); if (!pBar->LoadToolBar(info.BarResID)) return(FALSE); pBar->SetWindowText(LDS(info.CaptionID)); pBar->EnableDocking(CBRS_ALIGN_ANY); if (info.LeftOf) { CControlBar *LeftOf = GetBarAtOffset(info.LeftOf); CWinAppEx::DockControlBarLeftOf(this, pBar, LeftOf); } else DockControlBar(pBar); } return(TRUE); }