本文整理汇总了C++中EventDispatcher::node方法的典型用法代码示例。如果您正苦于以下问题:C++ EventDispatcher::node方法的具体用法?C++ EventDispatcher::node怎么用?C++ EventDispatcher::node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventDispatcher
的用法示例。
在下文中一共展示了EventDispatcher::node方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchEvent
bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
if (isSyntheticMouseEvent()) {
event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget());
return dispatcher.dispatch();
}
if (isDisabledFormControl(&dispatcher.node()))
return false;
if (event().type().isEmpty())
return true; // Shouldn't happen.
ASSERT(!event().target() || event().target() != event().relatedTarget());
EventTarget* relatedTarget = event().relatedTarget();
event().eventPath().adjustForRelatedTarget(dispatcher.node(), relatedTarget);
dispatcher.dispatch();
bool swallowEvent = event().defaultHandled() || event().defaultPrevented();
if (event().type() != EventTypeNames::click || event().detail() != 2)
return !swallowEvent;
// 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.
RefPtrWillBeRawPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
doubleClickEvent->initMouseEvent(nullptr, EventTypeNames::dblclick, event().bubbles(), event().cancelable(), event().view(),
event().detail(), event().screenX(), event().screenY(), event().clientX(), event().clientY(),
event().ctrlKey(), event().altKey(), event().shiftKey(), event().metaKey(),
event().button(), relatedTarget, event().buttons());
if (event().defaultHandled())
doubleClickEvent->setDefaultHandled();
EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented())
return false;
return !swallowEvent;
}
示例2: dispatchEvent
bool DragEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget());
return EventDispatchMediator::dispatchEvent(dispatcher);
}