OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) | 2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) |
3 | 3 |
4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
8 | 8 |
9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 Library General Public License for more details. | 12 Library General Public License for more details. |
13 | 13 |
14 You should have received a copy of the GNU Library General Public License | 14 You should have received a copy of the GNU Library General Public License |
15 along with this library; see the file COPYING.LIB. If not, write to | 15 along with this library; see the file COPYING.LIB. If not, write to |
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 Boston, MA 02110-1301, USA. | 17 Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef PlatformTouchPoint_h | 20 #ifndef PlatformTouchPoint_h |
21 #define PlatformTouchPoint_h | 21 #define PlatformTouchPoint_h |
22 | 22 |
23 #include "IntPoint.h" | 23 #include "IntPoint.h" |
24 #include <wtf/Vector.h> | 24 #include <wtf/Vector.h> |
25 | 25 |
26 #if ENABLE(TOUCH_EVENTS) | 26 #if ENABLE(TOUCH_EVENTS) |
27 | 27 |
28 #if PLATFORM(QT) | |
29 #include <QTouchEvent> | |
30 #endif | |
31 | |
32 #if PLATFORM(BLACKBERRY) | |
33 namespace BlackBerry { | |
34 namespace Platform { | |
35 class TouchPoint; | |
36 }; | |
37 }; | |
38 #endif | |
39 | |
40 namespace WebCore { | 28 namespace WebCore { |
41 | 29 |
42 class PlatformTouchEvent; | 30 class PlatformTouchEvent; |
43 | 31 |
44 class PlatformTouchPoint { | 32 class PlatformTouchPoint { |
45 public: | 33 public: |
46 enum State { | 34 enum State { |
47 TouchReleased, | 35 TouchReleased, |
48 TouchPressed, | 36 TouchPressed, |
49 TouchMoved, | 37 TouchMoved, |
50 TouchStationary, | 38 TouchStationary, |
51 TouchCancelled, | 39 TouchCancelled, |
52 TouchStateEnd // Placeholder: must remain the last item. | 40 TouchStateEnd // Placeholder: must remain the last item. |
53 }; | 41 }; |
54 | 42 |
55 // This is necessary for us to be able to build synthetic events. | 43 // This is necessary for us to be able to build synthetic events. |
56 PlatformTouchPoint() | 44 PlatformTouchPoint() |
57 : m_id(0) | 45 : m_id(0) |
58 , m_radiusY(0) | 46 , m_radiusY(0) |
59 , m_radiusX(0) | 47 , m_radiusX(0) |
60 , m_rotationAngle(0) | 48 , m_rotationAngle(0) |
61 , m_force(0) | 49 , m_force(0) |
62 { | 50 { |
63 } | 51 } |
64 | 52 |
65 #if PLATFORM(BLACKBERRY) | |
66 PlatformTouchPoint(const BlackBerry::Platform::TouchPoint&); | |
67 #endif | |
68 | |
69 unsigned id() const { return m_id; } | 53 unsigned id() const { return m_id; } |
70 State state() const { return m_state; } | 54 State state() const { return m_state; } |
71 IntPoint screenPos() const { return m_screenPos; } | 55 IntPoint screenPos() const { return m_screenPos; } |
72 IntPoint pos() const { return m_pos; } | 56 IntPoint pos() const { return m_pos; } |
73 int radiusX() const { return m_radiusX; } | 57 int radiusX() const { return m_radiusX; } |
74 int radiusY() const { return m_radiusY; } | 58 int radiusY() const { return m_radiusY; } |
75 float rotationAngle() const { return m_rotationAngle; } | 59 float rotationAngle() const { return m_rotationAngle; } |
76 float force() const { return m_force; } | 60 float force() const { return m_force; } |
77 | 61 |
78 protected: | 62 protected: |
79 unsigned m_id; | 63 unsigned m_id; |
80 State m_state; | 64 State m_state; |
81 IntPoint m_screenPos; | 65 IntPoint m_screenPos; |
82 IntPoint m_pos; | 66 IntPoint m_pos; |
83 int m_radiusY; | 67 int m_radiusY; |
84 int m_radiusX; | 68 int m_radiusX; |
85 float m_rotationAngle; | 69 float m_rotationAngle; |
86 float m_force; | 70 float m_force; |
87 }; | 71 }; |
88 | 72 |
89 } | 73 } |
90 | 74 |
91 #endif // ENABLE(TOUCH_EVENTS) | 75 #endif // ENABLE(TOUCH_EVENTS) |
92 | 76 |
93 #endif // PlatformTouchPoint_h | 77 #endif // PlatformTouchPoint_h |
OLD | NEW |