2
* Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
2
* Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
4
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions
38
class QGraphicsSceneWheelEvent;
43
typedef struct HWND__* HWND;
44
typedef unsigned WPARAM;
56
49
class wxMouseEvent;
60
57
namespace WebCore {
62
// Wheel events come in three flavors:
63
// The ScrollByPixelWheelEvent is a fine-grained event that specifies the precise number of pixels to scroll. It is sent by MacBook touchpads on OS X.
64
// For ScrollByPixelWheelEvents, the delta values contain the precise number of pixels to scroll.
65
// The ScrollByLineWheelEvent (the normal wheel event) sends a delta that can be corrected by a line multiplier to determine how many lines to scroll.
66
// If the platform has configurable line sensitivity (Windows), then the number of lines to scroll is used in order to behave like the platform.
67
// If the platform does not have configurable line sensitivity, then WebCore's default behavior is used (which scrolls 3 * the wheel line delta).
68
// For ScrollByLineWheelEvents, the delta values represent the number of lines to scroll.
69
// The ScrollByPageWheelEvent indicates that the wheel event should scroll an entire page instead. In this case WebCore's built in paging behavior is used to page
62
// Wheel events come in two flavors:
63
// The ScrollByPixelWheelEvent is a fine-grained event that specifies the precise number of pixels to scroll. It is sent directly by MacBook touchpads on OS X,
64
// and synthesized in other cases where platforms generate line-by-line scrolling events.
65
// The ScrollByPageWheelEvent indicates that the wheel event should scroll an entire page. In this case WebCore's built in paging behavior is used to page
70
66
// up and down (you get the same behavior as if the user was clicking in a scrollbar track to page up or page down). Page scrolling only works in the vertical direction.
71
enum PlatformWheelEventGranularity { ScrollByLineWheelEvent, ScrollByPageWheelEvent, ScrollByPixelWheelEvent };
67
enum PlatformWheelEventGranularity { ScrollByPageWheelEvent, ScrollByPixelWheelEvent };
73
// WebCore uses a line multiple of ~3 (40px per line step) when doing arrowing with a scrollbar or line stepping via the arrow keys. The delta for wheeling is expressed
74
// as a # of actual lines (40 / 3 = 1 wheel line). We use the horizontalLineMultiplier and verticalLineMultiplier methods to incorporate the line multiplier into the deltas. On
75
// platforms that do not support wheel sensitivity, we use this hardcoded constant value of 3 to ensure that wheeling by default matches the WebCore multiplier you
76
// get when doing other kinds of line stepping.
77
const int cLineMultiplier = 3;
79
69
class PlatformWheelEvent {
81
71
const IntPoint& pos() const { return m_position; } // PlatformWindow coordinates.
84
74
float deltaX() const { return m_deltaX; }
85
75
float deltaY() const { return m_deltaY; }
77
float wheelTicksX() const { return m_wheelTicksX; }
78
float wheelTicksY() const { return m_wheelTicksY; }
87
80
PlatformWheelEventGranularity granularity() const { return m_granularity; }
89
82
bool isAccepted() const { return m_isAccepted; }
100
93
void accept() { m_isAccepted = true; }
101
94
void ignore() { m_isAccepted = false; }
104
PlatformWheelEvent(NSEvent*);
107
PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isHorizontal);
96
void turnVerticalTicksIntoHorizontal()
101
m_wheelTicksX = m_wheelTicksY;
109
105
#if PLATFORM(GTK)
110
106
PlatformWheelEvent(GdkEventScroll*);
109
#if PLATFORM(MAC) && defined(__OBJC__)
110
PlatformWheelEvent(NSEvent *, NSView *windowView);
113
114
PlatformWheelEvent(QWheelEvent*);
115
PlatformWheelEvent(QGraphicsSceneWheelEvent*);
116
void applyDelta(int delta, Qt::Orientation);
120
PlatformWheelEvent(HWND, WPARAM, LPARAM, bool isMouseHWheel);
121
PlatformWheelEvent(HWND, const FloatSize& delta, const FloatPoint& location);
116
125
PlatformWheelEvent(const wxMouseEvent&, const wxPoint&);
129
PlatformWheelEvent(BMessage*);
121
int horizontalLineMultiplier() const { return cLineMultiplier; }
122
int verticalLineMultiplier() const { return cLineMultiplier; }
124
int horizontalLineMultiplier() const;
125
int verticalLineMultiplier() const;
128
133
IntPoint m_position;
129
134
IntPoint m_globalPosition;
132
139
PlatformWheelEventGranularity m_granularity;
133
140
bool m_isAccepted;