From: boca4711 <boc...@us...> - 2004-10-11 20:26:12
|
Update of /cvsroot/anyedit/AnyEditToolkit/GuiLib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22132/GuiLib Modified Files: GuiMDIFrame.cpp GuiMDIFrame.h Log Message: Added DockControlBarLeftOf. Dock control bar side by side. Index: GuiMDIFrame.cpp =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiMDIFrame.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiMDIFrame.cpp 2 Oct 2004 13:27:41 -0000 1.2 --- GuiMDIFrame.cpp 11 Oct 2004 20:25:56 -0000 1.3 *************** *** 478,479 **** --- 478,520 ---- return 0; } + + /** Dock control bar side by side. pBar will be aligned left of pLeftOf. + * + * from Cristi Posea www.datamekanix.com + */ + void CGuiMDIFrame::DockControlBarLeftOf(CControlBar* pBar, CControlBar* pLeftOf) + { + ASSERT(pBar != NULL); + ASSERT(pLeftOf != NULL); + ASSERT(pBar != pLeftOf); + + // the neighbour must be already docked + CDockBar* pDockBar = pLeftOf->m_pDockBar; + ASSERT(pDockBar != NULL); + UINT nDockBarID = pLeftOf->m_pDockBar->GetDlgCtrlID(); + ASSERT(nDockBarID != AFX_IDW_DOCKBAR_FLOAT); + + bool bHorz = (nDockBarID == AFX_IDW_DOCKBAR_TOP || + nDockBarID == AFX_IDW_DOCKBAR_BOTTOM); + + // dock normally (inserts a new row) + DockControlBar(pBar, nDockBarID); + + // delete the new row (the bar pointer and the row end mark) + pDockBar->m_arrBars.RemoveAt(pDockBar->m_arrBars.GetSize() - 1); + pDockBar->m_arrBars.RemoveAt(pDockBar->m_arrBars.GetSize() - 1); + + // find the target bar + for (int i = 0; i < pDockBar->m_arrBars.GetSize(); i++) + { + void* p = pDockBar->m_arrBars[i]; + if (p == pLeftOf) // and insert the new bar after it + pDockBar->m_arrBars.InsertAt(i + 1, pBar); + } + + // move the new bar into position + CRect rBar; + pLeftOf->GetWindowRect(rBar); + rBar.OffsetRect(bHorz ? 1 : 0, bHorz ? 0 : 1); + pBar->MoveWindow(rBar); + } Index: GuiMDIFrame.h =================================================================== RCS file: /cvsroot/anyedit/AnyEditToolkit/GuiLib/GuiMDIFrame.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GuiMDIFrame.h 26 Sep 2004 16:11:51 -0000 1.1 --- GuiMDIFrame.h 11 Oct 2004 20:25:56 -0000 1.2 *************** *** 66,69 **** --- 66,70 ---- // Operations public: + void DockControlBarLeftOf(CControlBar* pBar, CControlBar* pLeftOf); virtual void EnableDocking(DWORD dwDockStyle); |