当前位置: 首页>>代码示例>>C++>>正文


C++ PlatformMouseEvent::button方法代码示例

本文整理汇总了C++中PlatformMouseEvent::button方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformMouseEvent::button方法的具体用法?C++ PlatformMouseEvent::button怎么用?C++ PlatformMouseEvent::button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlatformMouseEvent的用法示例。


在下文中一共展示了PlatformMouseEvent::button方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create

PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
{
    ASSERT(event.eventType() == MouseEventMoved || event.button() != NoButton);

    bool isCancelable = eventType != eventNames().mousemoveEvent;

    return MouseEvent::create(eventType, true, isCancelable, view,
        detail, event.globalX(), event.globalY(), event.x(), event.y(),
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
        relatedTarget, 0, false);
}
开发者ID:1833183060,项目名称:wke,代码行数:11,代码来源:MouseEvent.cpp

示例2: create

PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
{
    ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);

    bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventType == EventTypeNames::mouseleave;
    bool isCancelable = !isMouseEnterOrLeave;
    bool isBubbling = !isMouseEnterOrLeave;

    return MouseEvent::create(eventType, isBubbling, isCancelable, view,
        detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
        event.movementDelta().x(), event.movementDelta().y(),
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
        relatedTarget, nullptr, false);
}
开发者ID:Mihiri,项目名称:blink,代码行数:14,代码来源:MouseEvent.cpp

示例3: create

PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
{
    ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);

    bool isCancelable = eventType != eventNames().mousemoveEvent;

    return MouseEvent::create(eventType, true, isCancelable, view,
        detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
#if ENABLE(POINTER_LOCK)
        event.movementDelta().x(), event.movementDelta().y(),
#endif
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
        relatedTarget, 0, false);
}
开发者ID:dog-god,项目名称:iptv,代码行数:14,代码来源:MouseEvent.cpp

示例4: mouseDown

void Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
    // Early exit for right click
    if (evt.button() == RightButton)
        return;

    setPressedPart(theme().hitTest(*this, evt.position()));
    int pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFrame(evt.position()).x() : convertFromRootFrame(evt.position()).y();

    if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme().shouldCenterOnThumb(*this, evt)) {
        setHoveredPart(ThumbPart);
        setPressedPart(ThumbPart);
        m_dragOrigin = m_currentPos;
        int thumbLen = theme().thumbLength(*this);
        int desiredPos = pressedPos;
        // Set the pressed position to the middle of the thumb so that when we do the move, the delta
        // will be from the current pixel position of the thumb to the new desired position for the thumb.
        m_pressedPos = theme().trackPosition(*this) + theme().thumbPosition(*this) + thumbLen / 2;
        moveThumb(desiredPos);
        return;
    }
    if (m_pressedPart == ThumbPart)
        m_dragOrigin = m_currentPos;

    m_pressedPos = pressedPos;

    autoscrollPressedPart(theme().initialAutoscrollTimerDelay());
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:28,代码来源:Scrollbar.cpp

