Ejemplo n.º 1
0
void CFaceCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
	SetMsgHandled(FALSE);

	if (!m_bMouseTracking)
	{
		StartTrackMouseLeave();
		m_bMouseTracking = TRUE;
	}

	int nIndex = HitTest(point);
	if (nIndex != m_nHoverIndex)
	{
		if (m_dwTimerId != NULL)
		{
			KillTimer(m_dwTimerId);
			m_dwTimerId = NULL;
		}
		m_nFramePos = 0;
		m_nHoverIndex = nIndex;
		if (m_nHoverIndex != -1)
		{
			SetItemToolTip(m_nHoverIndex);

			CalcZoomRect(point);
			CGifImage * lpImage = GetZoomImage();
			if (lpImage != NULL)
			{
				if (lpImage->IsAnimatedGif())
					m_dwTimerId = SetTimer(1, lpImage->GetFrameDelay(m_nFramePos), NULL);
			}
		}
		this->Invalidate();
	}
}
Ejemplo n.º 2
0
void CSkinHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{
	if (!m_bMouseTracking)
	{
		StartTrackMouseLeave();
		m_bMouseTracking = TRUE;
		m_bHover = TRUE;
		::InvalidateRect(m_hWnd, NULL, TRUE);
	}

	SetMsgHandled(FALSE);
}
Ejemplo n.º 3
0
void CSkinScrollBar::OnMouseMove(UINT nFlags, CPoint point)
{
	if (!IsVisible() || !IsEnabled())
		return;

// 	if (::PtInRect(&m_rcScrollBar, point))
// 	{
// 		if (!m_bMouseHover)	// MouseEnter
// 			m_bMouseHover = TRUE;
// 	}
// 	else
// 	{
// 		if (m_bMouseHover)	// MouseLeave
// 			m_bMouseHover = FALSE;
// 	}

	if ((m_dwThumbState & UISTATE_CAPTURED) != 0)
	{
		if (!m_bHorizontal)
		{
			m_nLastScrollOffset = (point.y - m_ptLastMouse.y) * m_nRange / \
				(m_rcScrollBar.Height() - m_rcThumb.bottom + m_rcThumb.top - 2 * m_rcScrollBar.Width());
		}
		else
		{
			m_nLastScrollOffset = (point.x - m_ptLastMouse.x) * m_nRange / \
				(m_rcScrollBar.Width() - m_rcThumb.right + m_rcThumb.left - 2 * m_rcScrollBar.Height());
		}
	}

	if (::PtInRect(&m_rcScrollBar, point))
	{
		if (!m_bMouseHover)	// MouseEnter
		{
			m_bMouseHover = TRUE;
			m_bMouseTracking = TRUE;
			StartTrackMouseLeave();
		}

// 		if ((m_dwThumbState & UISTATE_CAPTURED) != 0)
// 		{
// 			if (!m_bHorizontal)
// 			{
// 				m_nLastScrollOffset = (point.y - m_ptLastMouse.y) * m_nRange / \
// 					(m_rcScrollBar.bottom - m_rcScrollBar.top - m_rcThumb.bottom + m_rcThumb.top - 2 * m_rcScrollBar.Width());
// 				wchar_t c[100];
// 				wsprintf(c, _T("%d\n"), m_nLastScrollOffset);
// 				::OutputDebugString(c);
// 			}
// 			else
// 			{
// 				m_nLastScrollOffset = (point.x - m_ptLastMouse.x) * m_nRange / \
// 					(m_rcScrollBar.right - m_rcScrollBar.left - m_rcThumb.right + m_rcThumb.left - 2 * m_rcScrollBar.Height());
// 			}
// 		}
		/*else */if ((m_dwLeftUpBtnState & UISTATE_PUSHED) != 0)
		{

		}
		else if ((m_dwRightDownBtnState & UISTATE_PUSHED) != 0)
		{

		}
		else
		{
			if (::PtInRect(&m_rcLeftUpBtn, point))
			{
				if ((m_dwLeftUpBtnState & UISTATE_HOT) == 0)
				{
					m_dwLeftUpBtnState |= UISTATE_HOT;
					m_dwRightDownBtnState &= ~UISTATE_HOT;
					m_dwThumbState &= ~UISTATE_HOT;
					Invalidate();
				}
			}
			else if (::PtInRect(&m_rcRightDownBtn, point))
			{
				if ((m_dwRightDownBtnState & UISTATE_HOT) == 0)
				{
					m_dwRightDownBtnState |= UISTATE_HOT;
					m_dwLeftUpBtnState &= ~UISTATE_HOT;
					m_dwThumbState &= ~UISTATE_HOT;
					Invalidate();
				}
			}
			else if (::PtInRect(&m_rcThumb, point))
			{
				if ((m_dwThumbState & UISTATE_HOT) == 0)
				{
					m_dwThumbState |= UISTATE_HOT;
					m_dwLeftUpBtnState &= ~UISTATE_HOT;
					m_dwRightDownBtnState &= ~UISTATE_HOT;
					Invalidate();
				}
			}
			else
			{
				if ((m_dwLeftUpBtnState & UISTATE_HOT) || 
					(m_dwRightDownBtnState & UISTATE_HOT) ||
					(m_dwThumbState & UISTATE_HOT))
				{
					m_dwLeftUpBtnState &= ~UISTATE_HOT;
					m_dwRightDownBtnState &= ~UISTATE_HOT;
					m_dwThumbState &= ~UISTATE_HOT;
					Invalidate();
				}
			}
		}
	}
	else
	{
		if (m_bMouseHover)	// MouseLeave
		{
			m_bMouseHover = FALSE;
			m_bMouseTracking = FALSE;

			if ((m_dwLeftUpBtnState & UISTATE_HOT) || 
				(m_dwRightDownBtnState & UISTATE_HOT) ||
				(m_dwThumbState & UISTATE_HOT))
			{
				m_dwLeftUpBtnState &= ~UISTATE_HOT;
				m_dwRightDownBtnState &= ~UISTATE_HOT;
				m_dwThumbState &= ~UISTATE_HOT;
				Invalidate();
			}
		}
	}
}
Ejemplo n.º 4
0
void CSkinDialog::OnMouseMove(UINT nFlags, CPoint point)
{
	CRect rcSysBtn(0,0,0,0);
	rcSysBtn.UnionRect(&m_rcMinBtn, &m_rcMaxBtn);
	rcSysBtn.UnionRect(&rcSysBtn, &m_rcCloseBtn);

	int nHitTest = HitTest(point);
	if (nHitTest == HTMINBUTTON || nHitTest == HTMAXBUTTON
		|| nHitTest == HTCLOSE)
	{
		if (!(m_bMinBtnPress || m_bMaxBtnPress
			|| m_bCloseBtnPress))
		{
			if (!m_bMouseTracking)
			{
				StartTrackMouseLeave();
				m_bMouseTracking = TRUE;
			}

			if (nHitTest == HTMINBUTTON)
			{
				if (!m_bMinBtnHover)
				{
					m_bMinBtnHover = TRUE;
					m_bMaxBtnHover = FALSE;
					m_bCloseBtnHover = FALSE;
					InvalidateRect(&rcSysBtn);
				}
			}
			else if (nHitTest == HTMAXBUTTON)
			{
				if (!m_bMaxBtnHover)
				{
					m_bMinBtnHover = FALSE;
					m_bMaxBtnHover = TRUE;
					m_bCloseBtnHover = FALSE;
					InvalidateRect(&rcSysBtn);
				}
			}
			else if (nHitTest == HTCLOSE)
			{
				if (!m_bCloseBtnHover)
				{
					m_bMinBtnHover = FALSE;
					m_bMaxBtnHover = FALSE;
					m_bCloseBtnHover = TRUE;
					InvalidateRect(&rcSysBtn);
				}
			}
		}
	}
	else
	{
		if (m_bMinBtnHover || m_bMaxBtnHover || m_bCloseBtnHover)
		{
			m_bMinBtnHover = FALSE;
			m_bMaxBtnHover = FALSE;
			m_bCloseBtnHover = FALSE;
			InvalidateRect(&rcSysBtn);
		}
	}

	SetMsgHandled(FALSE);
}