コード例 #1
0
void CXTPDockingPaneSidePanel::RecalcLayout(BOOL /*bNotify*/)
{
	if (m_bInRecalcLayout)
		return;

	m_bInRecalcLayout = TRUE;

	CXTPDockingPaneManager* pManager = GetDockingPaneManager();
	CWnd* pSite = GetDockingSite();
	CRect rcClient = pManager->GetClientPane()->GetPaneWindowRect();
	pSite->ScreenToClient(rcClient);

	OnSizeParentEx(pManager, pSite, rcClient);

	m_bInRecalcLayout = FALSE;


}
コード例 #2
0
void CXTPDockingPaneSplitterContainer::OnSizeParent(CWnd* pParent, CRect rect, LPVOID lParam)
{
	CXTPDockingPaneManager* pManager = GetDockingPaneManager();
	CXTPDockingPanePaintManager* pPaintManager = pManager->GetPaintManager();

	int nSplitterSize = pPaintManager->m_nSplitterSize;
	int nSplitterIndent = pPaintManager->m_bShowCaption ? pPaintManager->m_nSplitterIndent : 0;

	CXTPDockingPaneBase* pClient = pManager->GetClientPane();


	AFX_SIZEPARENTPARAMS* lpLayout = (AFX_SIZEPARENTPARAMS*)lParam;

	m_pDockingSite = pParent;
	m_rcWindow = rect;

	BOOL bClientPane = !pManager->m_bHideClient;

	// getting list of nonempty panes
	CXTPDockingPaneBaseList lst;
	POSITION pos = GetHeadPosition();
	while (pos)
	{
		CXTPDockingPaneBase* pPane = GetNext(pos);
		if (!pPane->IsEmpty())
			lst.AddTail(pPane);

		if (!bClientPane && pPane->ContainPane(pClient))
			bClientPane = TRUE;

	}

	if (!lst.IsEmpty() && bClientPane && pManager->m_bHideClient)
	{
		pClient->OnSizeParent(pParent, CXTPEmptyRect(), lParam);
	}


	if (lst.GetCount() == 0)
		return;

	if (lst.GetCount() == 1)
	{
		lst.GetHead()->OnSizeParent(pParent, rect, lParam);
		return;
	}

	if (m_bRecalcLayout)
		return;

	m_bRecalcLayout = TRUE;

	//ASSERT(m_lstSpliters.GetCount() == lst.GetCount() - 1);

	int nTotalLength = 0;
	int nLengthAvail = 0;

	_AdjustPanesLength(pManager, lst, rect, m_bHoriz, TRUE, nTotalLength, nLengthAvail);

	pos = lst.GetHeadPosition();
	POSITION posSplitter = m_lstSpliters.GetHeadPosition();

	CRect rcPane(rect);
	while (pos)
	{
		CXTPDockingPaneBase* pPane = lst.GetNext(pos);

		int nLength = -pPane->m_nLength;
		if (pPane->m_nLength > 0)
		{
			nLength = nTotalLength == 0 ? 0 : int((nLengthAvail * pPane->m_nLength) / nTotalLength);

			nTotalLength -= pPane->m_nLength;
			nLengthAvail = max(nLengthAvail - nLength, 0);
		}

		CRect rcSplitter;

		if (m_bHoriz)
		{
			rcPane.right = pos == NULL ? rect.right : rcPane.left + nLength;
			rcSplitter.SetRect(rcPane.right - nSplitterIndent, rect.top, rcPane.right + nSplitterSize + nSplitterIndent, rect.bottom);
		}
		else
		{
			rcPane.bottom = pos == NULL ? rect.bottom : rcPane.top + nLength;
			rcSplitter.SetRect(rect.left, rcPane.bottom - nSplitterIndent, rect.right, rcPane.bottom + nSplitterSize + nSplitterIndent);
		}

		if (lpLayout->hDWP != NULL && posSplitter)
		{
			CXTPDockingPaneSplitterWnd* pSplitter = m_lstSpliters.GetNext(posSplitter);
			if (pSplitter)
			{
				rcSplitter.IntersectRect(rcSplitter, rect);
				pSplitter->SetWindowPos(&CWnd::wndBottom, rcSplitter.left, rcSplitter.top, rcSplitter.Width(), rcSplitter.Height(), 0);
				pSplitter->Invalidate(FALSE);
			}
		}

		pPane->OnSizeParent(pParent, rcPane, lParam);

		if (m_bHoriz)
		{
			rcPane.left = rcPane.right + nSplitterSize;
		}
		else
		{
			rcPane.top = rcPane.bottom + nSplitterSize;
		}
	}

	m_bRecalcLayout = FALSE;
}