Ejemplo n.º 1
0
	void MouseMoveListener::recheckMouseInside()
	{
		bool in = contains(m_recheckPos);
		
		if (m_mouseIn && !in)
		{
			m_mouseIn = in;
			
			if (!m_recheckRecursion)
			{
				m_recheckRecursion = true;
				
				onMouseLeave(m_recheckPos);
				
				m_recheckRecursion = false;
			}
		}
		
		if (!m_mouseIn && in)
		{
			m_mouseIn = in;
			
			if (!m_recheckRecursion)
			{
				m_recheckRecursion = true;
				
				onMouseEnter(m_recheckPos);
				
				m_recheckRecursion = false;
			}
		}
	}
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;
}
Ejemplo n.º 3
0
  void Widget::onEvent (Event *e)
  {
    MouseClickEvent *eClick = Class::SafeCast< MouseClickEvent >( e );
    if (eClick != NULL) onMouseClick( eClick );

    MouseEnterEvent *eEnter = Class::SafeCast< MouseEnterEvent >( e );
    if (eEnter != NULL) onMouseEnter( eEnter );

    MouseLeaveEvent *eLeave = Class::SafeCast< MouseLeaveEvent >( e );
    if (eLeave != NULL) onMouseLeave( eLeave );
  }
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
0
void ofxDatGuiComponent::update(bool acceptEvents)
{
// if window does not have focus x & y will both be zero //
    if (acceptEvents && mEnabled && mVisible){
        bool mp = ofGetMousePressed();
        ofPoint mouse = ofPoint(ofGetMouseX() - mParentPosition.x, ofGetMouseY() - mParentPosition.y);
        if (hitTest(mouse)){
            if (!mMouseOver){
                onMouseEnter(mouse);
            }
            if (!mMouseDown && mp){
                onMousePress(mouse);
                if (!mFocused) onFocus();
            }
        }   else{
    // the mouse is not over the component //
            if (mMouseOver){
                onMouseLeave(mouse);
            }
            if (!mMouseDown && mp && mFocused){
                onFocusLost();
            }
        }
        if (mMouseDown) {
            if (mp){
                onMouseDrag(mouse);
            }   else{
                onMouseRelease(mouse);
            }
        }
    }
// don't update children unless they're visible //
    if (this->getIsExpanded()) {
        for(int i=0; i<children.size(); i++) {
            children[i]->update(acceptEvents);
            if (children[i]->getFocused()){
                if (acceptEvents == false ) children[i]->setFocused(false);
                acceptEvents = false;
            }
        }
    }
}
Ejemplo n.º 6
0
void XUIObject::onMouseMove(int x, int y) {
  if (m_dndDragging) return;
  int _x = x;
  int _y = y;
  m_wnd->clientToScreen(&_x, &_y);
  if (pointInRegion(x, y)) {
    if (!m_mouseInArea) {
      m_mouseInArea = 1;
      beginCapture(CAPTURETYPE_AREA);
      onMouseEnter();
    }
  } else {
    if (m_mouseInArea) {
      m_mouseInArea = 0;
      endCapture(CAPTURETYPE_AREA);
      onMouseLeave();
      // prevent further mousemove event processing, because we would not have gotten here 
      // had we not captured the mouse, and we only capture the mouse to implement the 
      // mouseenter/mouseleave events, not to cause any more mousemove events than normal.
      return;
    }
  }
  eventSource_onMouseMove(x, y);
  if (m_draggingWindow) {
    int ox = _x - m_draganchor_x;
    int oy = _y - m_draganchor_y;
    RECT r;
    m_wnd->getRootParent()->getWindowRect(&r);
    m_wnd->getRootParent()->move(r.left + ox, r.top + oy);
    m_draganchor_x = _x;
    m_draganchor_y = _y;
  }
  if (m_dndlbuttondown && !m_trieddnd) {
    if (ABS(_x - m_draganchor_x) >= 4 ||
        ABS(_y - m_draganchor_y) >= 4) {
      m_trieddnd = true;
      onBeginDrag(NULL);
      m_wnd->handleDrag();
    }
  }
}
Ejemplo n.º 7
0
void Engine::proccessEvent(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_CLOSE:
        stop();
		break;
    case WM_MOUSEMOVE:
        onMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam);
	    break;
	case WM_MOUSELEAVE:
        onMouseLeave();
	    break;
	case WM_MOUSEWHEEL:
		onMouseWheel(GET_WHEEL_DELTA_WPARAM(wParam));
		break;
	case WM_KEYDOWN:
		onKeyDown(wParam);
	    break;
	}
}
Ejemplo n.º 8
0
	MouseMoveListener::MouseMoveListener() : 
		m_recheckRecursion(false),
		// m_prevPos(-1000000),
		m_mouseIn(false),
		m_grabMouse(false)
	{
		addEventHandler([&](fw::Event &ev) -> bool {
			
			if (ev.type == fw::Event::MouseMoved || 
				ev.type == fw::Event::MouseEntered || 
				ev.type == fw::Event::MouseLeft)
			{
				fm::vec2i p = ev.motion;
				m_recheckPos = p;
				
				bool in = contains(p);
				bool oldin = m_mouseIn;
				
				m_mouseIn = in;
				
				if ( oldin && !in) onMouseLeave(p);
				if (!oldin &&  in) onMouseEnter(p);
				
				onMouseMove(p,m_prevPos);
				
				m_prevPos = p;
			}
			
			if (ev.type == fw::Event::ButtonReleased)
			{
				fm::vec2 p = ev.mouse;
				bool in = contains(p);
				
				if (!m_mouseIn && in)
					onMouseEnter(p);
			}
			
			return false;
		});
	}
