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