示例#1
0
	//--------------------------------------------------------------------------------------------
	bool MouseHandlerBase::OnMsgProc( HWND i_hWnd, UINT i_nMsg, WPARAM i_wParam, LPARAM i_lParam )
	{
		bool ret = false;

		// マウスに関係するメッセージをハンドリングする
		switch( i_nMsg )
		{
		case WM_MOUSEMOVE:
			ret = OnMouseMove(LOWORD(i_lParam), HIWORD(i_lParam));
			break;
		case WM_LBUTTONDOWN:
			ret = OnLButtonDown(LOWORD(i_lParam), HIWORD(i_lParam));
			break;
		case WM_LBUTTONUP:
			ret = OnLButtonUp(LOWORD(i_lParam), HIWORD(i_lParam));
			break;
		case WM_RBUTTONDOWN:
			ret = OnRButtonDown(LOWORD(i_lParam), HIWORD(i_lParam));
			break;
		case WM_RBUTTONUP:
			ret = OnRButtonUp(LOWORD(i_lParam), HIWORD(i_lParam));
			break;
		case WM_MOUSEWHEEL:
			ret = OnMouseWheel( GET_WHEEL_DELTA_WPARAM(i_wParam) / WHEEL_DELTA );
			break;
		}

		return ret;
	}
LRESULT CALLBACK Explorerplusplus::EditSubclass(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
		case WM_KEYDOWN:
			switch(wParam)
			{
				case VK_RETURN:
					SendMessage(m_hContainer,CBN_KEYDOWN,VK_RETURN,0);
					return 0;
					break;
			}
			break;

		case WM_SETFOCUS:
			HandleToolbarItemStates();
			break;

		case WM_MOUSEWHEEL:
			if(OnMouseWheel(MOUSEWHEEL_SOURCE_OTHER,wParam,lParam))
			{
				return 0;
			}
			break;
	}

	return DefSubclassProc(hwnd,msg,wParam,lParam);
}
LRESULT CALLBACK Explorerplusplus::EditSubclass(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
		case WM_KEYDOWN:
			switch(wParam)
			{
				case VK_RETURN:
					OnAddressBarGo();
					return 0;
					break;
			}
			break;

		case WM_SETFOCUS:
			UpdateMainToolbar();
			break;

		case WM_MOUSEWHEEL:
			if(OnMouseWheel(MOUSEWHEEL_SOURCE_OTHER,wParam,lParam))
			{
				return 0;
			}
			break;
	}

	return DefSubclassProc(hwnd,msg,wParam,lParam);
}
示例#4
0
int DXInputManager::ProcessMouseMsg(UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	//DXWriteConsol(CC_WHITE,"DXInputManager::ProcessMouseMsg");
	int res=0;
	switch (uMsg)
	{
	case  WM_LBUTTONDOWN:
		res=OnMouseLBtnDown(uMsg,wParam,lParam);
		break;
	case WM_LBUTTONUP:
		res=OnMouseLBtnUp(uMsg,wParam,lParam);
		break;
	case WM_RBUTTONDOWN:
		res=OnMOuseRBtnDown(uMsg,wParam,lParam);
		break;
	case WM_RBUTTONUP:
		res=OnMouseRBtnUp(uMsg,wParam,lParam);
		break;
	case WM_MBUTTONDOWN:
		res=OnMouseMBtnDwon(uMsg,wParam,lParam);
		break;
	case WM_MBUTTONUP:
		res=OnMouseMBtnUp(uMsg,wParam,lParam);
		break;
	case WM_MOUSEWHEEL:
		res=OnMouseWheel(uMsg,wParam,lParam);
		break;
	case WM_MOUSEMOVE:
		res=OnMouseMove(uMsg,wParam,lParam);
		break;
	default:
		res=0;
	}
	return 0;
}
示例#5
0
文件: WinMouse.cpp 项目: zxwbj/danei
//窗口处理函数
LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, 
												 WPARAM wParam, LPARAM lParam )
{
	switch( msg )
	{
		case WM_MOUSEWHEEL:
			OnMouseWheel( hWnd, wParam );
			break;
		case WM_LBUTTONDBLCLK:
			OnLButtonDblClk( hWnd );
			break;
		case WM_PAINT:
			OnPaint( hWnd );
			break;
		case WM_MOUSEMOVE:
			OnMouseMove( hWnd, lParam );
			break;
		case WM_LBUTTONDOWN:
			OnLButtonDown( hWnd, wParam, lParam );
			break;
		case WM_LBUTTONUP:
			OnLButtonUp( hWnd, wParam, lParam );
			break;
		case WM_DESTROY:
			PostQuitMessage( 0 );
			break;
	}
	return DefWindowProc( hWnd, msg, wParam, lParam );
}
LRESULT WindowImplBase::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
	case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
	case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
	case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
	case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;	
	case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
	case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

	lRes = HandleCustomMessage(uMsg, wParam, lParam, bHandled);
	if (bHandled) return lRes;

	if (paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes)) return lRes;
	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
