OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef UI_BASE_EVENTS_H_ |
6 #define UI_BASE_EVENTS_H_ | 6 #define UI_BASE_EVENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 ET_KEY_PRESSED, | 28 ET_KEY_PRESSED, |
29 ET_KEY_RELEASED, | 29 ET_KEY_RELEASED, |
30 ET_MOUSEWHEEL, | 30 ET_MOUSEWHEEL, |
31 ET_TOUCH_RELEASED, | 31 ET_TOUCH_RELEASED, |
32 ET_TOUCH_PRESSED, | 32 ET_TOUCH_PRESSED, |
33 ET_TOUCH_MOVED, | 33 ET_TOUCH_MOVED, |
34 ET_TOUCH_STATIONARY, | 34 ET_TOUCH_STATIONARY, |
35 ET_TOUCH_CANCELLED, | 35 ET_TOUCH_CANCELLED, |
36 ET_DROP_TARGET_EVENT, | 36 ET_DROP_TARGET_EVENT, |
37 ET_FOCUS_CHANGE, | 37 ET_FOCUS_CHANGE, |
| 38 ET_SCROLL, |
38 }; | 39 }; |
39 | 40 |
40 // Event flags currently supported | 41 // Event flags currently supported |
41 enum EventFlags { | 42 enum EventFlags { |
42 EF_CAPS_LOCK_DOWN = 1 << 0, | 43 EF_CAPS_LOCK_DOWN = 1 << 0, |
43 EF_SHIFT_DOWN = 1 << 1, | 44 EF_SHIFT_DOWN = 1 << 1, |
44 EF_CONTROL_DOWN = 1 << 2, | 45 EF_CONTROL_DOWN = 1 << 2, |
45 EF_ALT_DOWN = 1 << 3, | 46 EF_ALT_DOWN = 1 << 3, |
46 EF_LEFT_BUTTON_DOWN = 1 << 4, | 47 EF_LEFT_BUTTON_DOWN = 1 << 4, |
47 EF_MIDDLE_BUTTON_DOWN = 1 << 5, | 48 EF_MIDDLE_BUTTON_DOWN = 1 << 5, |
(...skipping 15 matching lines...) Expand all Loading... |
63 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously | 64 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously |
64 // started touch sequence. | 65 // started touch sequence. |
65 TOUCH_STATUS_END, // The touch event ended the touch sequence. | 66 TOUCH_STATUS_END, // The touch event ended the touch sequence. |
66 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't | 67 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't |
67 // terminate the touch sequence. | 68 // terminate the touch sequence. |
68 TOUCH_STATUS_SYNTH_MOUSE // The touch event was not processed, but a | 69 TOUCH_STATUS_SYNTH_MOUSE // The touch event was not processed, but a |
69 // synthetic mouse event generated from the | 70 // synthetic mouse event generated from the |
70 // unused touch event was handled. | 71 // unused touch event was handled. |
71 }; | 72 }; |
72 | 73 |
| 74 // Updates the list of devices for cached properties. |
| 75 UI_EXPORT void UpdateDeviceList(); |
| 76 |
73 // Get the EventType from a native event. | 77 // Get the EventType from a native event. |
74 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); | 78 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); |
75 | 79 |
76 // Get the EventFlags from a native event. | 80 // Get the EventFlags from a native event. |
77 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 81 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
78 | 82 |
79 // Get the location from a native event. | 83 // Get the location from a native event. |
80 UI_EXPORT gfx::Point EventLocationFromNative( | 84 UI_EXPORT gfx::Point EventLocationFromNative( |
81 const base::NativeEvent& native_event); | 85 const base::NativeEvent& native_event); |
82 | 86 |
(...skipping 21 matching lines...) Expand all Loading... |
104 // Gets the radius along the X/Y axis from a native event. Default is 1.0. | 108 // Gets the radius along the X/Y axis from a native event. Default is 1.0. |
105 UI_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event); | 109 UI_EXPORT float GetTouchRadiusX(const base::NativeEvent& native_event); |
106 UI_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event); | 110 UI_EXPORT float GetTouchRadiusY(const base::NativeEvent& native_event); |
107 | 111 |
108 // Gets the angle of the major axis away from the X axis. Default is 0.0. | 112 // Gets the angle of the major axis away from the X axis. Default is 0.0. |
109 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); | 113 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); |
110 | 114 |
111 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. | 115 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. |
112 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); | 116 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); |
113 | 117 |
| 118 // Returns whether this is a scroll event and optionally gets the amount to be |
| 119 // scrolled. |x_offset| and |y_offset| can be NULL. |
| 120 UI_EXPORT bool GetScrollOffsets(const base::NativeEvent& native_event, |
| 121 float* x_offset, |
| 122 float* y_offset); |
| 123 |
114 // Creates and returns no-op event. | 124 // Creates and returns no-op event. |
115 UI_EXPORT base::NativeEvent CreateNoopEvent(); | 125 UI_EXPORT base::NativeEvent CreateNoopEvent(); |
116 | 126 |
117 } // namespace ui | 127 } // namespace ui |
118 | 128 |
119 #endif // UI_BASE_EVENTS_H_ | 129 #endif // UI_BASE_EVENTS_H_ |
OLD | NEW |