void RotatedComponent::mousePressed(MouseEventDetails* const e)
{
    bool isContained(false);
    for(Int32 i(getMFChildren()->size()-1) ; i>=0 ; --i)
    {
        isContained = getChildren(i)->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getChildren(i),isContained,e->getViewport());
        if(isContained)
        {
            //Give myself temporary focus
            takeFocus(true);
            if(!getChildren(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
            {
                getChildren(i)->takeFocus();
            }
            getChildren(i)->mousePressed(e);
            break;
        }
    }
    if(isContained)
    {
        //Remove my temporary focus
        giveFocus(NULL, false);
    }
    else
    {
        //Give myself permenant focus
        takeFocus();
    }
    Component::mousePressed(e);
}
Esempio n. 2
0
void TabPanel::mousePressed(MouseEventDetails* const e)
{
    bool isContained;
    for(Int32 i(getMFTabs()->size()-1) ; i>=0 ; --i)
    {   // going backwards through through elements, so only top button is pressed
        isContained = getTabs(i)->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getTabs(i),isContained,e->getViewport());
        if(isContained)
        {
            //Give myself temporary focus
            takeFocus(true);
            if(!getTabs(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
            {
                getTabs(i)->takeFocus();
            }
            getTabs(i)->mousePressed(e);
            break;
        }
    }
    if(isContained)
    {
        //Remove my temporary focus
        giveFocus(NULL, false);
    }
    else
    {
        //Give myself permanant focus
        takeFocus();
    }

    // now do it for the content tab
    isContained = getTabContents(getSelectedIndex())->isContained(e->getLocation(), true);
    checkMouseEnterExit(e,e->getLocation(),getTabContents(getSelectedIndex()),isContained,e->getViewport());
    if(isContained)
    {
        //Give myself temporary focus
        takeFocus(true);
        if(!getTabContents(getSelectedIndex())->getType().isDerivedFrom(ComponentContainer::getClassType()))
        {
            getTabContents(getSelectedIndex())->takeFocus();
        }
        getTabContents(getSelectedIndex())->mousePressed(e);

        giveFocus(NULL, false);
    }
    else
    {
        //Give myself permanent focus
        takeFocus();
    }

    Component::mousePressed(e);
}
Esempio n. 3
0
void CDisplayView::mouse(CDrawContext *dstcon, CPoint &where)
{
  unsigned long delta=250, ticks = getParent()->getTicks();
  bool dblclick = false;
	long button = dstcon->getMouseButtons();

  if (!(button & kLButton))
  {
		return;
  }

  dblclick = (ticks-stTicks)<delta;
  stTicks = ticks;

  if(dblclick)
  {
    if(mEdit)
    {
      getParent()->setEditView(this);
      setBackColor(kGreyCColor);
      setFontColor(kWhiteCColor);
      setText(mText);
      takeFocus(dstcon);
      mDrawText = true;
    }
  }
  else
  {
    if(mParentView)
    {
      mParentView->notify(mView,(const char *)VNTF_MOUSE);
      mParentView->mouse(dstcon,where);
    }
  }
}
void LipstickCompositorWindow::mousePressEvent(QMouseEvent *event)
{
    QWaylandSurface *m_surface = surface();
    if (m_surface && (!m_mouseRegionValid || m_mouseRegion.contains(event->pos())) &&
        m_surface->inputRegionContains(event->pos()) && event->source() != Qt::MouseEventSynthesizedByQt) {
        QWaylandInputDevice *inputDevice = m_surface->compositor()->defaultInputDevice();
        if (inputDevice->mouseFocus() != this) {
            inputDevice->setMouseFocus(this, event->pos(), event->globalPos());
            if (m_focusOnTouch && inputDevice->keyboardFocus() != m_surface) {
                takeFocus();
            }
        }
        inputDevice->sendMousePressEvent(event->button(), event->pos(), event->globalPos());
    } else {
        event->ignore();
    }
}
Esempio n. 5
0
//------------------------------------------------------------------------
CMouseEventResult CTextEdit::onMouseDown (CPoint& where, const CButtonState& buttons)
{
	if (buttons & kLButton)
	{
		if (getFrame ()->getFocusView () != this)
		{
			if (style & kDoubleClickStyle)
			{
				if (!(buttons & kDoubleClick))
					return kMouseEventNotHandled;
			}
		
			takeFocus ();
			return kMouseDownEventHandledButDontNeedMovedOrUpEvents;
		}
	}
	return kMouseEventNotHandled;
}
Esempio n. 6
0
void InternalWindow::mousePressed(MouseEventDetails* const e)
{

    if(!getLockInput())
    {

        //Check if the Mouse is whithin the resize border width
        if(getResizable())
        {
            WindowArea TheArea(getCursurArea(e->getLocation()));
            switch(TheArea)
            {
                case WINDOW_LEFT_BORDER:
                case WINDOW_RIGHT_BORDER:
                case WINDOW_TOP_BORDER:
                case WINDOW_BOTTOM_BORDER:
                case WINDOW_TOP_LEFT_BORDER:
                case WINDOW_BOTTOM_RIGHT_BORDER:
                case WINDOW_TOP_RIGHT_BORDER:
                case WINDOW_BOTTOM_LEFT_BORDER:
                    setLockInput(true);

                    _WindowStartPosition = getPosition();
                    _WindowStartSize = getSize();
                    _MouseStartPosition = e->getLocation();
                    _BorderDragged = TheArea;
    
                    _BorderDragMouseDraggedConnection = getParentDrawingSurface()->getEventProducer()->connectMouseDragged(boost::bind(&InternalWindow::borderDragMouseDragged, this, _1));
                    _BorderDragMouseReleasedConnection = getParentDrawingSurface()->getEventProducer()->connectMouseReleased(boost::bind(&InternalWindow::borderDragMouseReleased, this, _1));
                    _BorderDragKeyPressedConnection = getParentDrawingSurface()->getEventProducer()->connectKeyPressed(boost::bind(&InternalWindow::borderDragKeyPressed, this, _1));
                    break;
            }
        }
        if(getMenuBar() != NULL)
        {
            bool isContained;
            isContained = getMenuBar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
            if(isContained)
            {
                getMenuBar()->mousePressed(e);
                if(e->isConsumed()) return;
                Component::mousePressed(e);
                return;
            }
        }
        if(getTitlebar() != NULL)
        {
            bool isContained;
            isContained = getTitlebar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
            if(isContained)
            {
                getTitlebar()->mousePressed(e);
                if(e->isConsumed()) return;
                Component::mousePressed(e);
                return;
            }
        }

        //ComponentContainer MousePressed Handling
        bool isContained(false);
        for(Int32 i(getMFChildren()->size()-1) ; i>=0 ; --i)
        {
            isContained = getChildren(i)->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getChildren(i),isContained,e->getViewport());
            if(isContained)
            {
                takeFocus();
                if(!getChildren(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
                {
                    getChildren(i)->takeFocus();
                }
                getChildren(i)->mousePressed(e);
                if(e->isConsumed()) return;
                break;
            }
        }
        Component::mousePressed(e);
    }
}
void InternalWindow::mousePressed(const MouseEventUnrecPtr e)
{

    if(!getLockInput())
    {

        //Check if the Mouse is whithin the resize border width
        if(getResizable())
        {
            WindowArea TheArea(getCursurArea(e->getLocation()));
            switch(TheArea)
            {
                case WINDOW_LEFT_BORDER:
                case WINDOW_RIGHT_BORDER:
                case WINDOW_TOP_BORDER:
                case WINDOW_BOTTOM_BORDER:
                case WINDOW_TOP_LEFT_BORDER:
                case WINDOW_BOTTOM_RIGHT_BORDER:
                case WINDOW_TOP_RIGHT_BORDER:
                case WINDOW_BOTTOM_LEFT_BORDER:
                    setLockInput(true);

                    _BorderDraggedListener.setWindowStartPosition(getPosition());
                    _BorderDraggedListener.setWindowStartSize(getSize());
                    _BorderDraggedListener.setMouseStartPosition(e->getLocation());
                    _BorderDraggedListener.setBorderDragged(TheArea);

                    getDrawingSurface()->getEventProducer()->addMouseMotionListener(&_BorderDraggedListener);
                    getDrawingSurface()->getEventProducer()->addMouseListener(&_BorderDraggedListener);
                    getDrawingSurface()->getEventProducer()->addKeyListener(&_BorderDraggedListener);
                    break;
            }
        }
        if(getMenuBar() != NULL)
        {
            bool isContained;
            isContained = getMenuBar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
            if(isContained)
            {
                getMenuBar()->mousePressed(e);
                Component::mousePressed(e);
                return;
            }
        }
        if(getTitlebar() != NULL)
        {
            bool isContained;
            isContained = getTitlebar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
            if(isContained)
            {
                getTitlebar()->mousePressed(e);
                Component::mousePressed(e);
                return;
            }
        }

        //ComponentContainer MousePressed Handling
        bool isContained(false);
        for(Int32 i(getMFChildren()->size()-1) ; i>=0 ; --i)
        {
            isContained = getChildren(i)->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getChildren(i),isContained,e->getViewport());
            if(isContained)
            {
                takeFocus();
                if(!getChildren(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
                {
                    getChildren(i)->takeFocus();
                }
                getChildren(i)->mousePressed(e);
                break;
            }
        }
        Component::mousePressed(e);
    }
}
Esempio n. 8
0
void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
{
    if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
        m_drawingArea->didReceiveMessage(connection, messageID, arguments);
        return;
    }

    switch (messageID.get<WebPageProxyMessage::Kind>()) {
        case WebPageProxyMessage::DidCreateMainFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCreateMainFrame(frameID);
            break;
        }
        case WebPageProxyMessage::DidCreateSubFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCreateSubFrame(frameID);
            break;
        }
        case WebPageProxyMessage::DidStartProvisionalLoadForFrame: {
            uint64_t frameID;
            String url;
            if (!arguments.decode(CoreIPC::Out(frameID, url)))
                return;
            didStartProvisionalLoadForFrame(webFrame(frameID), url);
            break;
        }
        case WebPageProxyMessage::DidReceiveServerRedirectForProvisionalLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didReceiveServerRedirectForProvisionalLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFailProvisionalLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFailProvisionalLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidCommitLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCommitLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFinishLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFinishLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFailLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFailLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidReceiveTitleForFrame: {
            uint64_t frameID;
            String title;
            if (!arguments.decode(CoreIPC::Out(frameID, title)))
                return;
            didReceiveTitleForFrame(webFrame(frameID), title);
            break;
        }
        case WebPageProxyMessage::DidFirstLayoutForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFirstLayoutForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFirstVisuallyNonEmptyLayoutForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFirstVisuallyNonEmptyLayoutForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidStartProgress:
            didStartProgress();
            break;
        case WebPageProxyMessage::DidChangeProgress: {
            double value;
            if (!arguments.decode(value))
                return;
            didChangeProgress(value);
            break;
        }
        case WebPageProxyMessage::DidFinishProgress:
            didFinishProgress();
            break;
        case WebPageProxyMessage::DidReceiveEvent: {
            uint32_t type;
            if (!arguments.decode(type))
                return;
            didReceiveEvent((WebEvent::Type)type);
            break;
        }
        case WebPageProxyMessage::TakeFocus: {
            // FIXME: Use enum here.
            bool direction;
            if (!arguments.decode(direction))
                return;
            takeFocus(direction);
            break;
        }
        case WebPageProxyMessage::DidChangeCanGoBack: {
            bool canGoBack;
            if (!arguments.decode(canGoBack))
                return;
            m_canGoBack = canGoBack;
            break;
        }
        case WebPageProxyMessage::DidChangeCanGoForward: {
            bool canGoForward;
            if (!arguments.decode(canGoForward))
                return;
            m_canGoForward = canGoForward;
            break;
        }
        case WebPageProxyMessage::DecidePolicyForNavigationAction: {
            uint64_t frameID;
            uint32_t navigationType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, navigationType, url, listenerID)))
                return;
            decidePolicyForNavigationAction(webFrame(frameID), navigationType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DecidePolicyForNewWindowAction: {
            uint64_t frameID;
            uint32_t navigationType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, navigationType, url, listenerID)))
                return;
            decidePolicyForNewWindowAction(webFrame(frameID), navigationType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DecidePolicyForMIMEType: {
            uint64_t frameID;
            String MIMEType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, MIMEType, url, listenerID)))
                return;
            decidePolicyForMIMEType(webFrame(frameID), MIMEType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DidRunJavaScriptInMainFrame: {
            String resultString;
            uint64_t callbackID;
            if (!arguments.decode(CoreIPC::Out(resultString, callbackID)))
                return;
            didRunJavaScriptInMainFrame(resultString, callbackID);
            break;
        }
        case WebPageProxyMessage::DidGetRenderTreeExternalRepresentation: {
            String resultString;
            uint64_t callbackID;
            if (!arguments.decode(CoreIPC::Out(resultString, callbackID)))
                return;
            didGetRenderTreeExternalRepresentation(resultString, callbackID);
            break;
        }
        case WebPageProxyMessage::SetToolTip: {
            String toolTip;
            if (!arguments.decode(toolTip))
                return;
            setToolTip(toolTip);
            break;
        }
        case WebPageProxyMessage::ShowPage: {
            showPage();
            break;
        }
        case WebPageProxyMessage::ClosePage: {
            closePage();
            break;
        }
        case WebPageProxyMessage::DidNavigateWithNavigationData: {
            WebNavigationDataStore store;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(store, frameID)))
                return;
            didNavigateWithNavigationData(webFrame(frameID), store);
            break;
        }
        case WebPageProxyMessage::DidPerformClientRedirect: {
            String sourceURLString;
            String destinationURLString;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
                return;
            didPerformClientRedirect(webFrame(frameID), sourceURLString, destinationURLString);
            break;
        }
        case WebPageProxyMessage::DidPerformServerRedirect: {
            String sourceURLString;
            String destinationURLString;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
                return;
            didPerformServerRedirect(webFrame(frameID), sourceURLString, destinationURLString);
            break;
        }
        case WebPageProxyMessage::DidUpdateHistoryTitle: {
            String title;
            String url;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(title, url, frameID)))
                return;
            didUpdateHistoryTitle(webFrame(frameID), title, url);
            break;
        }
        default:
            ASSERT_NOT_REACHED();
            break;
    }
}
Esempio n. 9
0
void cBitmapFontEditable::mouse(CDrawContext *pContext, CPoint &where, long buttons) {
  takeFocus(pContext);
}