Esempio n. 1
0
void ListBox::mouseReleased(MouseEvent &event)
{
    if (mPressedIndex != getSelectionByMouse(event.getY()))
        return;

    if (mDistributeMousePressed)
    {
        mouseReleased1(event);
    }
    else
    {
        switch (event.getClickCount())
        {
            case 1:
                mouseDragged(event);
                mOldSelected = mSelected;
                break;
            case 2:
                if (gui)
                    gui->resetClickCount();
                if (mOldSelected == mSelected)
                    mouseReleased1(event);
                else
                    mouseDragged(event);
                mOldSelected = mSelected;
                break;
            default:
                mouseDragged(event);
                mOldSelected = mSelected;
                break;
        }
    }
    mPressedIndex = -2;
}
Esempio n. 2
0
	void PretzelSlider::mouseDragged(const vec2 &pos){
        for( auto it=mSliderListi.begin(); it!=mSliderListi.end(); ++it){
            it->mouseDragged( pos - mOffset );
        }
        for( auto it=mSliderListf.begin(); it!=mSliderListf.end(); ++it){
            it->mouseDragged( pos - mOffset );
        }
	}
Esempio n. 3
0
bool Viewer::deviceEventOccurred(const DeviceEvent &event) {
	switch (event.getType()) {
		case Device::EKeyDownEvent:
			if (event.getKeyboardKey() == 'q' 
				|| event.getKeyboardSpecial() == Device::EKeyEscape) {
				m_quit = true;
				m_leaveEventLoop = true;
			} else {
				keyPressed(event);
			}
			break;
		case Device::EKeyUpEvent: keyReleased(event); break;
		case Device::EMouseMotionEvent: mouseMoved(event); break;
		case Device::EMouseDragEvent: mouseDragged(event); break;
		case Device::EMouseButtonDownEvent: mouseButtonPressed(event); break;
		case Device::EMouseButtonUpEvent: mouseButtonReleased(event); break;
		case Device::EMouseBeginDragEvent: mouseBeginDrag(event); break;
		case Device::EMouseEndDragEvent: mouseEndDrag(event); break;
		case Device::EQuitEvent:
			m_quit = true;
			m_leaveEventLoop = true;
			break;
		case Device::EResizeEvent:
			m_renderer->reconfigure(m_device);
			windowResized(event);
			// no break
		case Device::EGainFocusEvent:
			m_leaveEventLoop = true;
			break;
	}

	return true;
}
Esempio n. 4
0
void QrAbstractSpinBox::mouseDragEvent( QMouseEvent *event)
{
    if( ( event->x() == last_x_) && ( event->y() == last_y_))
    {
	// ignore
	event->accept();
	return;
    }
    
    if( first_time_drag_)
    {
	// add a bit of filtering here, for wacom tablets
	if( abs( event->x() - push_x_) < 3)
	{
	    last_x_ = event->x();
	    last_y_ = event->y();
	    event->accept();
	    return;
	}

	dragged_ = true;
	first_time_drag_ = false;

	if( mouseTracking())
	    spinBoxPressed();
    }
    else
	mouseDragged( event->x() - last_x_, mouseTracking());

    last_x_ = event->x();
    last_y_ = event->y();
    event->accept();
}
Esempio n. 5
0
bool ofxGuiPoints::mousePressed(int x, int y, int button)
{
	ofxPoint2f point = mouseToLocal(x, y);

	if(isPointInsideMe(point))
	{
		ofxPoint2f	inside	= fractionToValue(mouseToFraction(point));
		bool		onPoint	= isPointWithinDistance(inside);

		if(button == 2)
		{
			if(onPoint)
				mList.deleteActivePoint();
			else
				mList.addPointAtPosition(inside);
		}

		mMouseIsDown = true;
		mouseDragged(x, y, button);
	}
	else
	{
		mMouseIsDown = false;
	}

	return mMouseIsDown;
}
//--------------------------------------------------------------
void ofxMSAInteractiveObject::_mouseDragged(ofMouseEventArgs &e) {
	int x = e.x;
	int y = e.y;
	int button = e.button;
	
	if(verbose) printf("ofxMSAInteractiveObject::_mouseDragged(x: %i, y: %i, button: %i)\n", x, y, button);
	if(!enabled) {
        _isMousePressed[button] = false;
        return;
    }

	if(hitTest(x, y)) {						// if mouse is over the object
		if(!_isMouseOver) {						// if wasn't over previous frame
			//				onPress(x, y);							// call onPress - maybe not
			_isMouseOver = true;						// update flag
			onRollOver(x, y);						// call onRollOver
		}
		onDragOver(x, y, button);				// and trigger onDragOver
	} 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
		}
		if(isMousePressed(button)) {
			onDragOutside(x, y, button);
		}
        _isMousePressed[button] = false;
	}
    
    _stateChangeTimestampMillis = ofGetElapsedTimeMillis();

    mouseDragged(x, y, button);
}
void DrawingCanvas::mouseMoveEvent(QMouseEvent *event) {
    QPointF coordinates = QGraphicsView::mapToScene(event->pos());
    if (!(lastX == (int) coordinates.x() && lastY == (int) coordinates.y())) {
        lastX = coordinates.x();
        lastY = coordinates.y();
        emit mouseDragged(this, &coordinates, event);
    }
}
void MouseController::OnMouseMove(MOUSEINFO *mi) {
	dx += mi->dX;
	dy += mi->dY;
	if (buttons != 0)
		mouseDragged();
	else
		mouseMoved();
}
Esempio n. 9
0
bool ofxGuiRadar::mousePressed(int x, int y, int button)
{
	mMouseIsDown = isPointInsideMe(mouseToLocal(x, y));
	
	if (mMouseIsDown)
		mouseDragged(x, y, button);
	
	return mMouseIsDown;
}
Esempio n. 10
0
void ofxUISuperCanvas::onMouseDragged(ofMouseEventArgs& data)
{
    if(bTitleLabelHit)
    {
        rect->setX(data.x - hitPoint.x);
        rect->setY(data.y - hitPoint.y);
        return;
    }
    mouseDragged(data.x, data.y, data.button);
}
Esempio n. 11
0
bool ofxGuiFiles::mousePressed(int x, int y, int button)
{
    mMouseIsDown = isPointInsideMe(mouseToLocal(x, y));

    if(mMouseIsDown)
    {
        mMemory = mValue;
        mouseDragged(x, y, button);
    }

    return mMouseIsDown;
}
Esempio n. 12
0
void SimpleSimulator::processEvents()
{
    SDL_Event event;

    while( SDL_PollEvent( &event ) ) {

        switch( event.type ) {
		case SDL_KEYDOWN:
			if( event.key.keysym.sym == SDLK_ESCAPE ){
				running = false;
				SDL_Quit();
			} else if( event.key.keysym.sym == SDLK_F1 ){
				fullscreen=!fullscreen;
				initWindow();
			} else if( event.key.keysym.sym == SDLK_f ){
				fullupdate=!tuioServer->fullUpdateEnabled();
				if (fullupdate) tuioServer->enableFullUpdate();
				else tuioServer->disableFullUpdate();
			} else if( event.key.keysym.sym == SDLK_p ){
				periodic=!tuioServer->periodicMessagesEnabled();
				if (periodic) tuioServer->enablePeriodicMessages();
				else tuioServer->disablePeriodicMessages();
			} else if( event.key.keysym.sym == SDLK_v ){
				verbose = !verbose;
				tuioServer->setVerbose(verbose);
			} else if( event.key.keysym.sym == SDLK_h ){
				help = !help;
			} else if( event.key.keysym.sym == SDLK_r ){
				tuioServer->resetTuioCursors();
				stickyCursorList.clear();
				jointCursorList.clear();
				activeCursorList.clear();
			}
			break;

		case SDL_MOUSEMOTION:
			if (event.button.button == SDL_BUTTON_LEFT) mouseDragged((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_MOUSEBUTTONDOWN:
			if (event.button.button == SDL_BUTTON_LEFT) mousePressed((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_MOUSEBUTTONUP:
			if (event.button.button == SDL_BUTTON_LEFT) mouseReleased((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_QUIT:
			running = false;
			SDL_ShowCursor(true);
			SDL_Quit();
			break;
        }
    }
}
Esempio n. 13
0
bool ofxGuiKnob::mousePressed(int x, int y, int button)
{
	ofxPoint2f point	= mouseToLocal(x, y);
	mMouseIsDown		= isPointInsideMe(point);
	
	if (mMouseIsDown)
	{
		mFirstHit = point;
		mouseDragged(x, y, button);
	}
	
	return mMouseIsDown;
}
Esempio n. 14
0
bool ofxGuiColor::mousePressed(int x, int y, int button)
{
	ofxPoint2f inside = mouseToLocal(x, y);
	mMouseIsDown = isPointInsideMe(inside);
	
	if(mMouseIsDown)
	{
		mSlider = mouseToSlider(mouseToFraction(inside).y);
		mouseDragged(x, y, button);
	}
	
	return mMouseIsDown;
}
Esempio n. 15
0
bool ofxGuiFiles::mousePressed(int x, int y, int button)
{
	mMouseIsDown = isPointInsideMe(mouseToLocal(x, y));
	
	if(mMouseIsDown)
	{
		mSelected = !mSelected;
		mMemory = mValue;
		mouseDragged(x, y, button);
		mState = (mState + 1) % num_states;
	}
	
	return mMouseIsDown;
}
Esempio n. 16
0
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button)
{
    mousePos.set(x, y);

    if (mode == 1) {  // DRAG MODE
        // Add a new Word, holding a single Glyph.
        Word *word = new Word();
        word->addGlyph(new Glyph());
        words.push_back(word);
    }
    else if (mode == 2) {  // SPRAY MODE
        // Add a new Word.
        words.push_back(new Word());
        
        mouseDragged(x, y, button);
    }
}
Esempio n. 17
0
PaintBrush::PaintBrush(int width, int height, WContainerWidget *parent)
  : WPaintedWidget(parent)
{
  setSelectable(false);

  resize(WLength(width), WLength(height));

  decorationStyle().setCursor("icons/pencil.cur", CrossCursor);

  mouseDragged().connect(this, &PaintBrush::mouseDrag);
  mouseWentDown().connect(this, &PaintBrush::mouseDown);
  touchStarted().connect(this, &PaintBrush::touchStart);
  touchMoved().connect(this, &PaintBrush::touchMove);
  touchMoved().preventDefaultAction();
  
  color_ = WColor(black);

  // setPreferredMethod(InlineSvgVml);
}
float Timeline::mousePressed(int x, int y, int button){
    if (x > offset.x-nodeCircleSize && x < offset.x+drawW+nodeCircleSize && y > offset.y && y < offset.y+drawH){
        mouseStartedInside = true;
        
        //did they click a node?
        for (int i=0; i<nodes.size(); i++){
            float nodePrc = nodes[i].time/maxTime;
            float nodeX = offset.x+drawW*nodePrc;
            if ( ofDistSquared(x, y, nodeX, offset.y+drawH/2) < nodeCircleSize*nodeCircleSize){
                selectedNode = i;
                nodeBeingDragged = i!=0 && i!=nodes.size()-1;   //no dragging the first or last node
                dragFrameTimer = 0;
                return nodes[i].time;   //set the playhead to this position
            }
        }
        
    }else{
        mouseStartedInside = false;
    }
    
    return mouseDragged(x, y, button);
}
Esempio n. 19
0
void Viewport::_followMouse()
{
    Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY);
    // If the left button is dragged
    if (mPlayerFollowMouse && button & SDL_BUTTON(1))
    {
        // We create a mouse event and send it to mouseDragged.
        Uint8 *keys = SDL_GetKeyState(NULL);
        gcn::MouseEvent mouseEvent(NULL,
                      (keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]),
                      false,
                      false,
                      false,
                      gcn::MouseEvent::DRAGGED,
                      gcn::MouseEvent::LEFT,
                      mMouseX,
                      mMouseY,
                      0);

        mouseDragged(mouseEvent);
    }
}
Esempio n. 20
0
void SimpleSimulator::processEvents()
{
    SDL_Event event;

    while( SDL_PollEvent( &event ) ) {

        switch( event.type ) {
		case SDL_KEYDOWN:
			if( event.key.keysym.sym == SDLK_ESCAPE ){
				running = false;
				SDL_ShowCursor(true);
				SDL_Quit();
			} else if( event.key.keysym.sym == SDLK_F1 ){
				toggleFullscreen();
			} else if( event.key.keysym.sym == SDLK_v ){
				verbose = !verbose;	
				tuioServer->setVerbose(verbose);
			} 
			break;
				
		case SDL_MOUSEMOTION:
			if (event.button.button & SDL_BUTTON(1)) mouseDragged((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_MOUSEBUTTONDOWN:
			if (event.button.button & SDL_BUTTON(1)) mousePressed((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_MOUSEBUTTONUP:
			if (event.button.button & SDL_BUTTON(1)) mouseReleased((float)event.button.x/width, (float)event.button.y/height);
			break;
		case SDL_QUIT:
			running = false;
			SDL_ShowCursor(true);
			SDL_Quit();
			break;
        }
    }
}
Esempio n. 21
0
void View::doMouseDragged(u16 x, u16 y, MouseButton b)
{
  if (curButton)
  {
    bool inside = curButton->isInside(x,y);
    if (!inside && b == BUTTON_LEFT)
    {
      curButton->release();
      curButton = nullptr;
    }
  }
  
  for (const auto bt : buttons)
  {
    if (bt && bt->isActive() && bt->isInside(x,y) && b == BUTTON_LEFT)
    {
      bt->press();
      curButton = bt;
      return;
    }
  }
  
  mouseDragged(x,y,b);
}
Esempio n. 22
0
void ofxUICanvas::onMouseDragged(ofMouseEventArgs& data) 
{ 
    mouseDragged(data.x, data.y, data.button); 
}
Esempio n. 23
0
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
    mouseDragged(x, y, button);
}
Esempio n. 24
0
void ofxGuiMovable::mouseDragged(ofMouseEventArgs & args){
	mouseDragged(args.x, args.y, args.button);
}
Esempio n. 25
0
void hSlider::mousePressed(int xx, int yy, int btn)
{
    if(data->disabled == true) return;
	mouseDragged(xx, yy, btn); // same routine...
}
Esempio n. 26
0
void ofxTLTrack::_mouseDragged(ofMouseEventArgs& args, long millis){
    if(enabled){
    	mouseDragged(args, millis);
    }
}
Esempio n. 27
0
void hScrollBar::mousePressed(int xx, int yy, int btn)
{
	mouseDragged(xx, yy, btn); // same routine...
}
Esempio n. 28
0
void ksIconButton::onMouseDragged(ofMouseEventArgs& data)
{
    mouseDragged(data.x, data.y, data.button);
}