Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: Source/core/platform/PlatformEvent.h

Issue 25527004: Move PlatformEvent.cpp/.h to Source/platform/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove PLATFORM_EXPORT macro from entirely-inline class Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/platform/PlatformEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef PlatformEvent_h
27 #define PlatformEvent_h
28
29 namespace WebCore {
30
31 class PlatformEvent {
32 public:
33 enum Type {
34 NoType = 0,
35
36 // PlatformKeyboardEvent
37 KeyDown,
38 KeyUp,
39 RawKeyDown,
40 Char,
41
42 // PlatformMouseEvent
43 MouseMoved,
44 MousePressed,
45 MouseReleased,
46 MouseScroll,
47
48 // PlatformWheelEvent
49 Wheel,
50
51 // PlatformGestureEvent
52 GestureScrollBegin,
53 GestureScrollEnd,
54 GestureScrollUpdate,
55 GestureScrollUpdateWithoutPropagation,
56 GestureTap,
57 GestureTapUnconfirmed,
58 GestureTapDown,
59 GestureTapDownCancel,
60 GestureTwoFingerTap,
61 GestureLongPress,
62 GestureLongTap,
63 GesturePinchBegin,
64 GesturePinchEnd,
65 GesturePinchUpdate,
66
67 // PlatformTouchEvent
68 TouchStart,
69 TouchMove,
70 TouchEnd,
71 TouchCancel,
72 };
73
74 enum Modifiers {
75 AltKey = 1 << 0,
76 CtrlKey = 1 << 1,
77 MetaKey = 1 << 2,
78 ShiftKey = 1 << 3,
79 };
80
81 Type type() const { return static_cast<Type>(m_type); }
82
83 bool shiftKey() const { return m_modifiers & ShiftKey; }
84 bool ctrlKey() const { return m_modifiers & CtrlKey; }
85 bool altKey() const { return m_modifiers & AltKey; }
86 bool metaKey() const { return m_modifiers & MetaKey; }
87
88 unsigned modifiers() const { return m_modifiers; }
89
90 double timestamp() const { return m_timestamp; }
91
92 protected:
93 PlatformEvent()
94 : m_type(NoType)
95 , m_modifiers(0)
96 , m_timestamp(0)
97 {
98 }
99
100 explicit PlatformEvent(Type type)
101 : m_type(type)
102 , m_modifiers(0)
103 , m_timestamp(0)
104 {
105 }
106
107 PlatformEvent(Type type, Modifiers modifiers, double timestamp)
108 : m_type(type)
109 , m_modifiers(modifiers)
110 , m_timestamp(timestamp)
111 {
112 }
113
114 PlatformEvent(Type type, bool shiftKey, bool ctrlKey, bool altKey, bool meta Key, double timestamp)
115 : m_type(type)
116 , m_modifiers(0)
117 , m_timestamp(timestamp)
118 {
119 if (shiftKey)
120 m_modifiers |= ShiftKey;
121 if (ctrlKey)
122 m_modifiers |= CtrlKey;
123 if (altKey)
124 m_modifiers |= AltKey;
125 if (metaKey)
126 m_modifiers |= MetaKey;
127 }
128
129 // Explicit protected destructor so that people don't accidentally
130 // delete a PlatformEvent.
131 ~PlatformEvent()
132 {
133 }
134
135 unsigned m_type;
136 unsigned m_modifiers;
137 double m_timestamp;
138 };
139
140 } // namespace WebCore
141
142 #endif // PlatformEvent_h
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/platform/PlatformEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698