Example #1
0
void InputHandler::update() {
	SDL_Event evt;
	onMouseButtonUp();
	while (SDL_PollEvent(&evt)) {
		switch (evt.type) {
		case SDL_QUIT:
			TheGame::Instance()->quit();
			break;
		case SDL_MOUSEMOTION:
			onMouseMove(evt);
			break;
		case SDL_MOUSEBUTTONDOWN:
			onMouseButtonDown(evt);
			break;
		case SDL_MOUSEBUTTONUP:
			onMouseButtonUp();
			break;
		case SDL_KEYDOWN:
			onKeyDown();
			break;
		case SDL_KEYUP:
			onKeyUp();
			break;
		default:
			break;
		}
	}
}
bool WebPluginScrollbarImpl::handleInputEvent(const WebInputEvent& event)
{
    switch (event.type) {
    case WebInputEvent::MouseDown:
        return onMouseDown(event);
    case WebInputEvent::MouseUp:
        return onMouseUp(event);
    case WebInputEvent::MouseMove:
        return onMouseMove(event);
    case WebInputEvent::MouseLeave:
        return onMouseLeave(event);
    case WebInputEvent::MouseWheel:
        return onMouseWheel(event);
    case WebInputEvent::KeyDown:
        return onKeyDown(event);
    case WebInputEvent::Undefined:
    case WebInputEvent::MouseEnter:
    case WebInputEvent::RawKeyDown:
    case WebInputEvent::KeyUp:
    case WebInputEvent::Char:
    case WebInputEvent::TouchStart:
    case WebInputEvent::TouchMove:
    case WebInputEvent::TouchEnd:
    case WebInputEvent::TouchCancel:
    default:
         break;
    }
    return false;
}
Example #3
0
LRESULT Window::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) 
{
	switch (uMsg) {
		case WM_CREATE: { if (onCreate()) break; return 0; }
		case WM_DESTROY: { if (onDestroy()) break; return 0; }
		case WM_CLOSE: { if (onClose()) break; return 0; }
		case WM_MOUSEMOVE: { if (onMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) break; return 0; }
		case WM_LBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; }
		case WM_RBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; }
		case WM_MBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; }
		case WM_LBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; }
		case WM_RBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; }
		case WM_MBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; }
		case WM_PAINT: { if (onPaint()) break; return 0; }
		case WM_SIZE: { if (onSizeChanged()) break; return 0; }
		case WM_KEYDOWN: { if (onKeyDown((UINT)wParam)) break; return 0; }
		case WM_KEYUP: { if (onKeyUp((UINT)wParam)) break; return 0; }
		case WM_COMMAND: {
			if (SendMessage(reinterpret_cast<HWND>(lParam), WM_COMMAND_REFLECT, wParam, lParam))
				break;
			return 0;
		}
	}
	if (mBaseWndProc != sGlobalWndProc) {
		LRESULT r = CallWindowProc(mBaseWndProc, mHWND, uMsg, wParam, lParam);
		return r;
	} else {
		LRESULT r = DefWindowProc(mHWND, uMsg, wParam, lParam);
		return r;
	}
}
bool OSGDrawingArea::on_motion_notify_event (GdkEventMotion* pEvent)
{
#ifdef DEBUG
    //??std::cout <<  "OSGDrawingArea::onMouseMoveInternal()<<" << std::endl;
#endif

    //
    //
    // Since we are using the POINTER_MOTION_HINT_MASK mask we need to call this on any event.
    if (pEvent->is_hint)
    {
        int lX, lY;
        Gdk::ModifierType lState;
        get_window ()->get_pointer (lX, lY, lState);
        pEvent->x = lX;
        pEvent->y = lY;//?????????get_height () - lY - 1;
        pEvent->state = lState;
    }//if

    bool lRetVal = onMouseMove (pEvent);

#ifdef DEBUG
    //??std::cout <<  "OSGDrawingArea::onMouseMoveInternal()>>" << std::endl;
#endif//
    return lRetVal;
}
Example #5
0
void Record::mouseMoveEvent(QMouseEvent *event) {
    if(event->buttons() & Qt::LeftButton) {

        if (event->pos().y() > 50){
            QPoint movePoint(this->x(), this->y() + 50);
            m_RowPosition++;
            if (movePoint.y() < 0 || (movePoint.y() + this->height()) > parentWidget()->height())
                return;
            this->move(movePoint);
        }
        else if (event->pos().y() < 0) {
            QPoint movePoint(this->x(), this->y() - 50);
            m_RowPosition--;
            if (movePoint.y() < 0 || (movePoint.y() + this->height()) > parentWidget()->height())
                return;
            this->move(movePoint);
        }
        else {
            QPoint movePoint(this->x() + (event->pos().x() - dragMouseOffsetX), this->y());
            if (movePoint.x() < 0 || (movePoint.x() + this->width()) > parentWidget()->width())
                return;
            this->move(movePoint);
            m_StartTime = this->x() * 100;
            m_EndTime = (m_StartTime + m_Duration);
            onMouseMove(m_Id, m_StartTime, m_EndTime, m_Name);
        }
    }
    event->ignore();
}
Example #6
0
bool UIView::processTouchMove(int x, int y)
{
	onMouseMove();

	for(std::vector<UIView*>::iterator it = m_children.begin(); it != m_children.end(); it++)
	{
		FloatRect controlRect = (*it)->getBounds();
		FloatRect testRect(controlRect.left, controlRect.top, controlRect.width - 1, controlRect.height - 1);

		(*it)->processTouchMove(x,y);

		if(testRect.contains(x,y))
		{
			if(!(*it)->m_hovered)
			{
				(*it)->setPseudoClass("hover", true);
				(*it)->m_hovered = true;
			}
		}
		else
		{
			// mouse is not in it, is it just leaving now?
			if((*it)->m_hovered)
			{
				(*it)->setPseudoClass("hover", false);
				(*it)->onMouseLeave();
				(*it)->m_hovered = false;
			}
		}
	}

	return false;
}
Example #7
0
void handleMouse(float dt)
{
	// hide cursor if rmb is down
	if (isMousePress(2)) {
		ShowCursor(false);
	} else if (isMouseRelease(2)) {
		ShowCursor(true);
	}
	POINT pt;
	GetCursorPos(&pt);
	ScreenToClient(g_hwnd, &pt);
	onMouseMove(pt.x, pt.y);
	if (isMouseDown(2)) {
		if (isMousePress(2)) {
			g_hold_x = pt.x;
			g_hold_y = pt.y;
		}
		// recenter the cursor
		POINT pt;
		pt.x = g_hold_x;
		pt.y = g_hold_y;
		ClientToScreen(g_hwnd, &pt);
		SetCursorPos(pt.x, pt.y);
		g_mouse_x = g_hold_x;
		g_mouse_y = g_hold_y;
	}
}
void motionFunc(int x, int y)
{
    // redirect the message to the viewer instance
    onMouseMove(x, Height - y - 1);
    
    //mgr->mouseMove(x, y);
}
Example #9
0
bool EventListenerMouse::init()
{
    auto listener = [this](Event* event){
        auto mouseEvent = static_cast<EventMouse*>(event);
        switch (mouseEvent->_mouseEventType)
        {
            case EventMouse::MouseEventType::MOUSE_DOWN:
                if(onMouseDown != nullptr)
                    onMouseDown(event);
                break;
            case EventMouse::MouseEventType::MOUSE_UP:
                if(onMouseUp != nullptr)
                    onMouseUp(event);
                break;
            case EventMouse::MouseEventType::MOUSE_MOVE:
                if(onMouseMove != nullptr)
                    onMouseMove(event);
                break;
            case EventMouse::MouseEventType::MOUSE_SCROLL:
                if(onMouseScroll != nullptr)
                    onMouseScroll(event);
                break;
            default:
                break;
        }
    };

    if (EventListener::init(Type::MOUSE, static_cast<ListenerID>(Type::MOUSE), listener))
    {
        return true;
    }

    return false;
}
//--------------------------------------------------------------
void ofxMSAInteractiveObject::_mouseMoved(ofMouseEventArgs &e) {
	int x = e.x;
	int y = e.y;
	int button = e.button;
    
    if(doCoordTransformation){
        ofVec2f transformedCoord = screenToCanvas(ofVec2f(x,y));
        x = transformedCoord.x;
        y = transformedCoord.y;
    }
    
	if(verbose) printf("ofxMSAInteractiveObject::_mouseMoved(x: %i, y: %i)\n", x, y);
	if(!enabled) return;
	
//	_mouseX = x;
//	_mouseY = y;
	
	if(hitTest(x, y)) {						// if mouse is over the object
		if(!_isMouseOver) {						// if wasn't over previous frame
			_isMouseOver = true;						// update flag
			onRollOver(x, y);						// call onRollOver
		}
		onMouseMove(x, y);						// and trigger onMouseMove
	} else if(_isMouseOver) {					// if mouse is not over the object, but the flag is true (From previous frame)
		onRollOut();							// call onRollOut
		_isMouseOver = false;						// update flag
	}
    
    _stateChangeTimestampMillis = ofGetElapsedTimeMillis();

    mouseMoved(x, y);
}
Example #11
0
void InteractiveObject::handleEvent(const Event &event)
{
    if (event.type == MouseEvent::MOUSE_MOVE || event.type == MouseEvent::CLICK || event.type == MouseEvent::MOUSE_DOWN || event.type == MouseEvent::MOUSE_UP)
    {
        MouseEvent* st = (MouseEvent*)(&event);
        bool hit = hitTestPoint(st->getX(), st->getY());
        if (event.type == MouseEvent::MOUSE_MOVE)
        {
            onMouseMove(event);
            if (isHovered)
            {
                if (!hit)
                {
                    onMouseOut(event);
                    dispatchEvent(MouseEvent(this, MouseEvent::MOUSE_OUT, st->getX(), st->getY()));
                    isHovered = !isHovered;
                }

            }
            else
            {
                if (hit)
                {
                    onMouseOver(event);
                    dispatchEvent(MouseEvent(this, MouseEvent::MOUSE_OVER, st->getX(), st->getY()));
                    isHovered = !isHovered;
                }
            }
        }
        else if (hit)
        {
            dispatchEvent(MouseEvent(this, event.type, st->getX(), st->getY()));
        }
    }
}
Example #12
0
void InputSystem::handleEvent(Event *event)
{
    switch(event->getType())
    {
    case Event::KeyUp:
        onKeyUp(static_cast<KeyEvent*> (event));
        break;
    case Event::KeyDown:
        onKeyDown(static_cast<KeyEvent*> (event));
        break;
    case Event::MouseLeave:
        mouseControl = false;
        {
            Player *player = game->getPlayer();
            if(player)
            {
                Vector2 velocity = player->getVelocity();
                velocity.x = 0.0f;
                player->setVelocity(velocity);
            }
        }
        break;
    case Event::MouseMove:
        onMouseMove(static_cast<MouseMoveEvent*> (event));
        break;
    default:
        // Do nothing
        break;
    }
}
Example #13
0
// Simple main loop
void mainLoop()
{
    // Window is not minimized
    bool active = true;

    for(;;)// Infinite loop
    {
        SDL_Event event;

        // Wait for event
        if(SDL_WaitEvent(&event) == 0) throw SDL_Exception();

        // Screen needs redraw
        bool redraw = false;

        // Handle all waiting events
        do
        {
            camera += cam_velocity;
            // Call proper event handlers
            switch(event.type)
            {
                case SDL_ACTIVEEVENT : // Stop redraw when minimized
                    if(event.active.state == SDL_APPACTIVE)
                        active = event.active.gain;
                    break;
                case SDL_KEYDOWN :
                    onKeyDown(event.key.keysym.sym, event.key.keysym.mod);
                    break;
                case SDL_KEYUP :
                    onKeyUp(event.key.keysym.sym, event.key.keysym.mod);
                    break;
                case SDL_MOUSEMOTION :
                    onMouseMove(event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel, event.motion.state);
                    break;
                case SDL_MOUSEBUTTONDOWN :
                    onMouseDown(event.button.button, event.button.x, event.button.y);
                    break;
                case SDL_MOUSEBUTTONUP :
                    onMouseUp(event.button.button, event.button.x, event.button.y);
                    break;
                case SDL_QUIT :
                    return; // End main loop
                case SDL_VIDEORESIZE :
                    onWindowResized(event.resize.w, event.resize.h);
                    break;
                case SDL_VIDEOEXPOSE :
                    redraw = true;
                    break;
                default : // Do nothing
                    break;
            }
        } while(SDL_PollEvent(&event) == 1);

        // Optionally redraw window
        if(active && redraw) onWindowRedraw();
    }
}
Example #14
0
		void Window::InputLoop()//TODO bad function, but already I not have any idea.
		{
			Events::EventArgs stdArg;
			sf::Event ev;
			bool con;

			while (settings.opened && window.isOpen())
			{
				mutexGraph.lock();
				con = window.pollEvent(ev);
				mutexGraph.unlock();
				while(con)// must use var opened because if window was closed after previous condition and before pollEvent program tried call to nullptr object
				{
					switch (ev.type) {
					case sf::Event::EventType::Closed:
						onClose(); break;
					case sf::Event::EventType::GainedFocus:
						OnEvent<Events::EventArgs>(GainedFocus, &GainedFocusAsync, stdArg); break;
					case sf::Event::EventType::LostFocus:
						OnEvent<Events::EventArgs>(LostFocus, &LostFocusAsync, stdArg); break;
					case sf::Event::EventType::Resized:
						OnEvent<Events::ResizeArgs>(Resize, &ResizeAsync, ev.size); break;
					case sf::Event::EventType::JoystickButtonPressed:
						OnEvent<Events::JoystickButtonArgs>(JoystickButtonPressed, &JoystickButtonPressedAsync, ev.joystickButton); break;
					case sf::Event::EventType::JoystickButtonReleased:
						OnEvent<Events::JoystickButtonArgs>(JoystickButtonRelease, &JoystickButtonReleaseAsync, ev.joystickButton); break;
					case sf::Event::EventType::JoystickConnected:
						OnEvent<Events::JoystickArgs>(JoystickConnect, &JoystickConnectAsync, ev.joystickConnect); break;
					case sf::Event::EventType::JoystickDisconnected:
						OnEvent<Events::JoystickArgs>(JoystickDisconnect, &JoystickDisconnectAsync, ev.joystickConnect); break;
					case sf::Event::EventType::JoystickMoved:
						OnEvent<Events::JoystickMoveArgs>(JoystickMove, &JoystickMoveAsync, ev.joystickMove); break;
					case sf::Event::EventType::KeyPressed:
						onKeyPressed(ev.key); break;
					case sf::Event::EventType::KeyReleased:
						onKeyRelease(ev.key); break;
					case sf::Event::EventType::MouseButtonPressed:
						onClick(ev.mouseButton); break;
					case sf::Event::EventType::MouseButtonReleased:
						onReleaseMouse(ev.mouseButton); break;
					case sf::Event::EventType::MouseEntered:
						OnEvent<Events::EventArgs>(MouseEnter, &MouseEnterAsync, stdArg); break;
					case sf::Event::EventType::MouseLeft:
						OnEvent<Events::EventArgs>(MouseLeft, &MouseLeftAsync, stdArg); break;
					case sf::Event::EventType::MouseMoved:
						onMouseMove(ev.mouseMove); break;
					case sf::Event::EventType::MouseWheelScrolled:
						OnEvent<Events::MouseWheelArgs>(MouseWheel, &MouseWheelAsync, ev.mouseWheel); break;
					case sf::Event::EventType::TextEntered:
						onTextType(ev.text); break;
					}
					mutexGraph.lock();
					con = window.pollEvent(ev);
					mutexGraph.unlock();
				};
				onWindowRender();
			}
		}