Ejemplo n.º 9
0
bool Splitter::handleMouseMove(const MouseEvent& mouseEvent) {
	if(!hovering) {
		hovering = true;
		redraw();
		::SetCursor(::LoadCursor(0, horizontal ? IDC_SIZENS : IDC_SIZEWE));
		onMouseLeave([this] {
			hovering = false;
			redraw();
			::SetCursor(NULL);
		});
	}

	if(moving && mouseEvent.ButtonPressed == MouseEvent::LEFT && mouseEvent.pos.getPoint() != moving) {
		moving = mouseEvent.pos.getPoint();
		ClientCoordinate cc(mouseEvent.pos, getParent());
		double mpos = horizontal ? cc.y() : cc.x();
		double size = horizontal ? getParent()->getClientSize().y : getParent()->getClientSize().x;
		pos = mpos / size;
		getParent()->checkSplitterPos(this);
		getParent()->onMove();
	}

	return true;
}
Ejemplo n.º 10
0
void DockAppItem::leaveEvent(QEvent *)
{
    //mouse event accept area are app-icon-area in FashionMode
    if (m_dockModeData->getDockMode() != Dock::FashionMode)
        onMouseLeave();
}
Ejemplo n.º 11
0
void Ui::VideoPanelHeader::leaveEvent(QEvent* e) {
	QWidget::leaveEvent(e);
	emit onMouseLeave();
}
Ejemplo n.º 12
0
bool
HippoCanvas::processMessage(UINT   message,
                            WPARAM wParam,
                            LPARAM lParam)
{
    if (HippoAbstractControl::processMessage(message, wParam, lParam))
        return true;

    switch (message) {
        case WM_PAINT:
            onPaint(wParam, lParam);
            // do NOT call DefWindowProc, it clears the update region
            return true;
        case WM_HSCROLL:
            if (hscrollNeeded_) {
                int newX = hscroll_->handleScrollMessage(message, wParam, lParam);
                scrollTo(newX, canvasY_);
            }
            return true;
        case WM_VSCROLL:
        case WM_MOUSEWHEEL: // running DefWindowProc for this one forwards it to parent window
            if (vscrollNeeded_) {
                int newY = vscroll_->handleScrollMessage(message, wParam, lParam);
                scrollTo(canvasX_, newY);
            }
            return true;
        case WM_SETCURSOR:
            // kill DefWindowProc setting the cursor, so we are the only 
            // ones that do (in the mouse move handler)
            return true;
        case WM_LBUTTONDOWN:
            onMouseDown(1, wParam, lParam);
            return true;
        case WM_LBUTTONUP:
            onMouseUp(1, wParam, lParam);
            return true;
        case WM_LBUTTONDBLCLK:
        	onMouseDoubleClick(1, wParam, lParam);
        	return true;
        case WM_MBUTTONDOWN:
            onMouseDown(2, wParam, lParam);
            return true;
        case WM_MBUTTONUP:
            onMouseUp(2, wParam, lParam);
            return true;
        case WM_RBUTTONDOWN:
            onMouseDown(3, wParam, lParam);
            return true;
        case WM_RBUTTONUP:
            onMouseUp(3, wParam, lParam);
            return true;
        case WM_MOUSEMOVE:
            onMouseMove(wParam, lParam);
            return true;
        case WM_MOUSELEAVE:
            onMouseLeave(wParam, lParam);
            return true;
        case WM_MOUSEHOVER:
            onHover(wParam, lParam);
            return true;
        case WM_SETFOCUS:
            // forward focus on to some control inside the canvas, if any
            hippo_canvas_context_win_focus_controls(context_);
            return true;
        case WM_COMMAND:
            return onCommand(wParam, lParam);
    }

    return false;
}
Ejemplo n.º 13
0
void Buttons::onMouseMoved(int mx, int my) {
    if(!is_visible) {
        return;
    }

    mdx = mx - pmx;
    mdy = my - pmy;

    // are we inside our header area? TODO: we cn optimize here by returning early
    if(!is_locked) {
        is_mouse_inside_header = BINSIDE_HEADER(this, mx, my);
        if(is_mouse_inside_header && state == BSTATE_NONE) {
            state = BSTATE_ENTER;
            onMouseEnter(mx,my);
        }
        else if(!is_mouse_inside_header && state == BSTATE_ENTER) {
            state = BSTATE_NONE;
            onMouseLeave(mx, my);
        }
    }

    if(is_mouse_down) {
        onMouseDragged(mdx, mdy);
    }

    // check elements when we're opened.
    if(is_open) {
        // check if we are inside an element and dragging...
        Element* e = elements[0];
        Element* el;
        vector<Element*>::iterator it;
        if(is_mouse_down) {
            it = elements.begin();
            while(it != elements.end()) {
                el = *it;
                if(!el->is_visible) {
                    ++it;
                    continue;
                }

                el->onMouseDragged(mx, my, mdx, mdy);
                ++it;
            }
        }

        // call "leave" and "enter"
        it = elements.begin();
        while(it != elements.end()) {
            el = *it;
            if(!el->is_visible) {
                ++it;
                continue;
            }

            el->is_mouse_inside = BINSIDE_ELEMENT(el, mx, my);
            if(el->is_mouse_inside && el->state == BSTATE_NONE) {
                el->state = BSTATE_ENTER;
                el->onMouseEnter(x,y);
            }
            else if(!el->is_mouse_inside && el->state == BSTATE_ENTER) {
                el->state = BSTATE_NONE;
                el->onMouseLeave(mx,my);
            }
            el->onMouseMoved(mx,my);
            ++it;
        }
    }

    // is mouse inside the gui
    int panel_h = getPanelHeight();
    if(mx > x && mx < (x+w) && my > y && my < (y+panel_h)) {
        is_mouse_inside_panel = true;
    }
    else {
        is_mouse_inside_panel = false;
    }

    // keep track of current x and y;
    pmx = mx;
    pmy = my;
}
Ejemplo n.º 14
0
	void WireframeActor::Update(long gameTime) //WireframeActor's default update. velocity variables change velocity of WireframeActor
	{
		prevclicked = clicked;

	    x += (float)xvelocity;
	    y += (float)yvelocity;
	
	    xSpeed = x - xprev;
	    ySpeed = y - yprev;
	
	    xprev = x;
	    yprev = y;
		
		long prevTouchId = currentTouchId;
		
		bool onmouseenter = false;
		bool onmouseleave = false;
		bool onclick = false;
		bool onrelease = false;
		
	    if(mouseOver())
	    {
			bool prevMouseOver = mouseover;
	    	if(!mouseover)
	    	{
	    		mouseover=true;
	    		if(isEventEnabled(EVENT_MOUSEENTER))
	    		{
	    			onmouseenter = true;
	    		}
	    	}
	    	if(!prevMouseOver && !Application::checkPrevTouchActive(touchId))
	    	{
	    		clicked = true;
	    		if(isEventEnabled(EVENT_MOUSECLICK))
	    		{
	    			onclick = true;
	    		}
	    	}
	    }
	    else if(mouseover)
		{
			mouseover=false;
			if(isEventEnabled(EVENT_MOUSELEAVE))
			{
	    		onmouseleave = true;
			}
		}
	    if(clicked && prevMouseover && !Application::checkTouchActive(prevTouchId))
	    {
	    	clicked = false;
	    	if(isEventEnabled(EVENT_MOUSERELEASE))
			{
	    		onrelease = true;
			}
	    }
		
		if(prevclicked && !Application::checkTouchActive(currentTouchId))
		{
			clicked = false;
		}
		
		prevMouseover = mouseover;
		currentTouchId = touchId;
		
		if(onmouseenter)
		{
			onMouseEnter();
		}
		if(onclick)
		{
			onClick();
		}
		if(onmouseleave)
		{
			onMouseLeave();
		}
		if(onrelease)
		{
			onRelease();
		}
	}