void CBeikeSafeSoftmgrNecessHandler::OnEditMouseWheelMsg( WPARAM wParam, LPARAM lParam )
{
	CPoint pt;
	pt.x = LOWORD(lParam);
	pt.y = HIWORD(lParam);

	OnMouseWheel(LOWORD(wParam), HIWORD(wParam), pt);
}
示例#8
0
bool
TopWindow::OnEvent(const Event &event)
{
  switch (event.type) {
    Window *w;

  case Event::NOP:
  case Event::QUIT:
  case Event::TIMER:
  case Event::USER:
  case Event::CALLBACK:
    break;

  case Event::CLOSE:
    OnClose();
    break;

  case Event::KEY_DOWN:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    return w->OnKeyDown(event.param);

  case Event::KEY_UP:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    return w->OnKeyUp(event.param);

  case Event::MOUSE_MOTION:
#ifdef DRAW_MOUSE_CURSOR
    /* redraw to update the mouse cursor position */
    Invalidate();
#endif

    // XXX keys
    return OnMouseMove(event.point.x, event.point.y, 0);

  case Event::MOUSE_DOWN:
    return double_click.Check(event.point)
      ? OnMouseDouble(event.point.x, event.point.y)
      : OnMouseDown(event.point.x, event.point.y);

  case Event::MOUSE_UP:
    double_click.Moved(event.point);

    return OnMouseUp(event.point.x, event.point.y);

  case Event::MOUSE_WHEEL:
    return OnMouseWheel(event.point.x, event.point.y, (int)event.param);
  }

  return false;
}
示例#9
0
文件: Window.cpp 项目: uvbs/myduilib
	LRESULT CWin::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		LRESULT lRes = 0;
		BOOL bHandled = TRUE;
		switch (uMsg)
		{
		case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_CLOSE:			lRes = OnClose(uMsg, wParam, lParam, bHandled); break;
		case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
#if defined(WIN32) && !defined(UNDER_CE)
		//case WM_NCCREATE:		lRes = OnNcCreate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSEMOVE:    lRes = OnNCMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_NCMOUSELEAVE:   lRes = OnNCMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_NCACTIVATE:		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled); break;
		case WM_NCCALCSIZE:		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled); break;
		case WM_NCPAINT:		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled); break;
		case WM_NCHITTEST:		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled); break;
		case WM_GETMINMAXINFO:	lRes = OnGetMinMaxInfo(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
#endif
		case WM_ERASEBKGND:     lRes = OnEraseBkGnd(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
		case WM_CHAR:		    lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
		case WM_SYSCOMMAND:		lRes = OnSysCommand(uMsg, wParam, lParam, bHandled); break;
		case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
		case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONUP:		lRes = OnLButtonUp(uMsg, wParam, lParam, bHandled); break;
		case WM_LBUTTONDOWN:	lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEMOVE:		lRes = OnMouseMove(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSELEAVE:     lRes = OnMouseLeave(uMsg, wParam, lParam, bHandled); break;
		case WM_MOUSEHOVER:	    lRes = OnMouseHover(uMsg, wParam, lParam, bHandled); break;
		case WM_HOTKEY:			lRes = OnHotKey(uMsg, wParam, lParam, bHandled); break;
//		case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;//OnTimer响应有小问题
		case WM_MOVING:			lRes = OnMoving(uMsg, wParam, lParam, bHandled); break;
		case WM_SIZING:			lRes = OnSizing(uMsg, wParam, lParam, bHandled); break;
		case WM_SHOWWINDOW:		lRes = OnShowWindow(uMsg, wParam, lParam, bHandled); break;
		case WM_COMMAND:		lRes = OnCommand(uMsg, wParam, lParam, bHandled); break;
//		case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;//OnPaint响应有问题
		case WM_MENUCOMMAND:    lRes = OnMenuCommand(uMsg, wParam, lParam, bHandled); break;
		default:				bHandled = FALSE; break;
		}
		if (bHandled) return lRes;

		lRes = ProcessWindowMessage(uMsg, wParam, lParam, bHandled);
		if (bHandled) return lRes;

		if(_paintManager && _paintManager->MessageHandler(uMsg,wParam,lParam,lRes))
			return lRes;
		return __super::HandleMessage(uMsg,wParam,lParam);
	}
示例#10
0
//------------------------------------------------------------------------
// CALLBACK Function to handle the application's window events.
// ----------------------------------------------------------------------
// Param -> IN:
//      HWND:       Handle to the main window.
//      UINT:       Window message.
//      WPARAM:     Param of the window message.
//      LPARAM:     Param of the window message.
//------------------------------------------------------------------------
LRESULT LightShadowApp::MsgProc( HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam )
{
    switch( uMsg )
    {
    case WM_MOUSEMOVE:
        OnMouseMove( wParam,lParam );
        break;
    case WM_MOUSEWHEEL:
        OnMouseWheel( wParam,lParam );
        break;
    case WM_KEYDOWN:
        switch( wParam )
        {
        case VK_LEFT:
            m_bKeystate[0] = true;
            break;
        case VK_RIGHT:
            m_bKeystate[1] = true;
            break;
        case VK_UP:
            m_bKeystate[2] = true;
            break;
        case VK_DOWN:
            m_bKeystate[3] = true;
            break;
        case 'P':
            FlyKernel::Instance().SaveScreenshot();
            break;
        }
        break;
    case WM_KEYUP:
        switch( wParam )
        {
        case VK_LEFT:
            m_bKeystate[0] = false;
            break;
        case VK_RIGHT:
            m_bKeystate[1] = false;
            break;
        case VK_UP:
            m_bKeystate[2] = false;
            break;
        case VK_DOWN:
            m_bKeystate[3] = false;
            break;
        }
        break;
    }

    return AppFramework::MsgProc( hWnd,uMsg,wParam,lParam );
}
示例#11
0
文件: Module.cpp 项目: CYBORUS/SDL2TK
    void Module::OnEvent(const SDL_Event& event)
    {
        switch (event.type)
        {
            case SDL_WINDOWEVENT:
            {
                switch (event.window.event)
                {
                    case SDL_WINDOWEVENT_ENTER: OnMouseFocus(); break;
                    case SDL_WINDOWEVENT_LEAVE: OnMouseBlur(); break;
                    case SDL_WINDOWEVENT_FOCUS_GAINED: OnInputFocus(); break;
                    case SDL_WINDOWEVENT_FOCUS_LOST: OnInputBlur(); break;
                    case SDL_WINDOWEVENT_RESTORED: OnRestore(); break;
                    case SDL_WINDOWEVENT_MINIMIZED: OnMinimize(); break;
                    case SDL_WINDOWEVENT_MAXIMIZED: OnMaximize(); break;
                    case SDL_WINDOWEVENT_EXPOSED: OnExpose(); break;

                    case SDL_WINDOWEVENT_SIZE_CHANGED:
                        OnResize(event.window.data1, event.window.data2);
                        break;

                    default: break;
                }

                break;
            }

            case SDL_KEYDOWN:
                if (event.key.repeat)
                    OnKeyRepeat(event.key.keysym);
                else
                    OnKeyDown(event.key.keysym);
                break;

            case SDL_KEYUP: OnKeyUp(event.key.keysym); break;
            case SDL_MOUSEMOTION: OnMouseMove(event.motion); break;
            case SDL_MOUSEWHEEL: OnMouseWheel(event.wheel); break;
            case SDL_MOUSEBUTTONDOWN: OnMouseButtonDown(event.button); break;
            case SDL_MOUSEBUTTONUP: OnMouseButtonUp(event.button); break;

            case SDL_JOYAXISMOTION: OnJoyAxis(event.jaxis); break;
            case SDL_JOYBALLMOTION: OnJoyBall(event.jball); break;
            case SDL_JOYHATMOTION: OnJoyHat(event.jhat); break;
            case SDL_JOYBUTTONDOWN: OnJoyButtonDown(event.jbutton); break;
            case SDL_JOYBUTTONUP: OnJoyButtonUp(event.jbutton); break;
            case SDL_QUIT: OnExit(); break;
            case SDL_SYSWMEVENT: break;

            default: OnUser(event.user);break;
        }
    }
示例#12
0
STFSliders::STFSliders() : Control(),
channel( 0 ), rgb( true ), m( 0.5F ), c0( 0 ), c1( 1 ), v0( 0 ), v1( 1 ),
gradient( Bitmap::Null() ),
beingDragged( -1 ), scrolling( false ), scrollOrigin( 0 ),
onValueUpdated( 0 ), onValueUpdatedReceiver( 0 ),
onRangeUpdated( 0 ), onRangeUpdatedReceiver( 0 )
{
   OnPaint( (Control::paint_event_handler)&STFSliders::__Paint, *this );
   OnResize( (Control::resize_event_handler)&STFSliders::__Resize, *this );
   OnMousePress( (Control::mouse_button_event_handler)&STFSliders::__MousePress, *this );
   OnMouseMove( (Control::mouse_event_handler)&STFSliders::__MouseMove, *this );
   OnMouseRelease( (Control::mouse_button_event_handler)&STFSliders::__MouseRelease, *this );
   OnMouseWheel( (Control::mouse_wheel_event_handler)&STFSliders::__MouseWheel, *this );
}
示例#13
0
void IHISession::HIMouseWheel (int iDelta, int x, int y, DWORD dwFlags)

//	HIMouseWheel
//
//	Handle mouse wheel

	{
	//	See if the animator will handle it

	if (m_Reanimator.HandleMouseWheel(iDelta, x, y, dwFlags))
		return;

	OnMouseWheel(iDelta, x, y, dwFlags);
	}
示例#14
0
BOOL CMapToolView::PreTranslateMessage(MSG* pMsg)
{
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.

	switch (pMsg->message) 
	{
	case WM_KEYDOWN:
		if( LOWORD(pMsg->lParam) == 1 )
			OnKeyPress(LOWORD(pMsg->wParam));
		break;
	case WM_KEYUP:
		OnKeyRelease(LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONDOWN:
		OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONUP:
		OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_LBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam));
		break;
	case WM_RBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam));
		break;
	case WM_MBUTTONDBLCLK:
		OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam));
		break;
	case WM_MOUSEMOVE:
		OnMouseMove(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam));
		break;
	case WM_MOUSEWHEEL:
		OnMouseWheel((short)HIWORD(pMsg->wParam), LOWORD(pMsg->wParam));
		break;
	}
	return CView::PreTranslateMessage(pMsg);
}
示例#15
0
LRESULT CDangleWindowHex::DangleProc(UINT Msg,WPARAM wParam,LPARAM lParam)
{
	//выбор по сообщению
	switch(Msg)
	{
	case WM_KEYDOWN:
		return OnKey(wParam),0;
	case WM_COMMAND:
		return OnCommand(LOWORD(wParam),HIWORD(wParam),(HWND)lParam),0;
	case WM_MOUSEWHEEL:
		return OnMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam)/WHEEL_DELTA,GET_KEYSTATE_WPARAM(wParam)),0;
	default:
		return DefWindowProc(mhWindow,Msg,wParam,lParam);
	}
}
示例#16
0
void InputEventController::ProcessInputEvent(const SDL_Event &evt)
{
	switch (evt.type) {
		case SDL_KEYDOWN: OnKeyPressed(evt.key); break;
		case SDL_KEYUP: OnKeyReleased(evt.key); break;
		case SDL_TEXTINPUT: OnTextInput(evt.text); break;

		case SDL_MOUSEMOTION: OnMouseMoved(evt.motion); break;
		case SDL_MOUSEBUTTONDOWN: OnMousePressed(evt.button); break;
		case SDL_MOUSEBUTTONUP: OnMouseReleased(evt.button); break;
		case SDL_MOUSEWHEEL: OnMouseWheel(evt.wheel); break;

		default:
			HR_LOG(info) << "Unhandled input event type: " << evt.type;
	}
}
示例#17
0
//------------------------------------------------------------------------
// CALLBACK Function to handle the application's window events.
// ----------------------------------------------------------------------
// Param -> IN:
//      HWND:       Handle to the main window.
//      UINT:       Window message.
//      WPARAM:     Param of the window message.
//      LPARAM:     Param of the window message.
//------------------------------------------------------------------------
LRESULT ParticleViewerApp::MsgProc( HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam )
{
    switch( uMsg )
    {
    case WM_MOUSEMOVE:
        OnMouseMove( wParam,lParam );
        break;
    case WM_MOUSEWHEEL:
        OnMouseWheel( wParam,lParam );
        break;
    case WM_KEYDOWN:
        if( wParam == VK_SPACE ) FlyKernel::Instance().SaveScreenshot();
        break;
    }

    return AppFramework::MsgProc( hWnd,uMsg,wParam,lParam );
}
示例#18
0
BOOL CZoomDlg::PreTranslateMessage(MSG *pMsg) {
  if(TranslateAccelerator(m_hWnd, m_accelTable, pMsg)) {
    return true;
  }

  switch(pMsg->message) {
  case WM_MOUSEWHEEL:
    { const short delta = (short)(pMsg->wParam >> 16);
      const UINT  flags = (UINT)( pMsg->wParam & 0xffff);
      OnMouseWheel(flags, delta, pMsg->pt);
    }
    return true;

  default:
    break;
  }

  return __super::PreTranslateMessage(pMsg);
}
示例#19
0
WMSG_RESULT CUITree::MouseWheel( UINT16 x, UINT16 y, int wheel )
{
	WMSG_RESULT ret = WMSG_FAIL;

	if (wheel > 0)
		OnMouseWheelUp();
	else if (wheel < 0)
		OnMouseWheelDown();

	if (m_bHide == FALSE)
	{
		ret = OnMouseWheel(x, y, wheel);
	}

	if (ret == WMSG_FAIL)
		ret = MouseWheelChild(x, y, wheel);

	return ret;
}
示例#20
0
WMSG_RESULT CUIBase::MouseWheel(UINT16 x, UINT16 y, int wheel)
{
    if (m_bHide)
        return WMSG_FAIL;

    if (IsInside(x, y) == FALSE)
        return WMSG_FAIL;

    WMSG_RESULT ret = WMSG_FAIL;

    if (wheel > 0)
        OnMouseWheelUp();
    else if (wheel < 0)
        OnMouseWheelDown();

    ret = OnMouseWheel(x, y, wheel);

    if (ret == WMSG_FAIL)
        ret = MouseWheelChild(x, y, wheel);

    return ret;
}
示例#21
0
	bool Camera::HandleWindowsMessage(UINT message, WPARAM wParam, LPARAM lParam)
	{
		(void)lParam;

		switch (message)
		{
		case WM_LBUTTONDOWN:
			OnMouseDown(MBUTTON_Left);
			return true;

		case WM_MBUTTONDOWN:
			OnMouseDown(MBUTTON_Middle);
			return true;

		case WM_RBUTTONDOWN:
			OnMouseDown(MBUTTON_Right);
			return true;

		case WM_LBUTTONUP:
			OnMouseUp(MBUTTON_Left);
			return true;

		case WM_MBUTTONUP:
			OnMouseUp(MBUTTON_Middle);
			return true;

		case WM_RBUTTONUP:
			OnMouseUp(MBUTTON_Right);
			return true;

		case WM_MOUSEWHEEL:
			OnMouseWheel(int(short(HIWORD(wParam))));
			return true;

		default:
			return false;
		}
	}
