예제 #1
0
bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2,
                                   int button)
{
    MouseMove(x1, y1);
    MouseDown(button);
    MouseMove(x2, y2);
    MouseUp(button);
    
    return true;
}
예제 #2
0
파일: List.cpp 프로젝트: AlexDiede/spring
bool List::HandleEventSelf(const SDL_Event& ev)
{
	switch (ev.type) {
		case SDL_MOUSEBUTTONDOWN: {
			if (gui->MouseOverElement(GetRoot(), ev.motion.x, ev.motion.y))
			{
				if(!hasFocus) {
					hasFocus = true;
					MouseMove(ev.motion.x, ev.motion.y, ev.motion.xrel, ev.motion.yrel, ev.motion.state);
				}
			}
			else {
				hasFocus = false;
			}
			if(MouseOver(ev.button.x, ev.button.y)) {
				if(hasFocus) {
					MousePress(ev.button.x, ev.button.y, ev.button.button);
					return true;
				}
			}
			break;
		}
		case SDL_MOUSEBUTTONUP: {
			if (!hasFocus)
				break;
			if (MouseOver(ev.button.x, ev.button.y) || activeScrollbar)
			{
				MouseRelease(ev.button.x, ev.button.y, ev.button.button);
				return true;
			}
			break;
		}
		case SDL_MOUSEMOTION: {
			if (!hasFocus)
				break;
			if (MouseOver(ev.button.x, ev.button.y) || activeScrollbar)
			{
				MouseMove(ev.motion.x, ev.motion.y, ev.motion.xrel, ev.motion.yrel, ev.motion.state);
				return true;
			}
			break;
		}
		case SDL_KEYDOWN: {
			if (!hasFocus)
				break;
			if(ev.key.keysym.sym == SDLK_ESCAPE)
			{
				hasFocus = false;
				break;
			}
			return KeyPressed(ev.key.keysym.sym, false);
		}
	}
	return false;
}
예제 #3
0
bool CAndroidMouse::onMouseEvent(AInputEvent* event)
{
  if (event == NULL)
    return false;

  int32_t eventAction = AMotionEvent_getAction(event);
  int8_t mouseAction = eventAction & AMOTION_EVENT_ACTION_MASK;
  size_t mousePointer = eventAction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;

  CXBMCApp::android_printf("%s pointer:%i", __PRETTY_FUNCTION__, mousePointer);
  float x = AMotionEvent_getX(event, mousePointer);
  float y = AMotionEvent_getY(event, mousePointer);

  switch (mouseAction)
  {
    case AMOTION_EVENT_ACTION_UP:
    case AMOTION_EVENT_ACTION_DOWN:
      MouseButton(x,y,mouseAction);
      return true;
    default:
      MouseMove(x,y);
      return true;
  }
  return false;
}
예제 #4
0
bool    CCylinderEditCommand::PreTranslateMessage(MSG* pMsg)
{
	try {
		/*if (pMsg->message==WM_KEYUP||
		pMsg->message==WM_CHAR)
		return false;*/

		if (pMsg->message==WM_KEYUP||pMsg->message==WM_KEYDOWN || 
			pMsg->message==WM_CHAR)
		{
			if (pMsg->wParam==VK_RETURN)
			{
				OnEnter();
				return true;
			}
			if (pMsg->wParam==VK_ESCAPE)
			{
				m_app->StopCommander();
				return true;
			}
			if (m_r_panel)
			{
				m_r_panel->GetWindow()->SendMessage(pMsg->message,
					pMsg->wParam,
					pMsg->lParam);
			}
			if (m_other_params_dlg)
			{
				m_other_params_dlg->SendMessage(pMsg->message,
					pMsg->wParam,
					pMsg->lParam);
				return false;
			}
			if (pMsg->message==WM_KEYDOWN)
				return false;
			else 
				return true;
		}
		else
		{
			if (pMsg->hwnd == m_app->GetViewPort()->GetWindow()->m_hWnd)
			{
				switch(pMsg->message) 
				{
				case WM_MOUSEMOVE:
					MouseMove(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam));
					return true;
				case WM_LBUTTONUP:
					LeftClick(pMsg->wParam,GET_X_LPARAM(pMsg->lParam),GET_Y_LPARAM(pMsg->lParam));
					return true;
				default:
					return false;
				}	
			}
		}
	}
	catch(...){
	}
	return false;
}
예제 #5
0
파일: AndroidMouse.cpp 프로젝트: MrMC/mrmc
bool CAndroidMouse::onMouseEvent(AInputEvent* event)
{
  if (event == NULL)
    return false;

  int32_t eventAction = AMotionEvent_getAction(event);
  int8_t mouseAction = eventAction & AMOTION_EVENT_ACTION_MASK;
  size_t mousePointerIdx = eventAction >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
  int32_t mousePointerId = AMotionEvent_getPointerId(event, mousePointerIdx);

#ifdef DEBUG_VERBOSE
  CXBMCApp::android_printf("%s idx:%i, id:%i", __PRETTY_FUNCTION__, mousePointerIdx, mousePointerId);
#endif
  CPoint in(AMotionEvent_getX(event, mousePointerIdx), AMotionEvent_getY(event, mousePointerIdx));
  CPoint out = in * m_droid2guiRatio;

  switch (mouseAction)
  {
    case AMOTION_EVENT_ACTION_UP:
    case AMOTION_EVENT_ACTION_DOWN:
      MouseButton(out.x, out.y, mouseAction, AMotionEvent_getButtonState(event));
      return true;
    case AMOTION_EVENT_ACTION_SCROLL:
      MouseWheel(out.x, out.y, AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_VSCROLL, mousePointerIdx));
      return true;
    default:
      MouseMove(out.x, out.y);
      return true;
  }
  return false;
}
예제 #6
0
파일: VertexAdd.cpp 프로젝트: hkaiser/TRiAS
// --------------------------------------------------------------------------------------------
// Interface ITRiASSysNotificationSink: WindowsNotification's abfangen
STDMETHODIMP CVertexAdd::WindowsMessage (long hWnd, long uiMsg, long wParam, long lParam)
{
	switch (uiMsg)
	{
		case WM_KEYDOWN:
			KeyDown ((HWND)hWnd, wParam);
    		break;
		
		case WM_KEYUP:
			KeyUp (wParam);
    		break;

		case WM_MOUSEMOVE:
			MouseMove (lParam);
    		break;

		case WM_LBUTTONDOWN:
			LeftMouseDown();
			break;

		case WM_LBUTTONUP:
			LeftMouseUp (lParam);
	}

    return S_OK;	// immer weiterleiten

} // WindowsMessage
예제 #7
0
void InputContext::TriggerMouseEvent(MouseEvent &mouse)
{
    emit MouseEventReceived(&mouse);

    switch(mouse.eventType)
    {
    case MouseEvent::MouseMove: emit MouseMove(&mouse); break;
    case MouseEvent::MouseScroll: emit MouseScroll(&mouse); break;
    case MouseEvent::MousePressed:
        switch(mouse.button)
        {
        case MouseEvent::LeftButton: emit MouseLeftPressed(&mouse); break;
        case MouseEvent::RightButton: emit MouseRightPressed(&mouse); break;
        case MouseEvent::MiddleButton: emit MouseMiddlePressed(&mouse); break;
            ///\todo XButton1 and XButton2 support?
        }
        break;
    case MouseEvent::MouseReleased: 
        switch(mouse.button)
        {
        case MouseEvent::LeftButton: emit MouseLeftReleased(&mouse); break;
        case MouseEvent::RightButton: emit MouseRightReleased(&mouse); break;
        case MouseEvent::MiddleButton: emit MouseMiddleReleased(&mouse); break;
            ///\todo XButton1 and XButton2 support?
        }
        break;
    case MouseEvent::MouseDoubleClicked: emit MouseDoubleClicked(&mouse); break;
    default:
        assert(false);
        break;
    }
}
int TextArea::DoMouse( int type, float x, float y, int button, int state )
{
    if (type == 1) return MouseClick( button, state, x, y );
    if (type == 2) return MouseMoveClick( x, y );
    if (type == 3) return MouseMove( x, y );
    return 0;
}
예제 #9
0
bool basic_mouse_handler::eventFilter(QObject* target, QEvent* ev)
{
	// !m_target is for future proofing when gsrender isn't automatically initialized on load to ensure events still occur
	// !m_target->isVisible() is a hack since currently a guiless application will STILL inititialize a gsrender (providing a valid target)
	if (!m_target || !m_target->isVisible() || target == m_target)
	{
		switch (ev->type())
		{
		case QEvent::MouseButtonPress:
			MouseButtonDown(static_cast<QMouseEvent*>(ev));
			break;
		case QEvent::MouseButtonRelease:
			MouseButtonUp(static_cast<QMouseEvent*>(ev));
			break;
		case QEvent::MouseMove:
			MouseMove(static_cast<QMouseEvent*>(ev));
			break;
		case QEvent::Wheel:
			MouseScroll(static_cast<QWheelEvent*>(ev));
			break;
		default:
			return false;
		}
	}
	return false;
}
예제 #10
0
static	void	MouseUp( HWND w, DWORD l )
{
WORD	id ;
HWND	hwnd ;
WORD	cmd ;
LPARAM	lparam ;
WPARAM	wparam ;

	id = GetDlgCtrlID(w) ;
	hwnd = w ;
	cmd = BN_CLICKED ;
#ifdef WIN32
	lparam = (LPARAM)hwnd ;
	wparam = MAKEWPARAM(id,cmd) ;
#else
	wparam = (WPARAM)id ;
	lparam = MAKELPARAM(hwnd,cmd) ;
#endif

	if ( TstState( FB_CAPTURING ) )
		{

		MouseMove( w, l ) ;

		ReleaseCapture() ;
		ClrState( FB_TO_SET | FB_CAPTURING ) ;

		if ( TstState( (WORD)FB_SELECTED ) )
			MakeRadioIteration( w ) ;
		SendMessage( GetParent( w ), WM_COMMAND,
			wparam , lparam) ;
		}
}
void HelloWorld::onTouchMoved(Touch* touch, Event* event){
    auto touchLocation = touch->getLocation();
    auto nodePosition = convertToNodeSpace( touchLocation );
    
    log("Box2DView::onTouchMoved, pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y);
    
    MouseMove(b2Vec2(nodePosition.x*PTM_RATIO,nodePosition.y*PTM_RATIO));
}
예제 #12
0
void idUsercmdGenLocal::MakeCurrent( void ) {

	idVec3		oldAngles;

	int		i;

	oldAngles = viewangles;

	if ( !Inhibited() )
	{
		// update toggled key states
		toggled_crouch.SetKeyState( ButtonState( UB_DOWN ), in_toggleCrouch.GetBool() );
		toggled_run.SetKeyState( ButtonState( UB_SPEED ), in_toggleRun.GetBool() && idAsyncNetwork::IsActive() );
		toggled_zoom.SetKeyState( ButtonState( UB_ZOOM ), in_toggleZoom.GetBool() );

		// keyboard angle adjustment
		AdjustAngles();

		// set button bits
		CmdButtons();

		// get basic movement from keyboard
		KeyMove();

		// get basic movement from mouse
		MouseMove();

		// get basic movement from joystick
		JoystickMove();

		// check to make sure the angles haven't wrapped
		if ( viewangles[PITCH] - oldAngles[PITCH] > 90 )
		{
			viewangles[PITCH] = oldAngles[PITCH] + 90;
		}
		else if ( oldAngles[PITCH] - viewangles[PITCH] > 90 )
		{
			viewangles[PITCH] = oldAngles[PITCH] - 90;
		} 
	}
	else
	{
		mouseDx = 0;
		mouseDy = 0;
	}

	for ( i = 0; i < 3; i++ )
	{
		cmd.angles[i] = ANGLE2SHORT(viewangles[i]);
	}

	cmd.mx = continuousMouseX;
	cmd.my = continuousMouseY;

	flags = cmd.flags;
	impulse = cmd.impulse;

}
예제 #13
0
NS_IMETHODIMP
HTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
{
  nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
  if (NS_WARN_IF(!mouseEvent)) {
    return NS_OK;
  }
  return MouseMove(mouseEvent);
}
예제 #14
0
void EventMgr::SetFocused(Window *win, Control *ctrl)
{
	last_win_focused = win;
	last_win_focused->SetFocused(ctrl);
	//this is to refresh changing mouse cursors should the focus change)
	int x,y;
	core->GetVideoDriver()->GetMousePos(x,y);
	MouseMove((unsigned short) x, (unsigned short) y);
}
예제 #15
0
bool InputEventHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*) 
{ 
	osgViewer::View* const view = dynamic_cast<osgViewer::View*>(&aa);
	if (view && view->getViewerBase()) {
		osgGA::GUIEventAdapter::EventType eventType = ea.getEventType();
		switch (eventType) 
		{
			case osgGA::GUIEventAdapter::KEYDOWN:
			{
				KeyDown(ea, aa);
				break;
			}
			case osgGA::GUIEventAdapter::KEYUP:
			{
				KeyUp(ea, aa);
				break;
			}

			case osgGA::GUIEventAdapter::DRAG:
			case osgGA::GUIEventAdapter::MOVE:
			{
				MouseMove(ea, aa);
				break;
			}

			case osgGA::GUIEventAdapter::PUSH:
			{
				MouseButtonDown(ea, aa);
				break;
			}

			case osgGA::GUIEventAdapter::RELEASE:
			{
				MouseButtonRelease(ea, aa);
				break;
			}

			case osgGA::GUIEventAdapter::FRAME:
			{
				m_frameCount ++;
				break;
			}

			case osgGA::GUIEventAdapter::CLOSE_WINDOW:
			case osgGA::GUIEventAdapter::QUIT_APPLICATION:
			{
				m_applicationTerminated = true;
				break;
			}

			default:
				break;
		}
	}

	return false;
}
예제 #16
0
LRESULT Window::WindowMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_SHOWWINDOW:
		Initialize();
		break;

	case WM_SIZE:
		Resize();
		break;

	case WM_PAINT:
		Render();
		break;

	case WM_LBUTTONDOWN:
		MouseDown();
		break;

	case WM_MOUSEMOVE:
		MouseMove();
		break;

	case WM_LBUTTONUP:
		MouseUp();
		break;

	case WM_KEYDOWN:
		switch (wParam)
		{
		
		case 0x50: //P
			_displayPointLight = !_displayPointLight;
			Render();
			break;
		
		case 0x44: //D
			_displayDirectionalLight = !_displayDirectionalLight;
			Render();
			break;
		}
		break;

	case WM_DESTROY:
		Destroy();
		PostQuitMessage(0);
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
		break;
	}

	return 0;
}
예제 #17
0
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	// birdpoop: let's do some xinput stuff ourself.
	cmd->ltrigger = 0.f;
	cmd->rtrigger = 0.f;

	// Maybe do something better in the future but for demo purposes we'll always have a controller attached
	// so it's safe to assume some things we wouldn't normally assume.
	XINPUT_STATE controllerstate;
	ZeroMemory( &controllerstate, sizeof(XINPUT_STATE) );
 
	if (ERROR_SUCCESS == XInputGetState( 0, &controllerstate ) )
	{
		// Trigger input is 8bit int, let's make it 0 - 1
		cmd->ltrigger = (float)controllerstate.Gamepad.bLeftTrigger / 255;
		cmd->rtrigger = (float)controllerstate.Gamepad.bRightTrigger / 255;
	}

	JoyStickMove( frametime, cmd);

	// NVNT if we have a haptic device..
	if(haptics && haptics->HasDevice())
	{
		if(engine->IsPaused() || engine->IsLevelMainMenuBackground() || vgui::surface()->IsCursorVisible() || !engine->IsInGame())
		{
			// NVNT send a menu process to the haptics system.
			haptics->MenuProcess();
			return;
		}
#ifdef CSTRIKE_DLL
		// NVNT cstrike fov grabing.
		C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
		if(player){
			haptics->UpdatePlayerFOV(player->GetFOV());
		}
#endif
		// NVNT calculate move with the navigation on the haptics system.
		haptics->CalculateMove(cmd->forwardmove, cmd->sidemove, frametime);
		// NVNT send a game process to the haptics system.
		haptics->GameProcess();
#if defined( WIN32 ) && !defined( _X360 )
		// NVNT update our avatar effect.
		UpdateAvatarEffect();
#endif
	}


}
예제 #18
0
LRESULT CALLBACK EditorWindow::WindowsProcedure(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	int xPos, yPos;
	static HINSTANCE hInst = GetModuleHandle(NULL);
	HWND hBufferHwnd;
	char s[100];
	IDevice* device;
	int cxClient, cyClient;
	EditorScene* scene = EditorScene::getInstance();
	switch (msg)
	{
	case WM_CREATE:
		OnCreate(hInst, hwnd);
		break;
	case WM_SIZE:
		cxClient = LOWORD(lParam);
		cyClient = HIWORD(lParam);
		OnSize(cxClient, cyClient);
		break;
	case WM_LBUTTONDOWN:
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		MouseLeftButtonDown(xPos, yPos);
		break;
	case WM_RBUTTONDOWN:
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		MouseRightButtonDown(xPos, yPos);
		break;
	case WM_RBUTTONUP:
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		MouseRightButtonUp(xPos, yPos);
		break;
	case WM_MOUSEMOVE:
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		MouseMove(xPos, yPos);
		break;
	case WM_LBUTTONDBLCLK:
		xPos = LOWORD(lParam);
		yPos = HIWORD(lParam);
		MouseDoubleClicked(xPos, yPos);
		break;
	case WM_COMMAND:
		OnCommand(LOWORD(wParam), HIWORD(wParam), wParam, lParam);
		break;
	case WM_CTLCOLORSTATIC:
		SetTextColor((HDC)wParam, RGB(230,0,0));   // iTextColor is the RGB() color you want for the text
		SetBkColor((HDC)wParam, RGB(230, 0, 0));  // iBkColor is the color you want for the text background 
		return (LRESULT)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
	}

	return 0;
}
예제 #19
0
파일: system_win32.c 프로젝트: 10n1/Riot
static LRESULT CALLBACK MainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
    static system_t*    s_system = NULL;
    CREATESTRUCT*       createStruct;
    int                 width;
    int                 height;
    switch (message) 
    {
    case WM_CREATE:
        createStruct = ((CREATESTRUCT*)lParam);
        s_system = createStruct->lpCreateParams;
        return 0;
    /* Keyboard input */
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
        SetKeyState(s_system, (uint8_t)wParam, 1);
        // Handle Alt-F4 here. TODO: Support disabling it
        if(GetKeyState(kSysKeyF4) && GetKeyState(kSysKeyAlt))
            PostQuitMessage(0);
        return 0;
    case WM_KEYUP:
    case WM_SYSKEYUP:
        SetKeyState(s_system, (uint8_t)wParam, 0);
        // Handle Alt-F4 here. TODO: Support disabling it
        if(GetKeyState(kSysKeyF4) && GetKeyState(kSysKeyAlt))
            PostQuitMessage(0);
        return 0;
    case WM_SIZE:
        if(s_system->resizeCallback)
        {
            width = LOWORD(lParam);
            height = HIWORD(lParam);
            s_system->resizeCallback(width, height);
        }
        return 0;
    
    /* Mouse input */
    case WM_MOUSEMOVE:
        {
            POINTS pos = MAKEPOINTS(lParam);
            MouseMove(s_system, pos.x, pos.y);
        }
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN:
    case WM_MBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_RBUTTONUP:
    case WM_MBUTTONUP:
        SetMouseState(s_system, (int)wParam);
        return 0;
    }

    return DefWindowProc(hWnd, message, wParam, lParam);
}
예제 #20
0
/* Pointer event. */
int override DispatchPointer(const TASKMSG *msg)
{
	RETURN_IF_NULL(msg);
	int cmd = msg->data1;
	switch (cmd) {
	case POINTER_UP: return MouseUp(msg->data2, msg->data3, msg->data4);
	case POINTER_DOWN: return MouseDown(msg->data2, msg->data3, msg->data4);
	case POINTER_MOVE: return MouseMove(msg->data2, msg->data3, msg->data4);
	case POINTER_WHEEL: return MouseWheel(msg->data2, msg->data3, msg->data4);
	}
	return 0;
}
예제 #21
0
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);
}
예제 #22
0
LRESULT GEN::GameEngine::HandleEvent(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
	// Route Windows messages to game engine member functions
	switch (msg)
	{
	case WM_SETFOCUS:
		// Activate the game and update the Sleep status
		GameActivate(hWindow);
		SetSleep(FALSE);
		return 0;
	case WM_KILLFOCUS:
		// Deactivate the game and update the Sleep status
		GameDeactivate(hWindow);
		SetSleep(TRUE);
		return 0;
	case WM_PAINT:
		HDC         hDC;
		PAINTSTRUCT ps;
		hDC = BeginPaint(hWindow, &ps);

		// Paint the game
		GamePaint(hDC);

		EndPaint(hWindow, &ps);
		return 0;
	case MM_MCINOTIFY:
		if (LOWORD(wParam) == MCI_NOTIFY_SUCCESSFUL)
		{
			if (GetMIDIPlayer() != nullptr)
				GetMIDIPlayer()->Restart(hWindow);
		}
		return 0;
		// Mouse Input Cases
	case WM_LBUTTONDOWN:
		// handle mouse button 
		MouseButtonDown(LOWORD(lParam), HIWORD(lParam), TRUE);
		return 0;
	case WM_LBUTTONUP:
		MouseButtonUp(LOWORD(lParam), HIWORD(lParam), TRUE);
		return 0;
	case WM_RBUTTONDOWN:
		MouseButtonDown(LOWORD(lParam), HIWORD(lParam), FALSE);
		return 0;
	case WM_RBUTTONUP:
		MouseButtonUp(LOWORD(lParam), HIWORD(lParam), FALSE);
		return 0;
	case WM_MOUSEMOVE:
		MouseMove(LOWORD(lParam), HIWORD(lParam));
		return 0;
	}
	return DefWindowProc(hWindow, msg, wParam, lParam);
}
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);
#ifdef C17_HAPTICS
	cliHaptics->HapticsMove  ( frametime, cmd); // Haptics addition