Ejemplo n.º 15
0
Ui::DetachedVideoWindow::DetachedVideoWindow(QWidget* parent)
    : AspectRatioResizebleWnd()
    , parent_(parent)
	, closed_manualy_(false)
	, show_panel_timer_(this)
	, video_panel_header_(new VideoPanelHeader(this, kVPH_ShowClose)) {

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("detachedVideoWnd"));
        this->resize(400, 300);
        this->setMinimumSize(QSize(0, 0));
        this->setMaximumSize(QSize(16777215, 16777215));
        this->setProperty("DetachedVideoWindowCommon", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setAlignment(Qt::AlignVCenter);
        QMetaObject::connectSlotsByName(this);
        
#ifdef _WIN32
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SubWindow);
#else
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Window | Qt::WindowDoesNotAcceptFocus/*| Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint*/);
        setAttribute(Qt::WA_ShowWithoutActivating);
        setAttribute(Qt::WA_X11DoNotAcceptFocus);
#endif

        video_panel_header_effect_ = new UIEffects(*video_panel_header_.get());
#ifndef __linux__
        std::vector<QWidget*> panels;
        panels.push_back(video_panel_header_.get());
        _rootWidget = platform_specific::GraphicsPanel::create(this, panels);
        _rootWidget->setContentsMargins(0, 0, 0, 0);
        //_rootWidget->setProperty("WidgetWithBG", true);
        _rootWidget->setAttribute(Qt::WA_UpdatesDisabled);
        _rootWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
        layout()->addWidget(_rootWidget);
