本文整理汇总了C++中PlatformMouseEvent类的典型用法代码示例。如果您正苦于以下问题:C++ PlatformMouseEvent类的具体用法?C++ PlatformMouseEvent怎么用?C++ PlatformMouseEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlatformMouseEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseMoved
bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
if (m_pressedPart == ThumbPart) {
if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
if (m_scrollableArea)
m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
} else {
moveThumb(m_orientation == HorizontalScrollbar ?
convertFromContainingWindow(evt.position()).x() :
convertFromContainingWindow(evt.position()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
}
return true;
}
if (m_pressedPart != NoPart)
m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y());
ScrollbarPart part = theme()->hitTest(this, evt.position());
if (part != m_hoveredPart) {
if (m_pressedPart != NoPart) {
if (part == m_pressedPart) {
// The mouse is moving back over the pressed part. We
// need to start up the timer action again.
startTimerIfNeeded(theme()->autoscrollTimerDelay());
theme()->invalidatePart(this, m_pressedPart);
} else if (m_hoveredPart == m_pressedPart) {
// The mouse is leaving the pressed part. Kill our timer
// if needed.
stopTimerIfNeeded();
theme()->invalidatePart(this, m_pressedPart);
}
}
setHoveredPart(part);
}
return true;
}
示例2: 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;
}
}
示例3: handleMouseMove
bool InspectorOverlay::handleMouseMove(const PlatformMouseEvent& event) {
if (!shouldSearchForNode())
return false;
LocalFrame* frame = m_frameImpl->frame();
if (!frame || !frame->view() || frame->contentLayoutItem().isNull())
return false;
Node* node = hoveredNodeForEvent(frame, event, event.shiftKey());
// Do not highlight within user agent shadow root unless requested.
if (m_inspectMode != InspectorDOMAgent::SearchingForUAShadow) {
ShadowRoot* shadowRoot = InspectorDOMAgent::userAgentShadowRoot(node);
if (shadowRoot)
node = &shadowRoot->host();
}
// Shadow roots don't have boxes - use host element instead.
if (node && node->isShadowRoot())
node = node->parentOrShadowHostNode();
if (!node)
return true;
Node* eventTarget =
event.shiftKey() ? hoveredNodeForEvent(frame, event, false) : nullptr;
if (eventTarget == node)
eventTarget = nullptr;
if (node && m_inspectModeHighlightConfig) {
m_hoveredNodeForInspectMode = node;
if (m_domAgent)
m_domAgent->nodeHighlightedInOverlay(node);
highlightNode(node, eventTarget, *m_inspectModeHighlightConfig,
event.ctrlKey() || event.metaKey());
}
return true;
}
示例4: mouseMoved
void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
if (m_pressedPart == ThumbPart) {
if (theme().shouldSnapBackToDragOrigin(*this, evt)) {
if (m_scrollableArea) {
m_scrollableArea->setScrollPositionSingleAxis(m_orientation, m_dragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation), UserScroll);
}
} else {
moveThumb(m_orientation == HorizontalScrollbar
? convertFromRootFrame(evt.position()).x()
: convertFromRootFrame(evt.position()).y(), theme().shouldDragDocumentInsteadOfThumb(*this, evt));
}
return;
}
if (m_pressedPart != NoPart)
m_pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFrame(evt.position()).x() : convertFromRootFrame(evt.position()).y();
ScrollbarPart part = theme().hitTest(*this, evt.position());
if (part != m_hoveredPart) {
if (m_pressedPart != NoPart) {
if (part == m_pressedPart) {
// The mouse is moving back over the pressed part. We
// need to start up the timer action again.
startTimerIfNeeded(theme().autoscrollTimerDelay());
} else if (m_hoveredPart == m_pressedPart) {
// The mouse is leaving the pressed part. Kill our timer
// if needed.
stopTimerIfNeeded();
}
}
setHoveredPart(part);
}
return;
}
示例5: 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;
}
}
示例6: handleMouseReleaseEvent
bool PlatformScrollbar::handleMouseReleaseEvent(const PlatformMouseEvent& e)
{
ScrollView* parentView = parent();
if (!parentView)
return true;
IntPoint pos = convertFromContainingWindow(e.pos());
updateMousePosition(pos.x(), pos.y());
setCapturingMouse(false);
// FIXME: Invalidate only the portions that actually changed
invalidate();
return true;
}
示例7: mouseUp
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent)
{
setPressedPart(NoPart);
m_pressedPos = 0;
m_draggingDocument = false;
stopTimerIfNeeded();
if (m_scrollableArea) {
// m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
// to really know if the mouse has exited the scrollbar on a mouseUp.
ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
if (part == NoPart)
m_scrollableArea->mouseExitedScrollbar(this);
}
}
示例8: PlatformGestureEventBuilder
bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent)
{
bool handled = false;
if (isEmpty())
return false;
if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type == WebInputEvent::GestureTap) {
// Only let GestureTab in (we only need it and we know PlatformGestureEventBuilder supports it).
PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebGestureEvent&>(inputEvent));
handled = handleGestureEvent(gestureEvent);
if (handled)
return true;
overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent);
}
if (WebInputEvent::isMouseEventType(inputEvent.type) && inputEvent.type != WebInputEvent::MouseEnter) {
// PlatformMouseEventBuilder does not work with MouseEnter type, so we filter it out manually.
PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseEvent&>(inputEvent));
if (mouseEvent.type() == PlatformEvent::MouseMoved)
handled = handleMouseMove(mouseEvent);
else if (mouseEvent.type() == PlatformEvent::MousePressed)
handled = handleMousePress();
if (handled)
return true;
if (mouseEvent.type() == PlatformEvent::MouseMoved)
handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent(mouseEvent) != WebInputEventResult::NotHandled;
if (mouseEvent.type() == PlatformEvent::MousePressed)
handled = overlayMainFrame()->eventHandler().handleMousePressEvent(mouseEvent) != WebInputEventResult::NotHandled;
if (mouseEvent.type() == PlatformEvent::MouseReleased)
handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent(mouseEvent) != WebInputEventResult::NotHandled;
}
if (WebInputEvent::isTouchEventType(inputEvent.type)) {
PlatformTouchEvent touchEvent = PlatformTouchEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebTouchEvent&>(inputEvent));
handled = handleTouchEvent(touchEvent);
if (handled)
return true;
overlayMainFrame()->eventHandler().handleTouchEvent(touchEvent);
}
if (WebInputEvent::isKeyboardEventType(inputEvent.type)) {
PlatformKeyboardEvent keyboardEvent = PlatformKeyboardEventBuilder(static_cast<const WebKeyboardEvent&>(inputEvent));
overlayMainFrame()->eventHandler().keyEvent(keyboardEvent);
}
if (inputEvent.type == WebInputEvent::MouseWheel) {
PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseWheelEvent&>(inputEvent));
handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent) != WebInputEventResult::NotHandled;
}
return handled;
}
示例9: mouseDown
void Scrollbar::mouseDown(const PlatformMouseEvent& evt)
{
// Early exit for right click
if (evt.button() == RightButton)
return;
// FIXME(sky): Do we still need setPressedPart now that we only set it to NoPart?
setPressedPart(NoPart);
int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainingView(evt.position()).x() : convertFromContainingView(evt.position()).y();
if (m_pressedPart == ThumbPart)
m_dragOrigin = m_currentPos;
m_pressedPos = pressedPos;
autoscrollPressedPart(initialAutoscrollTimerDelay());
}
示例10: handleMouseMoveEvent
bool PlatformScrollbar::handleMouseMoveEvent(const PlatformMouseEvent& e)
{
if (!parent())
return true;
if (m_captureStart != None) {
handleMouseMoveEventWhenCapturing(e);
return true;
}
IntPoint pos = convertFromContainingWindow(e.pos());
updateMousePosition(pos.x(), pos.y());
// FIXME: Invalidate only the portions that actually changed
invalidate();
return true;
}
示例11: shouldSnapBackToDragOrigin
bool ScrollbarThemeWin::shouldSnapBackToDragOrigin(Scrollbar* scrollbar, const PlatformMouseEvent& evt)
{
// Find the rect within which we shouldn't snap, by expanding the track rect
// in both dimensions.
IntRect rect = trackRect(scrollbar);
const bool horz = scrollbar->orientation() == HorizontalScrollbar;
const int thickness = scrollbarThickness(scrollbar->controlSize());
rect.inflateX((horz ? kOffEndMultiplier : kOffSideMultiplier) * thickness);
rect.inflateY((horz ? kOffSideMultiplier : kOffEndMultiplier) * thickness);
// Convert the event to local coordinates.
IntPoint mousePosition = scrollbar->convertFromContainingWindow(evt.pos());
mousePosition.move(scrollbar->x(), scrollbar->y());
// We should snap iff the event is outside our calculated rect.
return !rect.contains(mousePosition);
}
示例12: mouseUp
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) {
bool isCaptured = m_pressedPart == ThumbPart;
setPressedPart(NoPart);
m_pressedPos = 0;
m_draggingDocument = false;
stopTimerIfNeeded();
if (m_scrollableArea) {
if (isCaptured)
m_scrollableArea->mouseReleasedScrollbar();
// m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so
// we have to hit test to really know if the mouse has exited the scrollbar
// on a mouseUp.
ScrollbarPart part = theme().hitTest(*this, mouseEvent.position());
if (part == NoPart)
m_scrollableArea->mouseExitedScrollbar(*this);
}
}
示例13: handleMouseReleaseEvent
bool PlatformScrollbar::handleMouseReleaseEvent(const PlatformMouseEvent& evt)
{
const QPoint pos = convertFromContainingWindow(evt.pos());
const QPoint topLeft = m_opt.rect.topLeft();
m_opt.rect.moveTo(QPoint(0, 0));
QStyle::SubControl scAtMousePoint = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
m_opt.rect.moveTo(topLeft);
m_hoveredPart = scAtMousePoint;
if (m_hoveredPart == QStyle::SC_None)
m_opt.state &= ~QStyle::State_MouseOver;
m_opt.state &= ~QStyle::State_Sunken;
m_pressedPart = QStyle::SC_None;
m_pressedPos = 0;
stopTimerIfNeeded();
invalidate();
return true;
}
示例14: 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;
}
}
示例15: handleMouseReleaseForMiddleClickAutoscroll
void AutoscrollController::handleMouseReleaseForMiddleClickAutoscroll(
LocalFrame* frame,
const PlatformMouseEvent& mouseEvent) {
DCHECK(RuntimeEnabledFeatures::middleClickAutoscrollEnabled());
if (!frame->isMainFrame())
return;
switch (m_autoscrollType) {
case AutoscrollForMiddleClick:
if (mouseEvent.pointerProperties().button ==
WebPointerProperties::Button::Middle)
m_autoscrollType = AutoscrollForMiddleClickCanStop;
break;
case AutoscrollForMiddleClickCanStop:
stopAutoscroll();
break;
case AutoscrollForDragAndDrop:
case AutoscrollForSelection:
case NoAutoscroll:
// Nothing to do.
break;
}
}