| 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 |
| 39 // GestureEvent types. |
| 40 ET_GESTURE_SCROLL_BEGIN, |
| 41 ET_GESTURE_SCROLL_END, |
| 42 ET_GESTURE_SCROLL_UPDATE, |
| 43 ET_GESTURE_TAP, |
| 44 ET_GESTURE_TAP_DOWN, |
| 45 ET_GESTURE_DOUBLE_TAP, |
| 38 }; | 46 }; |
| 39 | 47 |
| 40 // Event flags currently supported | 48 // Event flags currently supported |
| 41 enum EventFlags { | 49 enum EventFlags { |
| 42 EF_CAPS_LOCK_DOWN = 1 << 0, | 50 EF_CAPS_LOCK_DOWN = 1 << 0, |
| 43 EF_SHIFT_DOWN = 1 << 1, | 51 EF_SHIFT_DOWN = 1 << 1, |
| 44 EF_CONTROL_DOWN = 1 << 2, | 52 EF_CONTROL_DOWN = 1 << 2, |
| 45 EF_ALT_DOWN = 1 << 3, | 53 EF_ALT_DOWN = 1 << 3, |
| 46 EF_LEFT_BUTTON_DOWN = 1 << 4, | 54 EF_LEFT_BUTTON_DOWN = 1 << 4, |
| 47 EF_MIDDLE_BUTTON_DOWN = 1 << 5, | 55 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 | 71 TOUCH_STATUS_CONTINUE, // The touch event is part of a previously |
| 64 // started touch sequence. | 72 // started touch sequence. |
| 65 TOUCH_STATUS_END, // The touch event ended the touch sequence. | 73 TOUCH_STATUS_END, // The touch event ended the touch sequence. |
| 66 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't | 74 TOUCH_STATUS_CANCEL, // The touch event was cancelled, but didn't |
| 67 // terminate the touch sequence. | 75 // terminate the touch sequence. |
| 68 TOUCH_STATUS_SYNTH_MOUSE // The touch event was not processed, but a | 76 TOUCH_STATUS_SYNTH_MOUSE // The touch event was not processed, but a |
| 69 // synthetic mouse event generated from the | 77 // synthetic mouse event generated from the |
| 70 // unused touch event was handled. | 78 // unused touch event was handled. |
| 71 }; | 79 }; |
| 72 | 80 |
| 81 enum GestureStatus { |
| 82 GESTURE_STATUS_UNKNOWN = 0, // Unknown Gesture status. This is used to |
| 83 // indicate that the Gesture event was not |
| 84 // handled. |
| 85 GESTURE_STATUS_CONSUMED, // The Gesture event got consumed. |
| 86 GESTURE_STATUS_SYNTH_MOUSE // The Gesture event was not processed, but a |
| 87 // synthetic mouse event generated from the |
| 88 // unused Gesture event was handled. |
| 89 }; |
| 90 |
| 73 // Get the EventType from a native event. | 91 // Get the EventType from a native event. |
| 74 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); | 92 UI_EXPORT EventType EventTypeFromNative(const base::NativeEvent& native_event); |
| 75 | 93 |
| 76 // Get the EventFlags from a native event. | 94 // Get the EventFlags from a native event. |
| 77 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 95 UI_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
| 78 | 96 |
| 79 // Get the location from a native event. | 97 // Get the location from a native event. |
| 80 UI_EXPORT gfx::Point EventLocationFromNative( | 98 UI_EXPORT gfx::Point EventLocationFromNative( |
| 81 const base::NativeEvent& native_event); | 99 const base::NativeEvent& native_event); |
| 82 | 100 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 99 | 117 |
| 100 // Gets the angle of the major axis away from the X axis. Default is 0.0. | 118 // Gets the angle of the major axis away from the X axis. Default is 0.0. |
| 101 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); | 119 UI_EXPORT float GetTouchAngle(const base::NativeEvent& native_event); |
| 102 | 120 |
| 103 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. | 121 // Gets the force from a native_event. Normalized to be [0, 1]. Default is 0.0. |
| 104 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); | 122 UI_EXPORT float GetTouchForce(const base::NativeEvent& native_event); |
| 105 | 123 |
| 106 } // namespace ui | 124 } // namespace ui |
| 107 | 125 |
| 108 #endif // UI_BASE_EVENTS_H_ | 126 #endif // UI_BASE_EVENTS_H_ |
| OLD | NEW |