#endif //__linux__
        std::vector<QWidget*> topPanels;
        topPanels.push_back(video_panel_header_.get());
        std::vector<QWidget*> bottomPanels;
        event_filter_ = new video_window::ResizeEventFilter(topPanels, bottomPanels, this);
		installEventFilter(event_filter_);

        setAttribute(Qt::WA_UpdatesDisabled);
        setAttribute(Qt::WA_ShowWithoutActivating);

		connect(&show_panel_timer_, SIGNAL(timeout()), this, SLOT(_check_panels_vis()), Qt::QueuedConnection);
		show_panel_timer_.setInterval(1500);

		assert(!!video_panel_header_);
		if (!!video_panel_header_) {
			//video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
			//video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
			//video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true); 

            video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
            video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
            video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true);  

			connect(video_panel_header_.get(), SIGNAL(onMouseEnter()), this, SLOT(onPanelMouseEnter()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMouseLeave()), this, SLOT(onPanelMouseLeave()), Qt::QueuedConnection);

			connect(video_panel_header_.get(), SIGNAL(onClose()), this, SLOT(onPanelClickedClose()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMinimize()), this, SLOT(onPanelClickedMinimize()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMaximize()), this, SLOT(onPanelClickedMaximize()), Qt::QueuedConnection);
		}

        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowRemoveComplete(quintptr)), this, SLOT(onVoipWindowRemoveComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowAddComplete(quintptr)), this, SLOT(onVoipWindowAddComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);

        setMinimumSize(Utils::scale_value(320), Utils::scale_value(80));
        
        QDesktopWidget dw;
        const auto screen_rect = dw.screenGeometry(dw.primaryScreen());
        const auto detached_wnd_rect = rect();

        auto detached_wnd_pos = screen_rect.topRight();
        detached_wnd_pos.setX(detached_wnd_pos.x() - detached_wnd_rect.width() - 0.01f * screen_rect.width());
        detached_wnd_pos.setY(detached_wnd_pos.y() + 0.05f * screen_rect.height());

        const QRect rc(detached_wnd_pos.x(), detached_wnd_pos.y(), detached_wnd_rect.width(), detached_wnd_rect.height());
        setGeometry(rc);
}