//------------------------------------------------------------------------// BOOL CBCGPGlobalUtils::IsWndCanFloatMulti (CWnd* pWnd) const { CBCGPControlBar* pBar = NULL; CBCGPMiniFrameWnd* pMiniFrame = DYNAMIC_DOWNCAST (CBCGPMiniFrameWnd, pWnd); if (pMiniFrame != NULL) { pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, pMiniFrame->GetControlBar ()); } else { pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, pWnd); } if (pBar == NULL) { return FALSE; } if (pBar->IsTabbed ()) { CWnd* pParentMiniFrame = pBar->GetParentMiniFrame (); // tabbed bar that is floating in multi miniframe if (pParentMiniFrame != NULL && pParentMiniFrame->IsKindOf (RUNTIME_CLASS (CBCGPMultiMiniFrameWnd))) { return TRUE; } } return ((pBar->GetBarStyle () & CBRS_FLOAT_MULTI) != 0); }
//--------------------------------------------------------------------------------------// void CBCGPDragFrameImpl::Init (CWnd* pDraggedWnd) { ASSERT_VALID (pDraggedWnd); m_pDraggedWnd = pDraggedWnd; CWnd* pDockSite = NULL; if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd))) { CBCGPMiniFrameWnd* pMiniFrame = DYNAMIC_DOWNCAST (CBCGPMiniFrameWnd, m_pDraggedWnd); pDockSite = pMiniFrame->GetParent (); } else if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPControlBar))) { CBCGPControlBar* pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, m_pDraggedWnd); ASSERT_VALID (pBar); CBCGPMiniFrameWnd* pParentMiniFrame = pBar->GetParentMiniFrame (); if (pParentMiniFrame != NULL) { pDockSite = pParentMiniFrame->GetParent (); } else { pDockSite = pBar->GetDockSite (); } } m_pDockManager = globalUtils.GetDockManager (pDockSite); if (globalUtils.m_bDialogApp) { return; } ASSERT(m_pDockManager != NULL); }
//--------------------------------------------------------------------------------------// void CBCGPDragFrameImpl::MoveDragFrame (BOOL bForceMove) { ASSERT_VALID (m_pDraggedWnd); m_pFinalTargetBar = NULL; if (m_pDraggedWnd == NULL || m_pDockManager == NULL) { return; } if (m_pWndDummy == NULL) { m_pWndDummy = new CBCGPDummyDockingControlBar; m_pWndDummy->CreateEx (0, _T (""), BCGCBProGetTopLevelFrame (m_pDraggedWnd), CRect (0, 0, 0, 0), FALSE, BCGP_DUMMY_WND_ID, WS_CHILD); } CSize szSencitivity = CBCGPDockingControlBar::GetDragSencitivity (); CPoint ptMouse; GetCursorPos (&ptMouse); CPoint ptOffset = ptMouse - m_ptHot; if (abs (ptOffset.x) < szSencitivity.cx && abs (ptOffset.y) < szSencitivity.cy && m_rectDrag.IsRectEmpty () && !bForceMove) { return; } m_bDragStarted = TRUE; m_pDockManager->LockUpdate (TRUE); CRect rectOld = m_rectExpectedDocked.IsRectEmpty () ? m_rectDrag : m_rectExpectedDocked; BOOL bFirstTime = FALSE; if (m_rectDrag.IsRectEmpty ()) { if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd))) { m_pDraggedWnd->GetWindowRect (m_rectDrag); } else if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPControlBar))) { CBCGPControlBar* pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, m_pDraggedWnd); ASSERT_VALID (pBar); m_pDraggedWnd->GetWindowRect (m_rectDrag); // if the bar is docked then the floating rect has to be set to recent floating rect if (pBar->GetParentMiniFrame () == NULL) { m_rectDrag.right = m_rectDrag.left + pBar->m_recentDockInfo.m_rectRecentFloatingRect.Width (); m_rectDrag.bottom = m_rectDrag.top + pBar->m_recentDockInfo.m_rectRecentFloatingRect.Height (); } if (!m_rectDrag.PtInRect (m_ptHot)) { int nOffset = m_rectDrag.left - m_ptHot.x; m_rectDrag.OffsetRect (-nOffset - 5, 0); // offset of mouse pointer // from the drag rect bound } } bFirstTime = TRUE; } BOOL bDrawTab = FALSE; CBCGPDockingControlBar* pOldTargetBar = m_pTargetBar; CRect rectExpected; rectExpected.SetRectEmpty (); CBCGPSmartDockingManager* pSDManager = NULL; BOOL bSDockingIsOn = FALSE; if (m_pDockManager != NULL && (pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL && pSDManager->IsStarted()) { bSDockingIsOn = TRUE; } m_pDockManager->CalcExpectedDockedRect (m_pDraggedWnd, ptMouse, rectExpected, bDrawTab, &m_pTargetBar); if (pOldTargetBar != NULL && m_nInsertedTabID != -1 && (pOldTargetBar != m_pTargetBar || !bDrawTab)) { RemoveTabPreDocking (pOldTargetBar); bFirstTime = TRUE; } BOOL bCanBeAttached = TRUE; if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMiniFrameWnd))) { } else if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPControlBar))) { CBCGPControlBar* pBar = DYNAMIC_DOWNCAST (CBCGPControlBar, m_pDraggedWnd); bCanBeAttached = pBar->CanBeAttached (); } if (m_pTargetBar != NULL && bCanBeAttached) { CBCGPBaseTabbedBar* pTabbedBar = DYNAMIC_DOWNCAST (CBCGPBaseTabbedBar, m_pTargetBar); if (pTabbedBar != NULL && bDrawTab && (pTabbedBar->GetVisibleTabsNum () > 1 && pTabbedBar->IsHideSingleTab () || pTabbedBar->GetVisibleTabsNum () > 0 && !pTabbedBar->IsHideSingleTab ())) { PlaceTabPreDocking (pTabbedBar, bFirstTime); return; } else if (bDrawTab) { if (m_nInsertedTabID != -1) { return; } if (!bFirstTime) { EndDrawDragFrame (FALSE); } DrawFrameTab (m_pTargetBar, FALSE); m_nInsertedTabID = 1; return; } } m_rectDrag.OffsetRect (ptOffset); m_ptHot = ptMouse; m_rectExpectedDocked = rectExpected; int nNewThickness = m_rectExpectedDocked.IsRectEmpty ()? globalData.m_nDragFrameThiknessFloat : globalData.m_nDragFrameThiknessDock; CRect rectDocked; if (m_rectExpectedDocked.IsRectEmpty ()) { if (!m_rectDrag.PtInRect (ptMouse)) { CPoint ptMiddleRect (m_rectDrag.TopLeft ().x + m_rectDrag.Width () / 2, m_rectDrag.top + 5); CPoint ptOffset = ptMouse - ptMiddleRect; m_rectDrag.OffsetRect (ptOffset); } rectDocked = m_rectDrag; } else { rectDocked = m_rectExpectedDocked; } if (!bSDockingIsOn || !m_rectExpectedDocked.IsRectEmpty ()) { DrawDragFrame (rectOld, rectDocked, bFirstTime, nNewThickness, m_nOldThikness); m_nOldThikness = nNewThickness; } }