#endif
}
예제 #24
0
nsresult
nsSplitterFrameInner::HandleEvent(nsIDOMEvent* aEvent)
{
  nsAutoString eventType;
  aEvent->GetType(eventType);
  if (eventType.EqualsLiteral("mouseup"))
    return MouseUp(aEvent);
  if (eventType.EqualsLiteral("mousedown"))
    return MouseDown(aEvent);
  if (eventType.EqualsLiteral("mousemove") ||
      eventType.EqualsLiteral("mouseout"))
    return MouseMove(aEvent);

  NS_ABORT();
  return NS_OK;
}
예제 #25
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_CREATE:
			//初始化
			Init(hWnd, wParam, lParam);
			break;
		case WM_PAINT:
			//绘制
			Render(hWnd);
			break;
		case WM_KEYDOWN:
			//键盘按下事件
			if (GameStart) KeyDown(hWnd, wParam, lParam);
			break;
		case WM_KEYUP:
			//键盘松开事件
			if (GameStart && m_hero.alive) KeyUp(hWnd, wParam, lParam);
			break;
		case WM_MOUSEMOVE:
			//鼠标移动事件
			MouseMove(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONDOWN:
			//左鼠标事件
			LeftKeyDown = TRUE;
			LButtonDown(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONUP:
			LeftKeyDown = FALSE;
			LButtonUp(hWnd, wParam, lParam);
			break;
		case WM_TIMER:
			//定时器事件
			TimerUpdate(hWnd, wParam, lParam);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
			break;
	}
	return 0;
}
예제 #26
0
//+---------------------------------------------------------------------------
//
//  Member:     CScrollbarController::OnMessage
//              
//  Synopsis:   Handle messages sent to this scroll bar controller.
//              
//  Arguments:  
//              
//  Notes:      
//              
//----------------------------------------------------------------------------
LRESULT CScrollbarController::OnMessage(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_MOUSEMOVE:
		MouseMove(CPoint(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y));
		break;

	case WM_LBUTTONDBLCLK:
	case WM_LBUTTONDOWN:
		AssertSz(FALSE, "CScrollbarController got unexpected message");
		break;

	case WM_LBUTTONUP:
		if(_partPressed != SBP_NONE)
		{
			// invalidate just the part that was pressed
			_partPressed = SBP_NONE;
			CSize scrollOffset;
			_pDispScroller->GetScrollOffset(&scrollOffset);
			LONG containerSize = _rcScrollbar.Size(_direction);
			Verify(_pLayout->OpenView());
			InvalidatePart(
				_partPressedStart,
				_direction,
				_rcScrollbar,
				_pDispScroller->GetContentSize()[_direction],
				containerSize,
				scrollOffset[_direction],
				_buttonWidth,
				_pDispScroller,
				&_drawInfo);
		}

		// fall thru to Terminate...
	case WM_CAPTURECHANGED:
		goto Terminate;
	}

	return 0;

