本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}