| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #define PlatformEvent_h | 27 #define PlatformEvent_h |
| 28 | 28 |
| 29 #include "wtf/Allocator.h" | 29 #include "wtf/Allocator.h" |
| 30 #include "wtf/Noncopyable.h" | 30 #include "wtf/Noncopyable.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class PlatformEvent { | 34 class PlatformEvent { |
| 35 DISALLOW_NEW(); | 35 DISALLOW_NEW(); |
| 36 public: | 36 public: |
| 37 enum Type { | 37 enum EventType { |
| 38 NoType = 0, | 38 NoType = 0, |
| 39 | 39 |
| 40 // PlatformKeyboardEvent | 40 // PlatformKeyboardEvent |
| 41 KeyDown, | 41 KeyDown, |
| 42 KeyUp, | 42 KeyUp, |
| 43 RawKeyDown, | 43 RawKeyDown, |
| 44 Char, | 44 Char, |
| 45 | 45 |
| 46 // PlatformMouseEvent | 46 // PlatformMouseEvent |
| 47 MouseMoved, | 47 MouseMoved, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // and don't indicate explicit depressed state. | 114 // and don't indicate explicit depressed state. |
| 115 KeyModifiers = SymbolKey | FnKey | OSKey | AltGrKey | MetaKey | AltKey |
CtrlKey | ShiftKey, | 115 KeyModifiers = SymbolKey | FnKey | OSKey | AltGrKey | MetaKey | AltKey |
CtrlKey | ShiftKey, |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 enum RailsMode { | 118 enum RailsMode { |
| 119 RailsModeFree = 0, | 119 RailsModeFree = 0, |
| 120 RailsModeHorizontal = 1, | 120 RailsModeHorizontal = 1, |
| 121 RailsModeVertical = 2, | 121 RailsModeVertical = 2, |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 Type type() const { return static_cast<Type>(m_type); } | 124 EventType type() const { return static_cast<EventType>(m_type); } |
| 125 | 125 |
| 126 bool shiftKey() const { return m_modifiers & ShiftKey; } | 126 bool shiftKey() const { return m_modifiers & ShiftKey; } |
| 127 bool ctrlKey() const { return m_modifiers & CtrlKey; } | 127 bool ctrlKey() const { return m_modifiers & CtrlKey; } |
| 128 bool altKey() const { return m_modifiers & AltKey; } | 128 bool altKey() const { return m_modifiers & AltKey; } |
| 129 bool metaKey() const { return m_modifiers & MetaKey; } | 129 bool metaKey() const { return m_modifiers & MetaKey; } |
| 130 | 130 |
| 131 Modifiers modifiers() const { return static_cast<Modifiers>(m_modifiers); } | 131 Modifiers getModifiers() const { return static_cast<Modifiers>(m_modifiers);
} |
| 132 | 132 |
| 133 double timestamp() const { return m_timestamp; } | 133 double timestamp() const { return m_timestamp; } |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 PlatformEvent() | 136 PlatformEvent() |
| 137 : m_type(NoType) | 137 : m_type(NoType) |
| 138 , m_modifiers() | 138 , m_modifiers() |
| 139 , m_timestamp(0) | 139 , m_timestamp(0) |
| 140 { | 140 { |
| 141 } | 141 } |
| 142 | 142 |
| 143 explicit PlatformEvent(Type type) | 143 explicit PlatformEvent(EventType type) |
| 144 : m_type(type) | 144 : m_type(type) |
| 145 , m_modifiers(0) | 145 , m_modifiers(0) |
| 146 , m_timestamp(0) | 146 , m_timestamp(0) |
| 147 { | 147 { |
| 148 } | 148 } |
| 149 | 149 |
| 150 PlatformEvent(Type type, Modifiers modifiers, double timestamp) | 150 PlatformEvent(EventType type, Modifiers modifiers, double timestamp) |
| 151 : m_type(type) | 151 : m_type(type) |
| 152 , m_modifiers(modifiers) | 152 , m_modifiers(modifiers) |
| 153 , m_timestamp(timestamp) | 153 , m_timestamp(timestamp) |
| 154 { | 154 { |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Explicit protected destructor so that people don't accidentally | 157 // Explicit protected destructor so that people don't accidentally |
| 158 // delete a PlatformEvent. | 158 // delete a PlatformEvent. |
| 159 ~PlatformEvent() | 159 ~PlatformEvent() |
| 160 { | 160 { |
| 161 } | 161 } |
| 162 | 162 |
| 163 unsigned m_type; | 163 unsigned m_type; |
| 164 unsigned m_modifiers; | 164 unsigned m_modifiers; |
| 165 double m_timestamp; | 165 double m_timestamp; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace blink | 168 } // namespace blink |
| 169 | 169 |
| 170 #endif // PlatformEvent_h | 170 #endif // PlatformEvent_h |
| OLD | NEW |