void CXTPDockingPaneTabbedContainer::RemovePane(CXTPDockingPaneBase* pPane)
{
	ASSERT(pPane->GetContainer() == this);

	POSITION pos = m_lstPanes.Find((CXTPDockingPane*)pPane);
	ASSERT(pos);

	m_lstPanes.RemoveAt(pos);
	OnTabsChanged();

	pPane->SetParentContainer(NULL);

	m_pParentContainer->OnChildContainerChanged(this);

	if (m_lstPanes.IsEmpty())
	{
		if (m_bActive)
		{
			GetDockingPaneManager()->GetSite()->SetFocus();
			m_bActive = FALSE;
			GetDockingPaneManager()->OnActivatePane(FALSE, m_pSelectedPane);
		}
		DestroyWindow();
	}

	m_bDelayRedraw = TRUE;
	GetDockingPaneManager()->RecalcFrameLayout(this, TRUE);

	if (pPane == m_pSelectedPane)
	{
		SelectPane((CXTPDockingPane*)GetLastPane());
	}
}
void CXTPDockingPaneTabbedContainer::InvalidatePane(BOOL bSelectionChanged)
{
	if (!GetSafeHwnd())
		return;

	if (m_pParentContainer == 0)
		return;

	if (m_nLockReposition)
		return;

	m_nLockReposition += 1;
	OnTabsChanged();
	m_nLockReposition -= 1;

	CRect rect = m_rcWindow;
	CXTPDockingPaneBase::GetPaintManager()->AdjustClientRect(this, rect, TRUE);

	if (bSelectionChanged)
	{
		POSITION pos = GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);
			CRect rcPane = m_pSelectedPane == pPane ? rect : CRect(0, 0, 0, 0);
			pPane->OnSizeParent(m_pDockingSite, rcPane, 0);
		}
	}
	Invalidate(FALSE);

	m_pParentContainer->InvalidatePane(bSelectionChanged);
}
Exemple #3
0
LRESULT CTabsDlg::OnTabsClearAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	if (m_textPara)
	{
		m_textPara->ClearAllTabs();
		OnTabsChanged();	// Set para on story
	}

	return 0;
}
void CXTPDockingPaneTabbedContainer::OnSizeParent(CWnd* pParent, CRect rect, LPVOID lParam)
{
	AFX_SIZEPARENTPARAMS* lpLayout = (AFX_SIZEPARENTPARAMS*)lParam;

	ASSERT(!IsEmpty());

	SetDockingSite(pParent);
	m_rcWindow = rect;

	if (lpLayout == 0 || lpLayout->hDWP != NULL)
	{
		CRect rectOld;
		::GetWindowRect(m_hWnd, rectOld);
		HWND hWndParent = ::GetParent(m_hWnd);
		::ScreenToClient(hWndParent, &rectOld.TopLeft());
		::ScreenToClient(hWndParent, &rectOld.BottomRight());
		if (rectOld != rect || m_bDelayRedraw)
		{
			SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, rect.Width(), rect.Height(), 0);
			Invalidate(FALSE);
			m_bDelayRedraw = FALSE;
		}
		else
		{
			SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOACTIVATE);
		}

		m_nLockReposition += 1;
		OnTabsChanged();
		m_nLockReposition -= 1;

		GetPinButton()->SetState(IsHidden() ? xtpPanePinVisible | xtpPanePinPushed: DYNAMIC_DOWNCAST(CXTPDockingPaneMiniWnd, pParent) == 0 ? xtpPanePinVisible : 0);

		CXTPDockingPaneBase::GetPaintManager()->AdjustClientRect(this, rect, TRUE);

		POSITION pos = GetHeadPosition();
		while (pos)
		{
			CXTPDockingPane* pPane = (CXTPDockingPane*)GetNext(pos);

			CRect rcPane = m_pSelectedPane == pPane ? rect : CRect(0, 0, 0, 0);
			pPane->OnSizeParent(pParent, rcPane, lParam);
		}

		if (m_bEnsureSelectedTab)
		{
			m_bEnsureSelectedTab = FALSE;
			EnsureSelectedTabVisible();
		}
	}
}