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 3 // found in the LICENSE file. 4 5 #ifndef UI_BASE_EVENTS_EVENT_CONSTANTS_H_ 6 #define UI_BASE_EVENTS_EVENT_CONSTANTS_H_ 7 8 namespace ui { 9 10 // Event types. (prefixed because of a conflict with windows headers) 11 enum EventType { 12 ET_UNKNOWN = 0, 13 ET_MOUSE_PRESSED, 14 ET_MOUSE_DRAGGED, 15 ET_MOUSE_RELEASED, 16 ET_MOUSE_MOVED, 17 ET_MOUSE_ENTERED, 18 ET_MOUSE_EXITED, 19 ET_KEY_PRESSED, 20 ET_KEY_RELEASED, 21 ET_MOUSEWHEEL, 22 ET_MOUSE_CAPTURE_CHANGED, // Event has no location. 23 ET_TOUCH_RELEASED, 24 ET_TOUCH_PRESSED, 25 ET_TOUCH_MOVED, 26 ET_TOUCH_STATIONARY, 27 ET_TOUCH_CANCELLED, 28 ET_DROP_TARGET_EVENT, 29 ET_TRANSLATED_KEY_PRESS, 30 ET_TRANSLATED_KEY_RELEASE, 31 32 // GestureEvent types 33 ET_GESTURE_SCROLL_BEGIN, 34 ET_GESTURE_SCROLL_END, 35 ET_GESTURE_SCROLL_UPDATE, 36 ET_GESTURE_TAP, 37 ET_GESTURE_TAP_DOWN, 38 ET_GESTURE_TAP_CANCEL, 39 ET_GESTURE_BEGIN, // Sent before any other gesture types. 40 ET_GESTURE_END, // Sent after any other gestures. 41 ET_GESTURE_TWO_FINGER_TAP, 42 ET_GESTURE_PINCH_BEGIN, 43 ET_GESTURE_PINCH_END, 44 ET_GESTURE_PINCH_UPDATE, 45 ET_GESTURE_LONG_PRESS, 46 ET_GESTURE_LONG_TAP, 47 // A SWIPE gesture can happen at the end of a TAP_UP gesture if the 48 // finger(s) were moving quickly before they are released. 49 ET_GESTURE_MULTIFINGER_SWIPE, 50 51 // Scroll support. 52 // TODO[davemoore] we need to unify these events w/ touch and gestures. 53 ET_SCROLL, 54 ET_SCROLL_FLING_START, 55 ET_SCROLL_FLING_CANCEL, 56 57 // Sent by the system to indicate any modal type operations, such as drag and 58 // drop or menus, should stop. 59 ET_CANCEL_MODE, 60 61 // Sent by the CrOS gesture library for interesting patterns that we want 62 // to track with the UMA system. 63 ET_UMA_DATA, 64 65 // Must always be last. User namespace starts above this value. 66 // See ui::RegisterCustomEventType(). 67 ET_LAST 68 }; 69 70 // Event flags currently supported 71 enum EventFlags { 72 EF_NONE = 0, // Used to denote no flags explicitly 73 EF_CAPS_LOCK_DOWN = 1 << 0, 74 EF_SHIFT_DOWN = 1 << 1, 75 EF_CONTROL_DOWN = 1 << 2, 76 EF_ALT_DOWN = 1 << 3, 77 EF_LEFT_MOUSE_BUTTON = 1 << 4, 78 EF_MIDDLE_MOUSE_BUTTON = 1 << 5, 79 EF_RIGHT_MOUSE_BUTTON = 1 << 6, 80 EF_COMMAND_DOWN = 1 << 7, // Only useful on OSX 81 EF_EXTENDED = 1 << 8, // Windows extended key (see WM_KEYDOWN doc) 82 EF_IS_SYNTHESIZED = 1 << 9, 83 EF_ALTGR_DOWN = 1 << 10, 84 }; 85 86 // Flags specific to mouse events 87 enum MouseEventFlags { 88 EF_IS_DOUBLE_CLICK = 1 << 16, 89 EF_IS_TRIPLE_CLICK = 1 << 17, 90 EF_IS_NON_CLIENT = 1 << 18, 91 EF_FROM_TOUCH = 1 << 19, // Indicates this mouse event is generated 92 // from an unconsumed touch/gesture event. 93 }; 94 95 // Result of dispatching an event. 96 enum EventResult { 97 ER_UNHANDLED = 0, // The event hasn't been handled. The event can be 98 // propagated to other handlers. 99 ER_HANDLED = 1 << 0, // The event has already been handled, but it can 100 // still be propagated to other handlers. 101 ER_CONSUMED = 1 << 1, // The event has been handled, and it should not be 102 // propagated to other handlers. 103 }; 104 105 // Phase of the event dispatch. 106 enum EventPhase { 107 EP_PREDISPATCH, 108 EP_PRETARGET, 109 EP_TARGET, 110 EP_POSTTARGET, 111 EP_POSTDISPATCH 112 }; 113 114 } // namespace ui 115 116 #endif // UI_BASE_EVENTS_EVENT_CONSTANTS_H_ 117