示例5: mouseEvent

    virtual bool mouseEvent(WebPageOverlay& pageOverlay, const PlatformMouseEvent& event) override
    {
        switch (event.type()) {
        case PlatformMouseEvent::Type::MousePressed: {
            if (!m_client.mouseDown)
                return false;

            return m_client.mouseDown(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
        }
        case PlatformMouseEvent::Type::MouseReleased: {
            if (!m_client.mouseUp)
                return false;

            return m_client.mouseUp(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
        }
        case PlatformMouseEvent::Type::MouseMoved: {
            if (event.button() == MouseButton::NoButton) {
                if (!m_client.mouseMoved)
                    return false;

                return m_client.mouseMoved(toAPI(&pageOverlay), toAPI(event.position()), m_client.base.clientInfo);
            }

            // This is a MouseMove event with a mouse button pressed. Call mouseDragged.
            if (!m_client.mouseDragged)
                return false;

            return m_client.mouseDragged(toAPI(&pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
        }

        default:
            return false;
        }
    }
开发者ID:mu326668629,项目名称:webkit,代码行数:34,代码来源:WKBundlePageOverlay.cpp

示例6: mouseDown

bool Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
    // Early exit for right click
    if (evt.button() == RightButton)
        return true; // FIXME: Handled as context menu by Qt right now.  Should just avoid even calling this method on a right click though.

    setPressedPart(theme()->hitTest(this, evt));
    int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());
    
    if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {
        setHoveredPart(ThumbPart);
        setPressedPart(ThumbPart);
        m_dragOrigin = m_currentPos;
        int thumbLen = theme()->thumbLength(this);
        int desiredPos = pressedPos;
        // Set the pressed position to the middle of the thumb so that when we do the move, the delta
        // will be from the current pixel position of the thumb to the new desired position for the thumb.
        m_pressedPos = theme()->trackPosition(this) + theme()->thumbPosition(this) + thumbLen / 2;
        moveThumb(desiredPos);
        return true;
    } else if (m_pressedPart == ThumbPart)
        m_dragOrigin = m_currentPos;
    
    m_pressedPos = pressedPos;

    autoscrollPressedPart(theme()->initialAutoscrollTimerDelay());
    return true;
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:28,代码来源:Scrollbar.cpp

示例7: create

PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtrWillBeRawPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtrWillBeRawPtr<Node> relatedTarget)
{
    ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);

    bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventType == EventTypeNames::mouseleave;
    bool isCancelable = !isMouseEnterOrLeave;
    bool isBubbling = !isMouseEnterOrLeave;

    return MouseEvent::create(
        eventType, isBubbling, isCancelable, view,
        detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
        event.movementDelta().x(), event.movementDelta().y(),
        event.modifiers(), event.button(),
        platformModifiersToButtons(event.modifiers()),
        relatedTarget, event.timestamp(), event.syntheticEventType());
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例8: handleMousePressEvent

bool PlatformScrollbar::handleMousePressEvent(const PlatformMouseEvent& e)
{
    if (!parent())
        return true;

    // TODO(pkasting): http://b/583875 Right-click should invoke a context menu
    // (maybe this would be better handled elsewhere?)
    if (!m_enabled || (e.button() != LeftButton)) {
        return true;
    }

    ASSERT(m_captureStart == None);

    IntPoint pos = convertFromContainingWindow(e.pos());

    const bool horz = (orientation() == HorizontalScrollbar);
    updateMousePosition(pos.x(), pos.y());
    switch (m_mouseOver) {
    case Arrow1:
        scroll(horz ? ScrollLeft : ScrollUp, ScrollByLine);
        break;
    case Track:
        return true;
    case BeforeThumb:
        scroll(horz ? ScrollLeft : ScrollUp, ScrollByPage);
        break;
    case Thumb:
        m_dragOrigin.thumbPos = horz ? pos.x() : pos.y();
        m_dragOrigin.scrollVal = value();
        break;
    case AfterThumb:
        scroll(horz ? ScrollRight : ScrollDown, ScrollByPage);
        break;
    case Arrow2:
        scroll(horz ? ScrollRight : ScrollDown, ScrollByLine);
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    setCapturingMouse(true);

    // Kick off auto-repeat timer
    if (m_mouseOver != Thumb)
        m_autorepeatTimer.start(kAutorepeatInitialDelay,
                                kAutorepeatRepeatInterval);

    m_needsLayout = true;
    // FIXME: Invalidate only the portions that actually changed
    invalidate();

    return true;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例9: handleMouseReleaseEvent

void AutoscrollController::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
{
    switch (m_autoscrollType) {
    case AutoscrollForPan:
        if (mouseEvent.button() == MiddleButton)
            m_autoscrollType = AutoscrollForPanCanStop;
        break;
    case AutoscrollForPanCanStop:
        stopAutoscrollTimer();
        break;
    }
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:12,代码来源:AutoscrollController.cpp

示例10: handleMouseReleaseEvent

bool PlatformScrollbar::handleMouseReleaseEvent(const PlatformMouseEvent& evt)
{
    invalidatePart(m_pressedPart);
    m_pressedPart = NoPart;
    m_pressedPos = 0;
    stopTimerIfNeeded();

    if (parent() && parent()->isFrameView())
        static_cast<FrameView*>(parent())->frame()->eventHandler()->setMousePressed(evt.button(), false);

    return true;
}
开发者ID:GRGSIBERIA,项目名称:EAWebKit,代码行数:12,代码来源:BCPlatformScrollBarEA.cpp

示例11: handleMousePressEvent

bool PlatformScrollbar::handleMousePressEvent(const PlatformMouseEvent& evt)
{
    // Early exit for right click
    if (evt.button() == RightButton)
        return true; // Handled as context menu

    const QPoint pos = convertFromContainingWindow(evt.pos());
    bool midButtonAbsPos = QApplication::style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition);

    // Middle click centers slider thumb, if supported
    if (midButtonAbsPos && evt.button() == MiddleButton) {
        setValue(pixelPosToRangeValue((m_orientation == HorizontalScrollbar ?
                                        pos.x() : pos.y()) - thumbLength() / 2));

    } else { // Left button, or if middle click centering is not supported
        const QPoint topLeft = m_opt.rect.topLeft();
        m_opt.rect.moveTo(QPoint(0, 0));
        QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
        m_opt.rect.moveTo(topLeft);
        switch (sc) {
            case QStyle::SC_ScrollBarAddLine:
            case QStyle::SC_ScrollBarSubLine:
            case QStyle::SC_ScrollBarSlider:
                m_opt.state |= QStyle::State_Sunken;
            case QStyle::SC_ScrollBarAddPage:
            case QStyle::SC_ScrollBarSubPage:
            case QStyle::SC_ScrollBarGroove:
                m_pressedPart = sc;
                break;
            default:
                m_pressedPart = QStyle::SC_None;
                return false;
        }
        m_pressedPos = m_orientation == HorizontalScrollbar ? pos.x() : pos.y();
        autoscrollPressedPart(cInitialTimerDelay);
        invalidate();
    }

    return true;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:40,代码来源:PlatformScrollBarQt.cpp

示例12: handleMouseReleaseForPanScrolling

void AutoscrollController::handleMouseReleaseForPanScrolling(LocalFrame* frame, const PlatformMouseEvent& mouseEvent)
{
    if (!frame->isMainFrame())
        return;
    switch (m_autoscrollType) {
    case AutoscrollForPan:
        if (mouseEvent.button() == MiddleButton)
            m_autoscrollType = AutoscrollForPanCanStop;
        break;
    case AutoscrollForPanCanStop:
        stopAutoscroll();
        break;
    }
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:14,代码来源:AutoscrollController.cpp

示例13: dispatchMouseEvent

bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& _mouse, const AtomicString& eventType,
                                             int detail, Node* relatedTarget)
{
    assert(!eventDispatchForbidden());
    
    IntPoint contentsPos;
    if (FrameView* view = document()->view())
        contentsPos = view->viewportToContents(_mouse.pos());
    
    return dispatchMouseEvent(eventType, _mouse.button(), detail,
                              contentsPos.x(), contentsPos.y(), _mouse.globalX(), _mouse.globalY(),
                              _mouse.ctrlKey(), _mouse.altKey(), _mouse.shiftKey(), _mouse.metaKey(),
                              false, relatedTarget);
}
开发者ID:oroisec,项目名称:ios,代码行数:14,代码来源:EventTargetNode.cpp

示例14: create

Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, AbstractView* view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
{
    bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
    bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave;
    bool canBubble = !isMouseEnterOrLeave;

    return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp(), view,
        detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
#if ENABLE(POINTER_LOCK)
        event.movementDelta().x(), event.movementDelta().y(),
#endif
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), event.button(),
        relatedTarget, event.force(), event.syntheticClickType());
}
开发者ID:xiejinfeng850414,项目名称:webkit,代码行数:14,代码来源:MouseEvent.cpp

示例15: handleMouseReleaseForPanScrolling

void AutoscrollController::handleMouseReleaseForPanScrolling(Frame* frame, const PlatformMouseEvent& mouseEvent)
{
    Page* page = frame->page();
    if (!page || page->mainFrame() != frame)
        return;
    switch (m_autoscrollType) {
    case AutoscrollForPan:
        if (mouseEvent.button() == MiddleButton)
            m_autoscrollType = AutoscrollForPanCanStop;
        break;
    case AutoscrollForPanCanStop:
        stopAutoscrollTimer();
        break;
    }
}
开发者ID:windyuuy,项目名称:opera,代码行数:15,代码来源:AutoscrollController.cpp


注:本文中的PlatformMouseEvent::button方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。