void DrawDragRect(Ctrl& q, const DrawDragRectInfo& f) { SystemDraw w; w.Init(Ctrl::GetDesktopSize()); w.Clip(f.clip); /* TODO static int dashes[3][3] = { { 32, 32, 0 }, { 1, 1, 1 }, { 5, 1, 2 }, }; */ DrawDragFrame(w, f.rect1, f.n, f.animation); DrawDragFrame(w, f.rect2, f.n, f.animation); w.End(); }
//--------------------------------------------------------------------------------------// void CBCGPDragFrameImpl::EndDrawDragFrame (BOOL bClearInternalRects) { if (m_pDockManager == NULL) { return; } BOOL bSDockingIsOn = FALSE; CBCGPSmartDockingManager* pSDManager = NULL; if ((pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL && pSDManager->IsStarted()) { bSDockingIsOn = TRUE; pSDManager->HidePlace (); } CRect rectEmpty; rectEmpty.SetRectEmpty (); CRect rectDocked = m_rectExpectedDocked.IsRectEmpty () ? m_rectDrag : m_rectExpectedDocked; // do not draw the final frame (meaning - clear) if it was not drawn because of tab if (m_nInsertedTabID == -1) { if (!bSDockingIsOn) { DrawDragFrame (rectEmpty, rectDocked, 0, m_nOldThikness); } } else { m_bDockToTab = TRUE; } if (bClearInternalRects) { RemoveTabPreDocking (); m_rectExpectedDocked.SetRectEmpty (); m_rectDrag.SetRectEmpty (); m_pFinalTargetBar = m_pTargetBar; m_pTargetBar = NULL; } m_bDragStarted = FALSE; ASSERT (m_pDockManager != NULL); if (!bSDockingIsOn) { m_pDockManager->LockUpdate (FALSE); } }
//--------------------------------------------------------------------------------------// void CBCGPDragFrameImpl::DrawFrameTab (CBCGPDockingControlBar* pTargetBar, BOOL bErase) { CRect rectWnd; pTargetBar->GetWindowRect (rectWnd); CBCGPSmartDockingManager* pSDManager = NULL; BOOL bSDockingIsOn = FALSE; if (m_pDockManager != NULL && (pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL && pSDManager->IsStarted()) { bSDockingIsOn = TRUE; } int nThikness = globalData.m_nDragFrameThiknessDock; CRect rectSmallTab = rectWnd; // to be changed to tab height if (CBCGPTabbedControlBar::m_bTabsAlwaysTop) { rectWnd.top += globalData.GetTextHeight (); rectSmallTab.bottom = rectSmallTab.top + globalData.GetTextHeight (); rectSmallTab.left += 10; rectSmallTab.right = rectSmallTab.left + 40; } else { rectWnd.bottom -= globalData.GetTextHeight (); rectSmallTab.top = rectSmallTab.bottom - globalData.GetTextHeight (); rectSmallTab.left += 10; rectSmallTab.right = rectSmallTab.left + 40; } if (rectSmallTab.right >= rectWnd.right) { rectSmallTab.right = rectWnd.right - nThikness - 4; } CRect rectEmpty; rectEmpty.SetRectEmpty (); CRect rectLine; if (CBCGPTabbedControlBar::m_bTabsAlwaysTop) { rectLine.SetRect (rectSmallTab.left + nThikness, rectSmallTab.bottom - nThikness, rectSmallTab.right - nThikness, rectSmallTab.bottom + nThikness); } else { rectLine.SetRect (rectSmallTab.left + nThikness, rectSmallTab.top - nThikness, rectSmallTab.right - nThikness, rectSmallTab.top + nThikness); } if (bErase) { if (bSDockingIsOn) { pSDManager->HidePlace (); } else { DrawDragFrame (rectEmpty, rectSmallTab, FALSE, nThikness, nThikness); DrawDragFrame (rectEmpty, rectWnd, FALSE, nThikness, nThikness); DrawDragFrame (rectEmpty, rectLine, FALSE, nThikness, nThikness); m_bFrameTabDrawn = FALSE; } } else { if (bSDockingIsOn) { pSDManager->ShowTabbedPlaceAt (&rectWnd, 10, rectSmallTab.Width(), rectSmallTab.Height()); } else { DrawDragFrame (rectEmpty, rectSmallTab, TRUE, nThikness, nThikness); DrawDragFrame (rectEmpty, rectWnd, TRUE, nThikness, nThikness); DrawDragFrame (rectEmpty, rectLine, TRUE, nThikness, nThikness); m_bFrameTabDrawn = TRUE; } } }
//--------------------------------------------------------------------------------------// 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; } }