コード例 #1
0
CRect CXTPDockingPaneSplitterContainer::_CalculateResultDockingRectSelf(CXTPDockingPaneBase* pPaneI, XTPDockingPaneDirection direction, CXTPDockingPaneBase* pNeighbour)
{
	direction = GetDockingPaneManager()->GetRTLDirection(direction);

	ASSERT(pNeighbour);

	BOOL bAfter = (direction == xtpPaneDockRight || direction == xtpPaneDockBottom);

	// getting list of nonempty panes
	CXTPDockingPaneBaseList lst;
	POSITION posPanes = GetHeadPosition();
	while (posPanes)
	{
		CXTPDockingPaneBase* pPane = GetNext(posPanes);
		if (pPane->IsEmpty() || (pPane == pPaneI))
			continue;

		POSITION pos = lst.AddTail(pPane);

		if (pPane == pNeighbour)
		{
			if (bAfter)
				lst.InsertAfter(pos, pPaneI);
			else
				lst.InsertBefore(pos, pPaneI);
		}
	}

	CRect rcResult = _CalculateResultDockingRect(m_bHoriz, lst, m_rcWindow, pPaneI);

	m_pDockingSite->ClientToScreen(rcResult);

	return rcResult;

}