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


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

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


在下文中一共展示了PlatformMouseEvent::eventType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: dispatchMouseEvent

bool EventTargetNode::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType,
    int detail, Node* relatedTarget)
{
    ASSERT(!eventDispatchForbidden());
    
    IntPoint contentsPos;
    if (FrameView* view = document()->view())
        contentsPos = view->windowToContents(event.pos());

    short button = event.button();

    ASSERT(event.eventType() == MouseEventMoved || button != NoButton);
    
    return dispatchMouseEvent(eventType, button, detail,
        contentsPos.x(), contentsPos.y(), event.globalX(), event.globalY(),
        event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
        false, relatedTarget);
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:18,代码来源:EventTargetNode.cpp

示例3: mouseEvent

void WebPage::mouseEvent(const PlatformMouseEvent& event)
{
    if (!m_mainFrame->coreFrame()->view())
        return;

    switch (event.eventType()) {
        case WebCore::MouseEventPressed:
            m_mainFrame->coreFrame()->eventHandler()->handleMousePressEvent(event);
            break;
        case WebCore::MouseEventReleased:
            m_mainFrame->coreFrame()->eventHandler()->handleMouseReleaseEvent(event);
            break;
        case WebCore::MouseEventMoved:
            m_mainFrame->coreFrame()->eventHandler()->mouseMoved(event);
            break;
        default:
            ASSERT_NOT_REACHED();
            break;
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例4: dispatchMouseEvent

bool EventDispatcher::dispatchMouseEvent(Node* node, const PlatformMouseEvent& event, const AtomicString& eventType,
    int detail, Node* relatedTargetArg)
{
    ASSERT(!eventDispatchForbidden());
    ASSERT(event.eventType() == MouseEventMoved || event.button() != NoButton);

    if (node->disabled()) // Don't even send DOM events for disabled controls..
        return true;

    if (eventType.isEmpty())
        return false; // Shouldn't happen.

    EventDispatcher dispatcher(node);

    // Attempting to dispatch with a non-EventTarget relatedTarget causes the relatedTarget to be silently ignored.
    RefPtr<Node> relatedTarget = pullOutOfShadow(relatedTargetArg);

    RefPtr<MouseEvent> mouseEvent = MouseEvent::create(eventType, node->document()->defaultView(), event, detail, relatedTarget);

    bool swallowEvent = false;

    dispatcher.dispatchEvent(mouseEvent);
    bool defaultHandled = mouseEvent->defaultHandled();
    bool defaultPrevented = mouseEvent->defaultPrevented();
    if (defaultHandled || defaultPrevented)
        swallowEvent = true;

    // Special case: If it's a double click event, we also send the dblclick event. This is not part
    // of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
    // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
    if (eventType == eventNames().clickEvent && detail == 2) {
        RefPtr<Event> doubleClickEvent = MouseEvent::create(eventNames().dblclickEvent, node->document()->defaultView(), event, detail, relatedTarget);
        if (defaultHandled)
            doubleClickEvent->setDefaultHandled();
        dispatcher.dispatchEvent(doubleClickEvent);
        if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented())
            swallowEvent = true;
    }

    return swallowEvent;
}
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:41,代码来源:EventDispatcher.cpp


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