INT_PTR CXTPTabManager::PerformToolHitTest(HWND hWnd, CPoint point, TOOLINFO* pTI) const { if (IsMouseLocked()) return -1; int nIndex = -1; CXTPTabManagerNavigateButton* pNavigateButton = HitTestNavigateButton(point, FALSE, &nIndex); if (pNavigateButton) { ASSERT(nIndex != -1); CString strTip = pNavigateButton->GetTooltip(); if (strTip.IsEmpty()) return -1; CXTPToolTipContext::FillInToolInfo(pTI, hWnd, pNavigateButton->GetRect(), nIndex, strTip); return nIndex; } CXTPTabManagerItem* pItem = HitTest(point); if (pItem) { if (GetPaintManager()->m_toolBehaviour == xtpTabToolTipNever) return -1; if (GetPaintManager()->m_toolBehaviour == xtpTabToolTipShrinkedOnly && !pItem->IsItemShrinked()) return -1; CString strTip = GetItemTooltip(pItem); if (strTip.IsEmpty()) return -1; CXTPToolTipContext::FillInToolInfo(pTI, hWnd, pItem->GetRect(), pItem->GetIndex(), strTip, pItem->GetCaption(), strTip); return pItem->GetIndex(); } return -1; }
virtual DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* /*pDataObject*/, DWORD /*dwKeyState*/, CPoint point) { CXTPDockingPaneTabbedContainer* pControl = (CXTPDockingPaneTabbedContainer*)pWnd; ASSERT_VALID(pControl); if (!pControl->GetPaintManager()->m_bSelectOnDragOver) return DROPEFFECT_NONE; if (m_dwDragLastTick != (DWORD)-1 && pControl->GetPaintManager()->m_bSelectOnDragOver == 2) { DWORD dwTick = GetTickCount(); if (point != m_ptDragLastPoint) { m_dwDragLastTick = dwTick; m_ptDragLastPoint = point; } if (dwTick - m_dwDragLastTick > CXTPTabPaintManager::m_nSelectOnDragOverDelay) { m_dwDragLastTick = (DWORD)-1; } } else { CXTPTabManagerItem* pItem = pControl->CXTPTabManager::HitTest(point); if (pItem) { CXTPDockingPane* pPane = pControl->GetItemPane(pItem->GetIndex()); if (pControl->GetSelected() != pPane) { pControl->SelectPane(pPane, FALSE, FALSE); } } else { m_dwDragLastTick = 0; } } return DROPEFFECT_NONE; }
int CXTPDockingPaneTabbedContainer::HitTest(CPoint point) const { CXTPClientRect rc(this); if (IsTitleVisible()) { if (rc.PtInRect(point)) { CXTPDockingPaneBase::GetPaintManager()->AdjustCaptionRect(this, rc); if (!rc.PtInRect(point)) { return DOCKINGPANE_HITCAPTION; } } } if (IsTabsVisible()) { CXTPTabManagerItem* pItem = CXTPTabManager::HitTest(point); return pItem ? pItem->GetIndex() : -1; } return -1; }