示例#22
0
/*============================================================================*/
	LRESULT WScrollBars::
ScrollProc(UINT uMsg, WPARAM wParam, LPARAM lParam)         		/*

	Process the system message uMsg from the view's message loop. All
	scroll request messages pass through this procedure.  Return 0 if
	the message was handled, -1 otherwise.
*-----------------------------------------------------------------------------*/
{
	switch (uMsg)
	{
	    case WM_VSCROLL: 	// received when the v-scrollbar is clicked
                if (OnVScroll(wParam, lParam) == 0)
                        return 0;

                break;

	    case WM_HSCROLL: 	// received when the v-scrollbar is clicked
                if (OnHScroll(wParam, lParam) == 0)
                        return 0;

                break;

	    case WM_KEYDOWN:  // received when a key is pressed
                if (OnKeyScroll(wParam, lParam) == 0)
                        return 0;

		break;

	    case WM_MOUSEWHEEL:  // rotation detected
		if (OnMouseWheel(wParam, lParam) == 0)
			return 0;

		break;
	}
	  // message was not one for scrolling: notify caller no processing
	  // took place
	return -1;
}
示例#23
0
LRESULT CWkeWebkitWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if ( uMsg != WM_CREATE && m_pWebView == NULL) return -1;
	LRESULT lRes = 0;
	BOOL bHandled = TRUE;
	switch (uMsg)
	{
	case WM_PAINT:			lRes = OnPaint(uMsg, wParam, lParam, bHandled); break;
	case WM_CREATE:			lRes = OnCreate(uMsg, wParam, lParam, bHandled); break;
	case WM_DESTROY:		lRes = OnDestroy(uMsg, wParam, lParam, bHandled); break;
	case WM_MOUSEWHEEL:		lRes = OnMouseWheel(uMsg, wParam, lParam, bHandled); break;
	case WM_SIZE:			lRes = OnSize(uMsg, wParam, lParam, bHandled); break;
	case WM_CHAR:			lRes = OnChar(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYDOWN:		lRes = OnKeyDown(uMsg, wParam, lParam, bHandled); break;
	case WM_KEYUP:			lRes = OnKeyUp(uMsg, wParam, lParam, bHandled); break;
	case WM_KILLFOCUS:		lRes = OnKillFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_SETFOCUS:		lRes = OnSetFocus(uMsg, wParam, lParam, bHandled); break;
	case WM_TIMER:			lRes = OnTimer(uMsg, wParam, lParam, bHandled); break;
	case WM_IME_STARTCOMPOSITION: lRes = OnImeStartComposition(uMsg, wParam, lParam, bHandled); break;	
	case WM_CONTEXTMENU:	lRes= OnContextMenu(uMsg, wParam, lParam, bHandled); break;	
	case WM_LBUTTONDOWN:	
	case WM_MBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_RBUTTONUP:
	case WM_LBUTTONDBLCLK:
	case WM_MBUTTONDBLCLK:
	case WM_RBUTTONDBLCLK:
	case WM_MOUSEMOVE:
	case WM_MOUSELEAVE:
		lRes = OnMouseEvent(uMsg, wParam, lParam, bHandled); break;
	default:				bHandled = FALSE; break;
	}
	if (bHandled) return lRes;

	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例#24
0
int CDataScope::MsgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  switch (uMsg)
  {
    case WM_COMMAND:
      OnCommand(wParam, lParam);
      break;
    case WM_CREATE:
      OnCreate(wParam, lParam);
      break;
    case WM_DESTROY:
      OnDestroy(wParam, lParam);
      break;
    case WM_PAINT:
      OnPaint(wParam, lParam);
      break;
    case WM_MOUSEMOVE:
      OnMouseMove(wParam, lParam);
      break;
    case WM_SIZE:
      OnSize(wParam, lParam);
      break;
    case WM_MOVE:
      OnMove(wParam, lParam);
      break;
    case WM_MOUSEWHEEL:
      OnMouseWheel(wParam, lParam);
      break;
    case WM_KEYDOWN:
      OnKeyDown(wParam, lParam);
      break;
    case WM_ERASEBKGND:
      return TRUE;
  }

  return DefMDIChildProc(m_hWnd, uMsg, wParam, lParam);
}
示例#25
0
int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
  if (!pMessage)
    return 0;
  int32_t iRet = 1;
  FX_DWORD dwMsgCode = pMessage->GetClassID();
  if (dwMsgCode == FWL_MSGHASH_Mouse) {
    CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
    FX_DWORD dwCmd = pMsg->m_dwCmd;
    switch (dwCmd) {
      case FWL_MSGMOUSECMD_LButtonDown: {
        OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_LButtonUp: {
        OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_MouseMove: {
        OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy);
        break;
      }
      case FWL_MSGMOUSECMD_MouseLeave: {
        OnMouseLeave();
        break;
      }
      default: { iRet = 0; }
    }
  } else if (dwMsgCode == FWL_MSGHASH_MouseWheel) {
    CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage);
    OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX,
                 pMsg->m_fDeltaY);
  } else {
    iRet = 0;
  }
  return iRet;
}
示例#26
0
  LRESULT cOpenGLControl::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  {
     switch (uMsg) {
        case WM_SETFOCUS:
        case WM_KILLFOCUS:
        case WM_ENABLE:
          Update();
          break;

        case WM_SIZING:
        case WM_SIZE:
          UpdateSize();
          OnSize();
          Update();
          break;

        case WM_PAINT:
          Paint();
          return FALSE;

        case WM_ERASEBKGND:
          return TRUE;

        case WM_MOUSEMOVE: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));

           if (!bMouseIn) {
              TRACKMOUSEEVENT tme;
              tme.cbSize = sizeof(TRACKMOUSEEVENT);
              tme.dwFlags = TME_LEAVE | TME_HOVER;
              tme.hwndTrack = hwnd;
              tme.dwHoverTime = HOVER_DEFAULT;
              ::TrackMouseEvent(&tme);
              OnMouseIn();
              bMouseIn = true;
           }

           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnMouseMove(x, y, modifiers);
        } break;

        case WM_MOUSELEAVE:
           if (bMouseIn) {
              OnMouseOut();
              bMouseIn = false;
           }
           break;

        case WM_MOUSEHOVER:
          if (bMouseIn) {
            const int x = int((short)LOWORD(lParam));
            const int y = int((short)HIWORD(lParam));
            cKeyModifiers modifiers;
            GetModifiersForMouseEvent(modifiers, wParam);
            OnMouseHover(x, y, modifiers);

            // Reset the track mouse event
            TRACKMOUSEEVENT tme;
            tme.cbSize = sizeof(TRACKMOUSEEVENT);
            tme.dwFlags = TME_LEAVE | TME_HOVER;
            tme.hwndTrack = hwnd;
            tme.dwHoverTime = HOVER_DEFAULT;
            ::TrackMouseEvent(&tme);
          }
          break;

        case WM_LBUTTONDOWN: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnLButtonDown(x, y, modifiers);
           break;
         }

        case WM_LBUTTONUP: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnLButtonUp(x, y, modifiers);
           break;
         }

        case WM_RBUTTONDOWN: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnRButtonDown(x, y, modifiers);
           break;
         }

        case WM_RBUTTONUP: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnRButtonUp(x, y, modifiers);
           break;
         }

        case WM_MBUTTONDOWN: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnMButtonDown(x, y, modifiers);
           break;
         }

        case WM_MBUTTONUP: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnMButtonUp(x, y, modifiers);
           break;
         }

        case WM_LBUTTONDBLCLK: {
           const int x = int((short)LOWORD(lParam));
           const int y = int((short)HIWORD(lParam));
           cKeyModifiers modifiers;
           GetModifiersForMouseEvent(modifiers, wParam);
           OnDoubleClick(x, y, modifiers);
           break;
         }

        case WM_MOUSEWHEEL: {
           POINT pt;
           pt.x = LOWORD(lParam);
           pt.y = HIWORD(lParam);
           if (::ScreenToClient(hwnd, &pt) == TRUE) {
             cKeyModifiers modifiers;
             GetModifiersForMouseEvent(modifiers, wParam);
             OnMouseWheel(pt.x, pt.y, short(HIWORD(wParam)), modifiers);
           }
           break;
         }

        case WM_KEYDOWN:
        case WM_SYSKEYDOWN:
           if ((lParam & 0x40000000) == 0) {
              cKeyEvent event;
              event.key = wParam;
              event.modifiers.bControl = ((::GetKeyState(VK_CONTROL) & 0x8000) != 0);
              event.modifiers.bAlt = ((::GetKeyState(VK_MENU) & 0x8000) != 0);
              event.modifiers.bShift = ((::GetKeyState(VK_SHIFT) & 0x8000) != 0);
              OnKeyDown(event);
           }
           break;

        case WM_KEYUP:
        case WM_SYSKEYUP:
           if ((lParam & 0x40000000) == 0) {
              cKeyEvent event;
              event.key = wParam;
              event.modifiers.bControl = ((::GetKeyState(VK_CONTROL) & 0x8000) != 0);
              event.modifiers.bAlt = ((::GetKeyState(VK_MENU) & 0x8000) != 0);
              event.modifiers.bShift = ((::GetKeyState(VK_SHIFT) & 0x8000) != 0);
              OnKeyUp(event);
           }
           break;
     }

     return DefWindowProc(hwnd, uMsg, wParam, lParam);
  }
