Exemplo n.º 1
0
void CUploadsCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	CSingleLock pLock( &Transfers.m_pSection, TRUE );
	CUploadFile* pFile;
	CUploadQueue* pQueue;
	CRect rcItem;
	
	SetFocus();
	
	if ( HitTest( point, &pQueue, &pFile, NULL, &rcItem ) )
	{
		int nTitleStarts = GetExpandableColumnX();
		if ( pQueue != NULL && point.x > nTitleStarts && point.x <= nTitleStarts + rcItem.left + 16 )
		{
			pQueue->m_bExpanded = ! pQueue->m_bExpanded;
			
			if ( ! pQueue->m_bExpanded )
			{
				for ( POSITION posActive = pQueue->GetActiveIterator() ; posActive ; )
				{
					CUploadTransfer* pTransfer = pQueue->GetNextActive( posActive );
					if ( pTransfer->m_pBaseFile != NULL ) pTransfer->m_pBaseFile->m_bSelected = FALSE;
				}
				
				for ( DWORD nPos = 0 ; nPos < pQueue->GetQueuedCount() ; nPos ++ )
				{
					CUploadTransfer* pTransfer = (CUploadTransfer*)pQueue->GetQueuedAt( nPos );
					if ( pTransfer->m_pBaseFile != NULL ) pTransfer->m_pBaseFile->m_bSelected = FALSE;
				}
			}
			
			Update();
		}
		else if ( pQueue != NULL )
		{
			GetOwner()->PostMessage( WM_TIMER, 5 );
			GetOwner()->PostMessage( WM_COMMAND, ID_UPLOADS_EDIT_QUEUE );
		}
		else if ( pFile != NULL )
		{
			GetOwner()->PostMessage( WM_TIMER, 5 );
			GetOwner()->PostMessage( WM_COMMAND, ID_UPLOADS_LAUNCH );
		}
	}
	
	CWnd::OnLButtonDblClk( nFlags, point );
}
Exemplo n.º 2
0
void CUploadsCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	CSingleLock pLock( &Transfers.m_pSection, TRUE );
	CUploadFile* pFile;
	CUploadQueue* pQueue;
	CRect rcItem;
	int nIndex;
	
	SetFocus();
	m_wndTip.Hide();
	
	if ( HitTest( point, &pQueue, &pFile, &nIndex, &rcItem ) )
	{
		int nTitleStarts = GetExpandableColumnX();
		if ( point.x > nTitleStarts && point.x <= nTitleStarts + rcItem.left + 16 )
		{
			if ( pQueue != NULL )
			{
				pQueue->m_bExpanded = ! pQueue->m_bExpanded;
				
				if ( ! pQueue->m_bExpanded )
				{
					for ( POSITION posActive = pQueue->GetActiveIterator() ; posActive ; )
					{
						CUploadTransfer* pTransfer = pQueue->GetNextActive( posActive );
						if ( pTransfer->m_pBaseFile != NULL ) pTransfer->m_pBaseFile->m_bSelected = FALSE;
					}
					
					for ( DWORD nPos = 0 ; nPos < pQueue->GetQueuedCount() ; nPos ++ )
					{
						CUploadTransfer* pTransfer = (CUploadTransfer*)pQueue->GetQueuedAt( nPos );
						if ( pTransfer->m_pBaseFile != NULL ) pTransfer->m_pBaseFile->m_bSelected = FALSE;
					}
				}
				
				Update();
			}
		}
		else
		{
			if ( pFile != NULL && pFile->m_bSelected )
			{
				if ( ( nFlags & ( MK_SHIFT | MK_CONTROL | MK_RBUTTON ) ) == 0 )
				{
					m_pDeselect = pFile;
				}
			}
			else if ( nFlags & MK_RBUTTON )
			{
				DeselectAll();
			}
			
			SelectTo( nIndex );
		}
	}
	else if ( ( nFlags & ( MK_SHIFT | MK_CONTROL ) ) == 0 )
	{
		DeselectAll();
		Update();
	}
}