Terminate:
	StopScrollbarController();
	return 0;
}
예제 #27
0
파일: GraphView.cpp 프로젝트: ke2ny/MoBu
//! input callback.
void GraphView::ViewInput(int pMouseX,int pMouseY,FBInputType pAction,int pButtonKey,int pModifier)
{
	switch(pAction)
	{
	case kFBKeyPress:
		{
			UserInput(pMouseX, pMouseY, pButtonKey, pModifier);
		}
		break;

	case kFBButtonPress:
		{
		// register mouse down in viewport
		mDown = true;
		mLastX = pMouseX;
		mLastY = pMouseY;

		if (pModifier == kFBKeyAlt)
			if (pButtonKey == 2)	// middle button click
				SetManipulator( MANIPULATOR_GRAPH_PAN );
			else if (pButtonKey == 3)	// right button click
				SetManipulator( MANIPULATOR_GRAPH_ZOOM );


		// do some action below
		MouseDown(pMouseX, pMouseY, pModifier);
		} break;
	case kFBButtonRelease:
		// do some action below
		MouseUp(pMouseX, pMouseY, pModifier);
		// release button
		mDown = false;

		ClearManipulator();
		break;
	case kFBMotionNotify:
		// do some action
		MouseMove(pMouseX, pMouseY, pModifier);
		
		// lastx, lasty
		mLastX = pMouseX;
		mLastY = pMouseY;
		break;
	}
}
예제 #28
0
LRESULT Client::HandleEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) 
	{
	case WM_SOCKET:
		sPlayerMain.OnSocketEvent(wParam, WSAGETSELECTERROR(lParam), WSAGETSELECTEVENT(lParam));
		return 0;
	case WM_CREATE:
		LoadContent();
		return 0;

	case WM_KEYDOWN:
		KeyDown(wParam);
		return 0;

	case WM_PAINT:	
		Draw(hwnd);
		return 0;

	case WM_LBUTTONDBLCLK:
		MouseLDButtonDown(lParam);
		return 0;

	case WM_MBUTTONDOWN:
		MouseMButtonDown(lParam);
		return 0;

	case WM_LBUTTONDOWN:
		MouseLButtonDown(lParam);
		return 0;

	case WM_RBUTTONDOWN:
		MouseRButtonDown(lParam);
		return 0;

	case WM_MOUSEMOVE:
		MouseMove(lParam);
		return 0;

	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;
	}
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
예제 #29
0
NS_IMETHODIMP
nsWidgetUtils::HandleEvent(nsIDOMEvent* aDOMEvent)
{
  nsAutoString eventType;
  aEvent->GetType(eventType);

  if (eventType.EqualsLiteral("mousedown")) {
    return MouseDown(aEvent);
  }
  if (eventType.EqualsLiteral("mouseup")) {
    return MouseUp(aEvent);
  }
  if (eventType.EqualsLiteral("mousemove")) {
    return MouseMove(aEvent);
  }

  return NS_OK;
}
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);

#ifdef C17_HAPTICS
	cliHaptics->HapticsMove(frametime, cmd); // Haptics addition
#endif

	// NVNT if we have a haptic device..
	if(haptics && haptics->HasDevice())
	{
		if(engine->IsPaused() || engine->IsLevelMainMenuBackground() || vgui::surface()->IsCursorVisible() || !engine->IsInGame())
		{
			// NVNT send a menu process to the haptics system.
			haptics->MenuProcess();
			return;
		}
#ifdef CSTRIKE_DLL
		// NVNT cstrike fov grabing.
		C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
		if(player){
			haptics->UpdatePlayerFOV(player->GetFOV());
		}
#endif
		// NVNT calculate move with the navigation on the haptics system.
		haptics->CalculateMove(cmd->forwardmove, cmd->sidemove, frametime);
		// NVNT send a game process to the haptics system.
		haptics->GameProcess();
#if defined( WIN32 ) && !defined( _X360 )
		// NVNT update our avatar effect.
		UpdateAvatarEffect();
#endif
	}


}