OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_BASE_EVENTS_EVENT_CONSTANTS_H_ | 5 #ifndef UI_BASE_EVENTS_EVENT_CONSTANTS_H_ |
6 #define UI_BASE_EVENTS_EVENT_CONSTANTS_H_ | 6 #define UI_BASE_EVENTS_EVENT_CONSTANTS_H_ |
7 | 7 |
8 #include "base/event_types.h" | 8 #include "base/event_types.h" |
9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 EF_IS_DOUBLE_CLICK = 1 << 16, | 91 EF_IS_DOUBLE_CLICK = 1 << 16, |
92 EF_IS_TRIPLE_CLICK = 1 << 17, | 92 EF_IS_TRIPLE_CLICK = 1 << 17, |
93 EF_IS_NON_CLIENT = 1 << 18, | 93 EF_IS_NON_CLIENT = 1 << 18, |
94 EF_IS_SYNTHESIZED = 1 << 19, // Only for Aura. See ui/aura/root_window.h | 94 EF_IS_SYNTHESIZED = 1 << 19, // Only for Aura. See ui/aura/root_window.h |
95 EF_FROM_TOUCH = 1 << 20, // Indicates this mouse event is generated | 95 EF_FROM_TOUCH = 1 << 20, // Indicates this mouse event is generated |
96 // from an unconsumed touch/gesture event. | 96 // from an unconsumed touch/gesture event. |
97 }; | 97 }; |
98 | 98 |
99 // Result of dispatching an event. | 99 // Result of dispatching an event. |
100 enum EventResult { | 100 enum EventResult { |
101 ER_UNHANDLED = 0, // The event hasn't been handled. The event can be | 101 ER_UNHANDLED = 0, // The event hasn't been handled. The event can be |
102 // propagated to other handlers. | 102 // propagated to other handlers. |
103 ER_HANDLED, // The event has already been handled, but it can still be | 103 ER_HANDLED = 1 << 0, // The event has already been handled, but it can |
104 // propagated to other handlers. | 104 // still be propagated to other handlers. |
105 ER_CONSUMED, // The event has been handled, and it should not be | 105 ER_CONSUMED = 1 << 1, // The event has been handled, and it should not be |
106 // propagated to other handlers. | 106 // propagated to other handlers. |
| 107 ER_ASYNC = 1 << 2, // The event will be processed asynchronously. The |
| 108 // event can still be propagated to other handlers. |
107 }; | 109 }; |
108 | 110 |
109 // Phase of the event dispatch. | 111 // Phase of the event dispatch. |
110 enum EventPhase { | 112 enum EventPhase { |
111 EP_PREDISPATCH, | 113 EP_PREDISPATCH, |
112 EP_PRETARGET, | 114 EP_PRETARGET, |
113 EP_TARGET, | 115 EP_TARGET, |
114 EP_POSTTARGET, | 116 EP_POSTTARGET, |
115 EP_POSTDISPATCH | 117 EP_POSTDISPATCH |
116 }; | 118 }; |
117 | 119 |
118 enum TouchStatus { | 120 enum TouchStatus { |
119 TOUCH_STATUS_UNKNOWN = 0, // Unknown touch status. This is used to indicate | 121 TOUCH_STATUS_UNKNOWN = 0, // Unknown touch status. This is used to indicate |
120 // that the touch event was not handled. | 122 // that the touch event was not handled. |
121 TOUCH_STATUS_START, // The touch event initiated a touch sequence. | 123 TOUCH_STATUS_START, // The touch event initiated a touch sequence. |
122 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously | 124 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously |
123 // started touch sequence. | 125 // started touch sequence. |
124 TOUCH_STATUS_END, // The touch event ended the touch sequence. | 126 TOUCH_STATUS_END, // The touch event ended the touch sequence. |
125 TOUCH_STATUS_SYNTH_MOUSE, // The touch event was not processed, but a | |
126 // synthetic mouse event generated from the | |
127 // unused touch event was handled. | |
128 TOUCH_STATUS_QUEUED, // The touch event has not been processed yet, but | 127 TOUCH_STATUS_QUEUED, // The touch event has not been processed yet, but |
129 // may be processed asynchronously later. This also | 128 // may be processed asynchronously later. This also |
130 // places a lock on touch-events (i.e. all | 129 // places a lock on touch-events (i.e. all |
131 // subsequent touch-events should be sent to the | 130 // subsequent touch-events should be sent to the |
132 // current handler). | 131 // current handler). |
133 TOUCH_STATUS_QUEUED_END, // Similar to TOUCH_STATUS_QUEUED, except that | 132 TOUCH_STATUS_QUEUED_END, // Similar to TOUCH_STATUS_QUEUED, except that |
134 // subsequent touch-events can be sent to any | 133 // subsequent touch-events can be sent to any |
135 // handler. | 134 // handler. |
136 }; | 135 }; |
137 | 136 |
| 137 // Returns an equivalent EventResult from a TouchStatus. |
| 138 UI_EXPORT EventResult EventResultFromTouchStatus(TouchStatus status); |
| 139 |
138 // Updates the list of devices for cached properties. | 140 // Updates the list of devices for cached properties. |
139 UI_EXPORT void UpdateDeviceList(); | 141 UI_EXPORT void UpdateDeviceList(); |
140 | 142 |
141 // Get the EventType from a native event. | 143 // Get the EventType from a native event. |
142 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); | 144 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); |
143 | 145 |
144 // Get the EventFlags from a native event. | 146 // Get the EventFlags from a native event. |
145 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 147 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
146 | 148 |
147 UI_EXPORT base::TimeDelta EventTimeFromNative( | 149 UI_EXPORT base::TimeDelta EventTimeFromNative( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 UI_EXPORT int GetModifiersFromKeyState(); | 234 UI_EXPORT int GetModifiersFromKeyState(); |
233 | 235 |
234 // Returns true if |message| identifies a mouse event that was generated as the | 236 // Returns true if |message| identifies a mouse event that was generated as the |
235 // result of a touch event. | 237 // result of a touch event. |
236 UI_EXPORT bool IsMouseEventFromTouch(UINT message); | 238 UI_EXPORT bool IsMouseEventFromTouch(UINT message); |
237 #endif | 239 #endif |
238 | 240 |
239 } // namespace ui | 241 } // namespace ui |
240 | 242 |
241 #endif // UI_BASE_EVENTS_EVENT_CONSTANTS_H_ | 243 #endif // UI_BASE_EVENTS_EVENT_CONSTANTS_H_ |
OLD | NEW |