Exemple #1
0
INT_PTR CRemoteWnd::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
{
	if ( CmdButton* pButton = HitTestButtons( point ) )
	{
		CString strTip;

		if ( LoadString( strTip, pButton->m_nID ) )
		{
			if ( LPCTSTR pszBreak = _tcschr( strTip, '\n' ) )
			{
				pTI->lpszText = _tcsdup( pszBreak + 1 );
			}
			else
			{
				strTip = strTip.SpanExcluding( L"." );
				pTI->lpszText = _tcsdup( strTip );
			}
		}

		pTI->hwnd		= GetSafeHwnd();
		pTI->uId		= pButton->m_nID;
		pTI->uFlags		= pTI->uFlags & ~TTF_IDISHWND;
		pTI->rect		= pButton->m_rc;

		return pTI->uId;
	}

	return CWnd::OnToolHitTest( point, pTI );
}
Exemple #2
0
void CRemoteWnd::OnLButtonDown(UINT /*nFlags*/, CPoint point)
{
	SetActiveWindow();
	SetFocus();

	if ( CmdButton* pButton = HitTestButtons( point ) )
	{
		m_pCmdDown = m_pCmdHover = pButton;
		Invalidate();
		SetCapture();
	}
	else if ( m_bsScalerTrack && m_rcsScalerTrack.PtInRect( point ) )
	{
		TrackScaler();
	}
	else if ( m_bsMediaSeekTrack && m_rcsMediaSeekTrack.PtInRect( point ) )
	{
		TrackSeek();
	}
	else if ( m_bsMediaVolTrack && m_rcsMediaVolTrack.PtInRect( point ) )
	{
		TrackVol();
	}
	else
	{
		ClientToScreen( &point );
		SendMessage( WM_NCLBUTTONDOWN, HTCAPTION, MAKELONG( point.x, point.y ) );
	}
}
Exemple #3
0
void CRemoteWnd::OnTimer(UINT_PTR /*nIDEvent*/)
{
	if ( m_nTimer++ >= 10 )
	{
		m_nTimer = 0;
		UpdateCmdButtons();

		if ( m_pCmdHover != NULL )
		{
			CPoint point;
			GetCursorPos( &point );
			ScreenToClient( &point );
			if ( HitTestButtons( point ) != m_pCmdHover )
				m_pCmdHover = NULL;
		}

		m_sStatus.Format( LoadString( IDS_TRAY_TIP ),
			Settings.SmartSpeed( CGraphItem::GetValue( GRC_TOTAL_BANDWIDTH_IN ), bits ),
			Settings.SmartSpeed( CGraphItem::GetValue( GRC_TOTAL_BANDWIDTH_OUT ), bits ),
			CGraphItem::GetValue( GRC_DOWNLOADS_TRANSFERS ),
			CGraphItem::GetValue( GRC_UPLOADS_TRANSFERS ),
			CGraphItem::GetValue( GRC_GNUTELLA_CONNECTIONS ) );
	}

	Invalidate();
}
Exemple #4
0
BOOL CRemoteWnd::OnSetCursor(CWnd* /*pWnd*/, UINT /*nHitTest*/, UINT /*message*/)
{
	CPoint point;
	GetCursorPos( &point );
	ScreenToClient( &point );

	BOOL bAvailable = CMediaFrame::GetMediaFrame() != NULL;

	if ( m_bsScalerTrack && m_rcScalerTab.PtInRect( point ) )
	{
		if ( ! m_bScaler ) Invalidate();
		m_bScaler = TRUE;
	}
	else if ( bAvailable && m_bsMediaSeekTrack && m_rcMediaSeekTab.PtInRect( point ) )
	{
		if ( ! m_bMediaSeek ) Invalidate();
		m_bMediaSeek = TRUE;
	}
	else if ( bAvailable && m_bsMediaVolTrack && m_rcMediaVolTab.PtInRect( point ) )
	{
		if ( ! m_bMediaVol ) Invalidate();
		m_bMediaVol = TRUE;
	}
	else if ( m_bScaler || m_bMediaSeek || m_bMediaVol )
	{
		m_bScaler = m_bMediaSeek = m_bMediaVol = FALSE;
		Invalidate();
	}

	if ( HitTestButtons( point ) != NULL )
	{
		SetCursor( AfxGetApp()->LoadCursor( IDC_HAND ) );
		return TRUE;
	}
	else if ( m_bsScalerTrack && m_rcsScalerTrack.PtInRect( point ) )
	{
		SetCursor( AfxGetApp()->LoadCursor( IDC_HAND ) );
		return TRUE;
	}
	else if ( bAvailable && m_bsMediaSeekTrack && m_rcsMediaSeekTrack.PtInRect( point ) )
	{
		SetCursor( AfxGetApp()->LoadCursor( IDC_HAND ) );
		return TRUE;
	}
	else if ( bAvailable && m_bsMediaVolTrack && m_rcsMediaVolTrack.PtInRect( point ) )
	{
		SetCursor( AfxGetApp()->LoadCursor( IDC_HAND ) );
		return TRUE;
	}
	else
	{
		SetCursor( AfxGetApp()->LoadStandardCursor( IDC_ARROW ) );
		return TRUE;
	}
}
Exemple #5
0
void CRemoteWnd::OnMouseMove(UINT nFlags, CPoint point)
{
	CmdButton* pButton = HitTestButtons( point );

	if ( m_pCmdHover != pButton )
	{
		m_pCmdHover = pButton;
		Invalidate();
	}

	if ( m_pCmdDown == NULL ) CWnd::OnMouseMove(nFlags, point);
}
void COXToolBarCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
{
	if (HitTestButtons(point) != -1)
	{
		CToolBarCtrl::OnLButtonDown(nFlags, point);
	}
	else
	{
		CWnd* pParent = GetOwner();
		ASSERT(pParent != NULL);
		// map to co-ordinates of parent window
		ClientToScreen(&point);
		pParent->ScreenToClient(&point);
		// let the parent handle it
		pParent->SendMessage(WM_LBUTTONDOWN, nFlags, MAKELONG(point.x, point.y));  
	}
}