Example #15
0
File: mhcmd.c Project: yzh/yzhack
/*-------------------------------------------------------------------------*/
LRESULT CALLBACK NHCommandWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PNHCmdWindow data;
	int i;

	switch (message) 
	{
	case WM_CREATE:
		onCreate( hWnd, wParam, lParam );
		break;

	case WM_PAINT: 
		onPaint(hWnd);
		break;

    case WM_SIZE:
		LayoutCmdWindow(hWnd);
		break;

	case WM_LBUTTONDOWN:
		onMouseDown(hWnd, wParam, lParam);
		return 0;

	case WM_MOUSEMOVE:
		/* proceed only if if have mouse focus (set in onMouseDown() - 
		   left mouse button is pressed) */
		if( GetCapture()==hWnd ) { 
			onMouseMove(hWnd, wParam, lParam);
			return 0;
		} else {
			return 1;
		}
		break;
		
	case WM_LBUTTONUP:
		/* proceed only if if have mouse focus (set in onMouseDown()) */
		if( GetCapture()==hWnd ) { 
			onMouseUp(hWnd, wParam, lParam);
			return 0;
		} else {
			return 1;
		}
		break;

	case WM_DESTROY:
		data = (PNHCmdWindow)GetWindowLong(hWnd, GWL_USERDATA);
		for(i=0; i<=NH_CMDPAD_FONT_MAX; i++ )
			if( data->font[i] ) DeleteObject(data->font[i]);
		free(data);
		SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return FALSE;
}
long
GUISUMOAbstractView::onRightBtnRelease(FXObject* o, FXSelector sel, void* data) {
    destroyPopup();
    onMouseMove(o, sel, data);
    if (!myChanger->onRightBtnRelease(data) && !myApp->isGaming()) {
        openObjectDialog();
    }
    ungrab();
    return 1;
}
void InputHandler::update()
{
	//SDL_Event event;

	if (event.type != SDL_MOUSEMOTION)
	{
		MouseMoved = false;
	}

	while (SDL_PollEvent(&event))
	{
		switch (event.type)
		{
		case SDL_QUIT:
			TheGame::Instance()->quit();
			break;

		case SDL_JOYAXISMOTION:
			onJoystickAxisMove(event);
			break;

		case SDL_JOYBUTTONDOWN:
			onJoystickButtonDown(event);
			break;

		case SDL_JOYBUTTONUP:
			onJoystickButtonUp(event);
			break;

		case SDL_MOUSEMOTION:
			MouseMoved = true;
			onMouseMove(event);
			break;

		case SDL_MOUSEBUTTONDOWN:
			onMouseButtonDown(event);
			break;

		case SDL_MOUSEBUTTONUP:
			onMouseButtonUp(event);
			break;

		case SDL_KEYDOWN:
			onKeyDown();
			break;

		case SDL_KEYUP:
			onKeyUp();
			break;

		default:
			break;
		}
	}
}
Example #18
0
void SDLMouse::update()
{
  SDL_Event event;

	SDL_PumpEvents();

  while ( SDL_PeepEvents(&event, 1, SDL_GETEVENT, ( SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) | SDL_EVENTMASK(SDL_MOUSEBUTTONUP) | SDL_EVENTMASK(SDL_MOUSEMOTION) ) ) > 0  )
  {
    if ( event.type == SDL_MOUSEBUTTONDOWN ) {
			cout << endl << " [EE] Mouse Pressed";
			if ( gui() != NULL ) {
				cout << " gui";
        gui()->mousePressed( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );
			}
			cout << endl;
      onMousePressed( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );

    } else if ( event.type == SDL_MOUSEBUTTONUP ) {
			cout << " [EE] Mouse Released" << endl << endl;
			if ( gui() != NULL ) {
				cout << " gui";
				gui()->mouseReleased( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );
			}
			cout << endl;
			onMouseReleased( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );

    } else if ( event.type == SDL_MOUSEMOTION ) {
      if ( gui() != NULL )
        gui()->mouseMove( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );
      onMouseMove( event.button.x, event.button.y, translateMouseButtons( event.button.button ) );

    }

  }
	if ( gui() != NULL ) {
		Widget* w = gui()->lastMouseOverWidget();
		if ( w != NULL ) {
			int x, y;
			mousePos( x, y );
			MouseCursor* mc = w->getCursor( x - w->absoluteXPos(), y - w->absoluteYPos() );
			if ( mc != (MouseCursor*)pCursor ) {
				setCursor( mc );
			}
		}
/*		if ( gui()->lastMouseOverWidget() != pLastMouseOver ) {
			pLastMouseOver = gui()->lastMouseOverWidget();
			if ( pLastMouseOver != NULL ) {
				if ( (MouseCursor*)pCursor != pLastMouseOver->cursor() )
					setCursor( pLastMouseOver->cursor() );
			}
	}*/
	}

}
Example #19
0
void ComposerEngine::setButtonActive(uint16 id, bool active) {
	for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) {
		for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) {
			if (i->_id != id)
				continue;
			i->_active = active;
		}
	}

	onMouseMove(_lastMousePos);
}
Example #20
0
bool GuiBase::onEvent(SDL_Event& event) {
    // Unsichtbare Elemente kriegen keine Events
    if (!visible) {
        return true;
    }

    // Erst den allgemeinen Handler aufrufen
    if (!onEventElement(event)) {
        return false;
    }

    // Mausbewegung? Separate Event-Handler aufrufen
    if (event.type == SDL_MOUSEMOTION) {
        int x = event.motion.x;
        int y = event.motion.y;

        bool hit = hitTest(x, y);
        if (hit) {
            if (!onMouseMove(event.motion)) {
                return false;
            }
        }

        // Enter/Leave?
        int oldX = x - event.motion.xrel;
        int oldY = y - event.motion.yrel;
        bool oldHit = hitTest(oldX, oldY);

        if (hit && !oldHit) {
            hovered = true;
            context.guiMgr->setStatusBarText(statusBarText);

            if (!onMouseEnter(event.motion)) {
                return false;
            }
        }
        else if (!hit && oldHit) {
            hovered = false;

            if (!onMouseLeave(event.motion)) {
                return false;
            }
        }
    }

    // Jetzt an die Kinder weitergeben
    for (auto iter = childElements.cbegin(); iter != childElements.cend(); iter++) {
        if (!(*iter)->onEvent(event)) {
            return false;
        }
    }
    return true;
}
Example #21
0
void uiTextNode::onCapturedMouseMove (uiNode_t* node, int x, int y)
{
	const int lineHeight = getCellHeight(node);
	const int deltaY = (mouseScrollY - y) / lineHeight;
	/* We're doing only vertical scroll, that's enough for the most instances */
	if (abs(mouseScrollY - y) >= lineHeight) {
		scrollY(node, deltaY);
		/* @todo not accurate */
		mouseScrollX = x;
		mouseScrollY = y;
	}
	onMouseMove(node, x, y);
}
Example #22
0
bool mxWindow::handleMessage(
		LRESULT *lRes,
		UINT uMsg,
		WPARAM wParam,
		LPARAM lParam
		)
{
	switch (uMsg) {
	case MM_MCINOTIFY:
		return onMciNotify(wParam, lParam);

	case WM_CLOSE:
		return onClose();

	case WM_COMMAND:
		return onCommand(
				LOWORD(wParam),
				reinterpret_cast<HWND>(lParam),
				HIWORD(wParam));

	case WM_CREATE:
		return onCreate(lRes, reinterpret_cast<CREATESTRUCT*>(lParam));

	case WM_DESTROY:
		return onDestroy();

	case WM_ERASEBKGND:
		return onEraseBkgnd(lRes, reinterpret_cast<HDC>(wParam));

	case WM_LBUTTONDBLCLK:
		return onLButtonDown(TRUE, mxPoint(lParam), wParam);

	case WM_LBUTTONDOWN:
		return onLButtonDown(FALSE, mxPoint(lParam), wParam);

	case WM_MOUSEMOVE:
		return onMouseMove(mxPoint(lParam), wParam);

	case WM_PAINT: {
		mxPaintDC dc(this);
		return onPaint(&dc); }

	case WM_SIZE:
		return onSize(wParam, mxSize(lParam));

	case WM_TIMER:
		return onTimer(wParam);

	}
	return false;
}
Example #23
0
void
COSXScreen::handleDrag(const CEvent&, void*)
{
	Point p;
  UInt32 modifiers;
  MouseTrackingResult res; 

	TrackMouseLocationWithOptions(NULL, 0, 0, &p, &modifiers, &res);

	if (res != kMouseTrackingTimedOut && (p.h != m_dragLastPoint.h || p.v != m_dragLastPoint.v)) {
		m_dragLastPoint = p;
		onMouseMove((SInt32)p.h, (SInt32)p.v);
	}
}
void InputHandler::update()
{
	SDL_Event event;

	while (SDL_PollEvent(&event))
	{
		switch (event.type)
		{
		case SDL_QUIT:
			Game::getInstance()->clean();
			break;

		case SDL_JOYAXISMOTION:
			onJoystickAxisMove(event);
			break;

		case SDL_JOYBUTTONDOWN:
			onJoystickButtonDown(event);
			break;

		case SDL_JOYBUTTONUP:
			onJoystickButtonUp(event);
			break;

		case SDL_MOUSEMOTION:
			onMouseMove(event);
			break;

		case SDL_MOUSEBUTTONDOWN:
			onMouseButtonDown(event);
			break;

		case SDL_MOUSEBUTTONUP:
			onMouseButtonUp(event);
			break;

		case SDL_KEYDOWN:
			onKeyDown();
			break;

		case SDL_KEYUP:
			onKeyUp();
			break;

		default:
			break;
		}

	}
}
void ManejadorEntrada::actualizar()
{
    SDL_Event evento;
    while(SDL_PollEvent(&evento))
    {
        switch (evento.type)
        {
            case SDL_QUIT:
                ElJuego::Instancia()->salir();
                break;

            case SDL_JOYAXISMOTION:
                onJoystickAxisMove(evento);
                break;

            case SDL_JOYBUTTONDOWN:
                onJoystickButtonDown(evento);
                break;

            case SDL_JOYBUTTONUP:
                onJoystickButtonUp(evento);
                break;

            case SDL_MOUSEMOTION:
                onMouseMove(evento);
                break;

            case SDL_MOUSEBUTTONDOWN:
                onMouseButtonDown(evento);
                break;

            case SDL_MOUSEBUTTONUP:
                onMouseButtonUp(evento);
                break;

            case SDL_KEYDOWN:
                onKeyDown();
                break;

            case SDL_KEYUP:
                onKeyUp();
                break;

            default:
                break;
        }
    }
}
bool DesignerEventHandler::eventFilter(QObject* o, QEvent* e)
{
  switch (e->type()){
//    case QEvent::ContextMenu:
//      qDebug () << "context menu event !!!";
//    break;
    case QEvent::MouseButtonPress:
      //context_widget = dynamic_cast<VtlWidget*>(o);
      onMousePress((QMouseEvent*)e);
    break;
    case QEvent::MouseMove:
      onMouseMove((QMouseEvent*)e);
    break;
    case QEvent::MouseButtonRelease:	
      onMouseRelease((QMouseEvent*)e);
      //context_widget = 0;
    break;
    case QEvent::MouseButtonDblClick:
    	showWidgetProperties();
        break;
    case QEvent::ContextMenu:
        //qDebug () << o->className();
        qDebug () << "context menu event !!!";
        onContextMenu((QContextMenuEvent*)e);
    break;
    case QEvent::KeyPress:
      onKeyPress((QKeyEvent*)e);
    break;
//    case QEvent::Paint:
//      onPaintEvent ( static_cast<QPaintEvent*>(e) );
//    break;
    case OutsideEvent::Outside:{
      VtlWidget * w = ((OutsideEvent *)e)->widget();
      if (selections[w]){
        selections[w]->updateSelectionPos();
      }
    }
    return true;
    case AddToSelEvent::AddToSel:
      if (static_cast<AddToSelEvent*>(e)->clearSel())
        clearSelection( );
      addWidgetToSelection(static_cast<AddToSelEvent*>(e)->widget());
    return true;
    default:
    break;
  }
  return QObject::eventFilter(o, e);
}
Example #27
0
void uiOptionListNode::onCapturedMouseMove (uiNode_t* node, int x, int y)
{
	const int lineHeight = getCellHeight(node);
	const int deltaY = (mouseScrollY - y) / lineHeight;
	/* We're doing only vertical scroll, that's enough for the most instances */
	if (deltaY != 0) {
		bool updated;
		updated = EXTRADATA(node).scrollY.moveDelta(deltaY);
		if (EXTRADATA(node).onViewChange && updated)
			UI_ExecuteEventActions(node, EXTRADATA(node).onViewChange);
		/* @todo not accurate */
		mouseScrollX = x;
		mouseScrollY = y;
	}
	onMouseMove(node, x, y);
}
Example #28
0
void Splitter::create(const Seed& cs) {
	pos = cs.pos;
	horizontal = cs.horizontal;
	BaseType::create(cs);

	theme.load(VSCLASS_WINDOW, this);
	onPainting([this](PaintCanvas& canvas) { handlePainting(canvas); });

	onLeftMouseDown([this](const MouseEvent& mouseEvent) { return handleLButtonDown(mouseEvent); });
	onMouseMove([this](const MouseEvent& mouseEvent) { return handleMouseMove(mouseEvent); });
	onLeftMouseUp([this](const MouseEvent&) { return handleLButtonUp(); });

	auto tip = WidgetCreator<ToolTip>::create(this, ToolTip::Seed());
	tip->setText(Texts::get(Texts::resize));
	onDestroy([tip] { tip->close(); });
}
Example #29
0
void ComposerEngine::setCursorVisible(bool visible) {
	if (visible && !_mouseVisible) {
		_mouseVisible = true;
		if (_mouseSpriteId)
			addSprite(_mouseSpriteId, 0, 0, _lastMousePos - _mouseOffset);
		else
			CursorMan.showMouse(true);
		onMouseMove(_lastMousePos);
	} else if (!visible && _mouseVisible) {
		_mouseVisible = false;
		if (_mouseSpriteId)
			removeSprite(_mouseSpriteId, 0);
		else
			CursorMan.showMouse(false);
	}
}
LRESULT WebPopupMenuProxyWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    LRESULT lResult = 0;
    bool handled = true;

    switch (message) {
        case WM_MOUSEACTIVATE:
            lResult = onMouseActivate(hWnd, message, wParam, lParam, handled);
            break;
        case WM_SIZE:
            lResult = onSize(hWnd, message, wParam, lParam, handled);
            break;
        case WM_KEYDOWN:
            lResult = onKeyDown(hWnd, message, wParam, lParam, handled);
            break;
        case WM_CHAR:
            lResult = onChar(hWnd, message, wParam, lParam, handled);
            break;
        case WM_MOUSEMOVE:
            lResult = onMouseMove(hWnd, message, wParam, lParam, handled);
            break;
        case WM_LBUTTONDOWN:
            lResult = onLButtonDown(hWnd, message, wParam, lParam, handled);
            break;
        case WM_LBUTTONUP:
            lResult = onLButtonUp(hWnd, message, wParam, lParam, handled);
            break;
        case WM_MOUSEWHEEL:
            lResult = onMouseWheel(hWnd, message, wParam, lParam, handled);
            break;
        case WM_PAINT:
            lResult = onPaint(hWnd, message, wParam, lParam, handled);
            break;
        case WM_PRINTCLIENT:
            lResult = onPrintClient(hWnd, message, wParam, lParam, handled);
            break;
        default:
            handled = false;
            break;
    }

    if (!handled)
        lResult = ::DefWindowProc(hWnd, message, wParam, lParam);

    return lResult;
}