示例#1
0
void Explorerplusplus::SetTabSelection(int Index)
{
	m_iTabSelectedItem = Index;
	TabCtrl_SetCurSel(m_hTabCtrl,m_iTabSelectedItem);
	OnTabChangeInternal(TRUE);
}
HRESULT _stdcall CContainer::DragOver(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
{
	TCHITTESTINFO HitTestInfo;
	BOOL bOnSameDrive;
	int iTab;

	HitTestInfo.pt.x	= pt.x;
	HitTestInfo.pt.y	= pt.y;

	ScreenToClient(m_hTabCtrl,&HitTestInfo.pt);

	iTab = TabCtrl_HitTest(m_hTabCtrl,&HitTestInfo);

	if(iTab == -1)
	{
		*pdwEffect = DROPEFFECT_NONE;
	}
	else
	{
		TCITEM tcItem;

		tcItem.mask	= TCIF_PARAM;
		TabCtrl_GetItem(m_hTabCtrl,iTab,&tcItem);

		if(iTab != m_iTabSelectedItem)
		{
			/* Set a timer. If the mouse does not move
			outside this tab before the timer expires,
			and the item is still been dragged, switch
			focus to this tab.
			The timer will be set if the tab the item
			is currently above does not match the
			tab it was above initially (when the timer
			was previously set). */
			if(iTab != m_iTabDragTab)
			{
				SetTimer(m_hTabCtrl,TABDRAG_TIMER_ID,TABDRAG_TIMER_ELAPSED,TabDragTimerProc);

				m_iTabDragTab = iTab;
			}
			else if(g_bTabDragTimerElapsed)
			{
				m_iTabSelectedItem = iTab;

				TabCtrl_SetCurSel(m_hTabCtrl,m_iTabSelectedItem);

				OnTabChangeInternal(TRUE);

				g_bTabDragTimerElapsed = FALSE;
			}
		}
		else
		{
			KillTimer(m_hTabCtrl,TABDRAG_TIMER_ID);
			m_iTabDragTab = iTab;
		}

		/* If the tab contains a virtual folder,
		then files cannot be dropped. */
		if(m_pShellBrowser[(int)tcItem.lParam]->InVirtualFolder())
		{
			*pdwEffect = DROPEFFECT_NONE;
		}
		else
		{
			bOnSameDrive = CheckItemLocations((int)tcItem.lParam);

			*pdwEffect = DetermineCurrentDragEffect(grfKeyState,
				*pdwEffect,m_bDataAccept,bOnSameDrive);
		}
	}

	m_pDropTargetHelper->DragOver((LPPOINT)&pt,*pdwEffect);

	return S_OK;
}