예제 #1
0
//-----------------------------------------------------------------------------
// Name : HandleMouse() 
//-----------------------------------------------------------------------------
bool CSliderUI::HandleMouse( HWND hWnd, UINT uMsg, POINT mousePoint, INPUT_STATE inputstate, CTimer* timer )
{
	if( !m_bEnabled || !m_bVisible )
		return false;

	switch( uMsg )
	{
	case WM_LBUTTONDOWN:
	case WM_LBUTTONDBLCLK:
		{
			if ( Pressed(hWnd, mousePoint, inputstate, timer))
				return true;
		}break;

	case WM_LBUTTONUP:
		{
			if ( Released(hWnd, mousePoint))
				return true;
		}break;

	case WM_MOUSEMOVE:
		{
			if ( Dragged(mousePoint))
				return true;
		}break;

	case WM_MOUSEWHEEL:
		{
			if ( Scrolled( inputstate.nScrollAmount ) )
				return true;
		}break;
	};

	return false;
}
예제 #2
0
bool nuiScrollView::MouseMoved(nuiSize X, nuiSize Y)
{
  if (!mLeftClick)
    return false;
  
  nglTime now;
  double elapsed = now.GetValue() - mLastTime.GetValue();
  
  nuiSize vectX = mLastX - X;
  nuiSize vectY = mLastY - Y;
  nuiSize module = sqrt(vectX * vectX + vectY * vectY);
  mSpeedX = (vectX / module) * INERTIA_SPEED * elapsed;
  mSpeedY = (vectY / module) * INERTIA_SPEED * elapsed;  
  
  mLastX = X;
  mLastY = Y;
  mLastTime = now;
  Dragged(X, Y);
  return true;
}
예제 #3
0
bool nuiScrollView::MouseUnclicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button)
{
  if (!mLeftClick)
    return false;

  Dragged(X, Y);
  mLeftClick = false;

  Ungrab();
  
  nglTime now;
  double elapsed = now.GetValue() - mLastTime.GetValue();
  if (elapsed > 0.05)
  {
    mSpeedX = 0;
    mSpeedY = 0;
  }
  
  if (mHideScrollBars)
  {
    HideScrollBars();
  }
  return true;
}