예제 #1
0
DWORD CFrameWnd::CanDock(CRect rect, DWORD dwDockStyle, CDockBar** ppDockBar)
{
	// dwDockStyle -- allowable styles of bar
	// don't allow to dock to floating unless multi is specified
	dwDockStyle &= CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI;

	if (ppDockBar != NULL)
		*ppDockBar = NULL;
	POSITION pos = m_listControlBars.GetHeadPosition();
	while (pos != NULL)
	{
		CDockBar* pDockBar = (CDockBar*)m_listControlBars.GetNext(pos);
		if (pDockBar->IsDockBar() && pDockBar->IsWindowVisible() &&
			(pDockBar->m_dwStyle & dwDockStyle & CBRS_ALIGN_ANY) &&
			(!pDockBar->m_bFloating ||
				(dwDockStyle & pDockBar->m_dwStyle & CBRS_FLOAT_MULTI)))
		{
			CRect rectBar;
			pDockBar->GetWindowRect(&rectBar);
			if (rectBar.Width() == 0)
				rectBar.right++;
			if (rectBar.Height() == 0)
				rectBar.bottom++;
			if (rectBar.IntersectRect(rectBar, rect))
			{
				if (ppDockBar != NULL)
					*ppDockBar = pDockBar;
				return pDockBar->m_dwStyle & dwDockStyle;
			}
		}
	}
	return 0;
}
예제 #2
0
void CGuiControlBar::OnActiveWindow()
{
	POSITION pos = m_pDockSite->m_listControlBars.GetHeadPosition();
	while (pos != NULL)
	{
		CDockBar* pDockBar = (CDockBar*)m_pDockSite->m_listControlBars.GetNext(pos);
		if (pDockBar->IsDockBar() && pDockBar->IsWindowVisible() &&
			(!pDockBar->m_bFloating ))
			{
				int nNumBars=(int)pDockBar->m_arrBars.GetSize();
				for(int i=0; i< nNumBars;i++)
				{
					CGuiControlBar* pBar = (CGuiControlBar*) pDockBar->m_arrBars[i];
					if (HIWORD(pBar) == NULL) continue;
					if (!pBar->IsVisible()) continue;
					if (!pBar->IsKindOf(RUNTIME_CLASS(CGuiControlBar))) continue;
					if (pBar != this)
					{
						pBar->m_bOldActive=FALSE;
						pBar->m_bActive=FALSE;
						pBar->m_bForcepaint=TRUE;
						pBar->SendMessage(WM_NCPAINT);
						pBar->m_bForcepaint=FALSE;
					}
					else
					{
						m_bOldActive=m_bActive;
						m_bActive=TRUE;
						m_bForcepaint=TRUE;
						SendMessage(WM_NCPAINT);
						m_bForcepaint=FALSE;
						

					}
				}
			}
	}
}
예제 #3
0
DWORD CGuiDockContext::CanDock(CRect rect, DWORD dwDockStyle, CDockBar** ppDockBar)
{
	// dwDockStyle -- allowable styles of bar
	// don't allow to dock to floating unless multi is specified
	BOOL bTipoToolBar=m_pBar->IsKindOf(RUNTIME_CLASS( CGuiToolBarWnd)) ||
		              m_pBar->IsKindOf(RUNTIME_CLASS( CMenuBar));
	dwDockStyle &= CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI;
	if (ppDockBar != NULL)
		*ppDockBar = NULL;
	POSITION pos = m_pDockSite->m_listControlBars.GetHeadPosition();
	while (pos != NULL)
	{
		CDockBar* pDockBar = (CDockBar*)m_pDockSite->m_listControlBars.GetNext(pos);
		if (pDockBar->IsDockBar() && pDockBar->IsWindowVisible() &&
			(pDockBar->m_dwStyle & dwDockStyle & CBRS_ALIGN_ANY) &&
			(!pDockBar->m_bFloating ||
				(dwDockStyle & pDockBar->m_dwStyle & CBRS_FLOAT_MULTI)))
		{
		
				int nSize=pDockBar->m_arrBars.GetSize();
				for (int i=0;i <nSize;  i++)
				{
					UINT m_nDockBarID = pDockBar->GetDlgCtrlID();
					CControlBar* pBar;
					 pBar = (CControlBar*) pDockBar->m_arrBars[i];
					 if (HIWORD(pBar) == 0) continue; // placeholder
					 if (!pBar->IsVisible()) continue;
					 CRect rectBar;
					 pBar->GetWindowRect(&rectBar);
					 if (rectBar.Width() == 0)
						rectBar.right++;
					 if (rectBar.Height() == 0)
							rectBar.bottom++;
					 CRect rectBar1;
					 pDockBar->GetWindowRect(&rectBar1);
					 if (dwDockStyle==CBRS_ORIENT_VERT)
					 {
						 if (m_nDockBarID==AFX_IDW_DOCKBAR_LEFT)
					 		rectBar1.right=rectBar1.left+10;
						 if(m_nDockBarID==AFX_IDW_DOCKBAR_RIGHT)
							 rectBar1.left=rectBar1.right-10;
					 }
					 else
					 {

						if (m_nDockBarID==AFX_IDW_DOCKBAR_BOTTOM)
							rectBar1.top=rectBar1.bottom-10;
						if (m_nDockBarID==AFX_IDW_DOCKBAR_TOP)
							rectBar1.bottom=rectBar1.top+10;
						
					 }
					 if (rectBar1.IntersectRect(rectBar1, rect))
					 {
						if (ppDockBar != NULL)
							
							*ppDockBar = pDockBar;
						
						return pDockBar->m_dwStyle & dwDockStyle;
					 }
			

					//***********************************************
					if (rectBar.IntersectRect(rectBar, rect))
					{
							if (bTipoToolBar)
							{
								if (pBar->IsKindOf(RUNTIME_CLASS( CGuiControlBar)))
									return 0;
							}
							if (ppDockBar != NULL)
								*ppDockBar = pDockBar;
							return pDockBar->m_dwStyle & dwDockStyle;
							
						 
							
					}
					 
				}//fin del for
							
		
			CRect rectBar;
			pDockBar->GetWindowRect(&rectBar);
			if (rectBar.Width() == 0)
				rectBar.right++;
			if (rectBar.Height() == 0)
				rectBar.bottom++;
			if (rectBar.IntersectRect(rectBar, rect))
			{
				if (ppDockBar != NULL)
					*ppDockBar = pDockBar;
				return pDockBar->m_dwStyle & dwDockStyle;
			}
		}
	}
	return 0;
}