示例#1
0
void CDockBar::RemoveControlBar(CControlBar* pBar, int nPosExclude)
{
	ASSERT_VALID(this);
	ASSERT(pBar != NULL);
	int nPos = FindBar(pBar, nPosExclude);
	ASSERT(nPos > 0);

	m_arrBars.RemoveAt(nPos);

	// remove section indicator (NULL) if nothing else in section
	if (m_arrBars[nPos-1] == NULL && m_arrBars[nPos] == NULL)
		m_arrBars.RemoveAt(nPos);

	// get parent frame for recalc layout/frame destroy
	CFrameWnd* pFrameWnd = GetDockingFrame();
	if (m_bFloating && GetDockedVisibleCount() == 0)
	{
		if (m_arrBars.GetSize() == 1)
			pFrameWnd->DestroyWindow();
		else
			pFrameWnd->ShowWindow(SW_HIDE);
	}
	else
		pFrameWnd->DelayRecalcLayout();
}
示例#2
0
LRESULT CXTPDockBar::OnNcHitTest(CPoint point)
{
	if (GetPosition() == xtpBarTop && m_pCommandBars->GetMenuBar() != NULL && m_pCommandBars->GetMenuBar()->IsRibbonBar() &&
		FindBar(m_pCommandBars->GetMenuBar()) != -1)
	{
		return HTTRANSPARENT;
	}

	return (LRESULT)CWnd::OnNcHitTest(point);
}
示例#3
0
int CXTPDockBar::Insert(CXTPToolBar* pBarIns, CRect /*rect*/, CPoint ptMid)
{
	ASSERT_VALID(this);
	ASSERT(pBarIns != NULL);

	int nPos = 0;
	int nPosInsAfter = 0;
	int nWidth = 0;
	int nTotalWidth = 0;
	//int nPosInsBefore = 0;
	BOOL bHorz = m_dwStyle & CBRS_ORIENT_HORZ;
	BOOL bAllowTopMost = pBarIns->IsRibbonBar() || m_pCommandBars->GetMenuBar() == NULL ||
		!m_pCommandBars->GetMenuBar()->IsRibbonBar() || FindBar(m_pCommandBars->GetMenuBar()) == -1;

	for (nPos = 0; nPos < m_arrBars.GetSize(); nPos++)
	{
		CXTPToolBar* pBar = GetDockedCommandBar(nPos);
		if (pBar && !pBar->IsVisible())
			continue;

		if (pBar != NULL)
		{
			CRect rectBar;
			pBar->GetWindowRect(&rectBar);
			ScreenToClient(&rectBar);
			nWidth = max(nWidth,
				bHorz ? rectBar.bottom : rectBar.right);
		}
		else // end of row because pBar == NULL
		{
			if ((bHorz ? ptMid.y : ptMid.x) < nWidth && (bAllowTopMost || nPosInsAfter > 1))
			{
				if (nPos == 0 || ((bHorz ? ptMid.y : ptMid.x) == nTotalWidth)) // first section
					m_arrBars.InsertAt(nPosInsAfter + 1, (CXTPToolBar*)NULL);
				m_arrBars.InsertAt(nPosInsAfter + 1, pBarIns);

				return nPosInsAfter + 1;
			}
			nTotalWidth = nWidth;
			nWidth = 0;
			nPosInsAfter = nPos;
		}
	}

	// create a new row
	m_arrBars.InsertAt(nPosInsAfter + 1, (CXTPToolBar*)NULL);
	m_arrBars.InsertAt(nPosInsAfter + 1, pBarIns);

	return nPosInsAfter + 1;
}
示例#4
0
BOOL CXTPDockBar::RemoveCommandBar(CXTPToolBar* pBar, int nPosExclude)
{
	ASSERT_VALID(this);
	ASSERT(pBar != NULL);
	if (!pBar)
		return FALSE;

	int nPos = FindBar(pBar, nPosExclude);
	ASSERT(nPos > 0);
	if (nPos <= 0)
		return FALSE;

	m_arrBars.RemoveAt(nPos);
	if (m_arrBars[nPos-1] == NULL && m_arrBars[nPos] == NULL)
		m_arrBars.RemoveAt(nPos);

	pBar->m_pDockBar = NULL;

	// get parent frame for recalc layout/frame destroy
	m_pCommandBars->RecalcFrameLayout(TRUE);

	return TRUE;
}