LRESULT CALLBACK Explorerplusplus::TreeViewSubclass(HWND hwnd,UINT uMsg,
WPARAM wParam,LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_SETFOCUS:
		HandleToolbarItemStates();
		break;

	case WM_MBUTTONDOWN:
		{
			TVHITTESTINFO tvhi;

			tvhi.pt.x = LOWORD(lParam);
			tvhi.pt.y = HIWORD(lParam);

			TreeView_HitTest(m_hTreeView,&tvhi);

			if(tvhi.flags != LVHT_NOWHERE && tvhi.hItem != NULL)
			{
				m_hTVMButtonItem = tvhi.hItem;
			}
			else
			{
				m_hTVMButtonItem = NULL;
			}
		}
		break;

	case WM_MBUTTONUP:
		{
			TVHITTESTINFO tvhi;
			LPITEMIDLIST pidl = NULL;

			tvhi.pt.x = LOWORD(lParam);
			tvhi.pt.y = HIWORD(lParam);

			TreeView_HitTest(m_hTreeView,&tvhi);

			if(tvhi.flags != LVHT_NOWHERE && tvhi.hItem != NULL)
			{
				/* Only open an item if it was the one
				on which the middle mouse button was
				initially clicked on. */
				if(tvhi.hItem == m_hTVMButtonItem)
				{
					pidl = m_pMyTreeView->BuildPath(tvhi.hItem);
					BrowseFolder(pidl,SBSP_ABSOLUTE,TRUE,FALSE,FALSE);

					CoTaskMemFree(pidl);
				}
			}
		}
		break;

	case WM_MOUSEWHEEL:
		if(OnMouseWheel(MOUSEWHEEL_SOURCE_TREEVIEW,wParam,lParam))
		{
			return 0;
		}
		break;
	}

	return DefSubclassProc(hwnd,uMsg,wParam,lParam);
}
示例#28
0
LRESULT D3DApp::MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch( msg )
	{
	// WM_ACTIVATE is sent when the window is activated or deactivated.  
	// We pause the game when the window is deactivated and unpause it 
	// when it becomes active.  
	case WM_ACTIVATE:
		if( LOWORD(wParam) == WA_INACTIVE )
		{
			mAppPaused = true;
			mTimer.Stop();
		}
		else
		{
			mAppPaused = false;
			mTimer.Start();
		}
		return 0;

	// WM_SIZE is sent when the user resizes the window.  
	case WM_SIZE:
		// Save the new client area dimensions.
		mClientWidth  = LOWORD(lParam);
		mClientHeight = HIWORD(lParam);
		if( md3dDevice )
		{
			if( wParam == SIZE_MINIMIZED )
			{
				mAppPaused = true;
				mMinimized = true;
				mMaximized = false;
			}
			else if( wParam == SIZE_MAXIMIZED )
			{
				mAppPaused = false;
				mMinimized = false;
				mMaximized = true;
				OnResize();
			}
			else if( wParam == SIZE_RESTORED )
			{
				
				// Restoring from minimized state?
				if( mMinimized )
				{
					mAppPaused = false;
					mMinimized = false;
					OnResize();
				}

				// Restoring from maximized state?
				else if( mMaximized )
				{
					mAppPaused = false;
					mMaximized = false;
					OnResize();
				}
				else if( mResizing )
				{
					// If user is dragging the resize bars, we do not resize 
					// the buffers here because as the user continuously 
					// drags the resize bars, a stream of WM_SIZE messages are
					// sent to the window, and it would be pointless (and slow)
					// to resize for each WM_SIZE message received from dragging
					// the resize bars.  So instead, we reset after the user is 
					// done resizing the window and releases the resize bars, which 
					// sends a WM_EXITSIZEMOVE message.
				}
				else // API call such as SetWindowPos or mSwapChain->SetFullscreenState.
				{
					OnResize();
				}
			}
		}
		return 0;

	// WM_EXITSIZEMOVE is sent when the user grabs the resize bars.
	case WM_ENTERSIZEMOVE:
		mAppPaused = true;
		mResizing  = true;
		mTimer.Stop();
		return 0;

	// WM_EXITSIZEMOVE is sent when the user releases the resize bars.
	// Here we reset everything based on the new window dimensions.
	case WM_EXITSIZEMOVE:
		mAppPaused = false;
		mResizing  = false;
		mTimer.Start();
		OnResize();
		return 0;
 
	// WM_DESTROY is sent when the window is being destroyed.
	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;

	// The WM_MENUCHAR message is sent when a menu is active and the user presses 
	// a key that does not correspond to any mnemonic or accelerator key. 
	case WM_MENUCHAR:
        // Don't beep when we alt-enter.
        return MAKELRESULT(0, MNC_CLOSE);

	// Catch this message so to prevent the window from becoming too small.
	case WM_GETMINMAXINFO:
		((MINMAXINFO*)lParam)->ptMinTrackSize.x = 200;
		((MINMAXINFO*)lParam)->ptMinTrackSize.y = 200; 
		return 0;
	
	case WM_MOUSEWHEEL:
		OnMouseWheel(wParam, GET_WHEEL_DELTA_WPARAM(wParam));
		return 0;
	case WM_LBUTTONDOWN:
	case WM_MBUTTONDOWN:
	case WM_RBUTTONDOWN:
		OnMouseDown(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
		return 0;
	case WM_LBUTTONUP:
	case WM_MBUTTONUP:
	case WM_RBUTTONUP:
		OnMouseUp(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
		return 0;
	case WM_MOUSEMOVE:
		OnMouseMove(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
		return 0;
	}

	return DefWindowProc(hwnd, msg, wParam, lParam);
}
示例#29
0
void OUGUIObject::SetMouseWheel(int nWheel)
{
    m_nMouseWheel = nWheel;

    if(0 != nWheel) OnMouseWheel(nWheel);
}
示例#30
0
bool
TopWindow::OnEvent(const SDL_Event &event)
{
  switch (event.type) {
    Window *w;

#if SDL_MAJOR_VERSION < 2
  case SDL_VIDEOEXPOSE:
    invalidated = false;
    Expose();
    return true;
#endif

  case SDL_KEYDOWN:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    if (!w->IsEnabled())
      return false;

#if SDL_MAJOR_VERSION >= 2
    return w->OnKeyDown(event.key.keysym.sym);
#else
    return w->OnKeyDown(event.key.keysym.sym) ||
      (event.key.keysym.unicode != 0 &&
       w->OnCharacter(event.key.keysym.unicode));
#endif

#if SDL_MAJOR_VERSION >= 2
  case SDL_TEXTINPUT:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    if (!w->IsEnabled())
      return false;

    if (event.text.text && *event.text.text) {
      std::pair<unsigned, const char *> next = NextUTF8(event.text.text);
      bool handled = w->OnCharacter(next.first);
      while (next.second) {
        next = NextUTF8(next.second);
        handled = w->OnCharacter(next.first) || handled;
      }
      return handled;
    } else
      return false;
#endif

  case SDL_KEYUP:
    w = GetFocusedWindow();
    if (w == nullptr)
      w = this;

    if (!w->IsEnabled())
      return false;

    return w->OnKeyUp(event.key.keysym.sym);

#ifdef HAVE_MULTI_TOUCH
  case SDL_FINGERDOWN:
    if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 2)
      return OnMultiTouchDown();
    else
      return false;

  case SDL_FINGERUP:
    if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 1)
      return OnMultiTouchUp();
    else
      return false;
#endif

  case SDL_MOUSEMOTION:
    // XXX keys
    return OnMouseMove(event.motion.x, event.motion.y, 0);

  case SDL_MOUSEBUTTONDOWN:
#if SDL_MAJOR_VERSION < 2
    if (event.button.button == SDL_BUTTON_WHEELUP)
      return OnMouseWheel(event.button.x, event.button.y, 1);
    else if (event.button.button == SDL_BUTTON_WHEELDOWN)
      return OnMouseWheel(event.button.x, event.button.y, -1);
#endif

    return double_click.Check(RasterPoint(event.button.x, event.button.y))
      ? OnMouseDouble(event.button.x, event.button.y)
      : OnMouseDown(event.button.x, event.button.y);

  case SDL_MOUSEBUTTONUP:
#if SDL_MAJOR_VERSION < 2
    if (event.button.button == SDL_BUTTON_WHEELUP ||
        event.button.button == SDL_BUTTON_WHEELDOWN)
      /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */
      return false;
#endif

    double_click.Moved(RasterPoint(event.button.x, event.button.y));

    return OnMouseUp(event.button.x, event.button.y);

  case SDL_QUIT:
    return OnClose();

#if SDL_MAJOR_VERSION < 2
  case SDL_VIDEORESIZE:
    Resize(event.resize.w, event.resize.h);
    return true;
#endif

#if SDL_MAJOR_VERSION >= 2
  case SDL_MOUSEWHEEL:
    int x, y;
    SDL_GetMouseState(&x, &y);
    return OnMouseWheel(x, y, event.wheel.y);

  case SDL_WINDOWEVENT:
    switch (event.window.event) {

    case SDL_WINDOWEVENT_RESIZED:
      Resize(event.window.data1, event.window.data2);
      return true;

    case SDL_WINDOWEVENT_RESTORED:
    case SDL_WINDOWEVENT_MOVED:
    case SDL_WINDOWEVENT_SHOWN:
    case SDL_WINDOWEVENT_MAXIMIZED:
      {
        SDL_Window* event_window = SDL_GetWindowFromID(event.window.windowID);
        if (event_window) {
          int w, h;
          SDL_GetWindowSize(event_window, &w, &h);
          if ((w >= 0) && (h >= 0)) {
            Resize(w, h);
          }
        }
      }
      return true;

    case SDL_WINDOWEVENT_EXPOSED:
      invalidated = false;
      Expose();
      return true;
    }
#endif
  }

  return false;
}