Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / events / event_constants.h
blob5aab3ff115c8a43b7dff49d4f3d75be17a68c9e2
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.
5 #ifndef UI_EVENTS_EVENT_CONSTANTS_H_
6 #define UI_EVENTS_EVENT_CONSTANTS_H_
8 namespace ui {
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_CANCELLED,
27 ET_DROP_TARGET_EVENT,
29 // GestureEvent types
30 ET_GESTURE_SCROLL_BEGIN,
31 ET_GESTURE_TYPE_START = ET_GESTURE_SCROLL_BEGIN,
32 ET_GESTURE_SCROLL_END,
33 ET_GESTURE_SCROLL_UPDATE,
34 ET_GESTURE_TAP,
35 ET_GESTURE_TAP_DOWN,
36 ET_GESTURE_TAP_CANCEL,
37 ET_GESTURE_TAP_UNCONFIRMED, // User tapped, but the tap delay hasn't expired.
38 ET_GESTURE_DOUBLE_TAP,
39 ET_GESTURE_BEGIN, // The first event sent when each finger is pressed.
40 ET_GESTURE_END, // Sent for each released finger.
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 touch sequence involving one or
48 // more fingers if the finger velocity was high enough when the first finger
49 // was released.
50 ET_GESTURE_SWIPE,
51 ET_GESTURE_SHOW_PRESS,
53 // Sent by Win8+ metro when the user swipes from the bottom or top.
54 ET_GESTURE_WIN8_EDGE_SWIPE,
56 // Scroll support.
57 // TODO[davemoore] we need to unify these events w/ touch and gestures.
58 ET_SCROLL,
59 ET_SCROLL_FLING_START,
60 ET_SCROLL_FLING_CANCEL,
61 ET_GESTURE_TYPE_END = ET_SCROLL_FLING_CANCEL,
63 // Sent by the system to indicate any modal type operations, such as drag and
64 // drop or menus, should stop.
65 ET_CANCEL_MODE,
67 // Sent by the CrOS gesture library for interesting patterns that we want
68 // to track with the UMA system.
69 ET_UMA_DATA,
71 // Must always be last. User namespace starts above this value.
72 // See ui::RegisterCustomEventType().
73 ET_LAST
76 // Event flags currently supported
77 enum EventFlags {
78 EF_NONE = 0, // Used to denote no flags explicitly
79 EF_CAPS_LOCK_DOWN = 1 << 0,
80 EF_SHIFT_DOWN = 1 << 1,
81 EF_CONTROL_DOWN = 1 << 2,
82 EF_ALT_DOWN = 1 << 3,
83 EF_LEFT_MOUSE_BUTTON = 1 << 4,
84 EF_MIDDLE_MOUSE_BUTTON = 1 << 5,
85 EF_RIGHT_MOUSE_BUTTON = 1 << 6,
86 EF_COMMAND_DOWN = 1 << 7, // GUI Key (e.g. Command on OS X
87 // keyboards, Search on Chromebook
88 // keyboards, Windows on MS-oriented
89 // keyboards)
90 EF_EXTENDED = 1 << 8, // Windows extended key (see WM_KEYDOWN
91 // doc)
92 EF_IS_SYNTHESIZED = 1 << 9,
93 EF_ALTGR_DOWN = 1 << 10,
94 EF_MOD3_DOWN = 1 << 11,
95 EF_BACK_MOUSE_BUTTON = 1 << 12,
96 EF_FORWARD_MOUSE_BUTTON = 1 << 13,
99 // Flags specific to key events
100 enum KeyEventFlags {
101 EF_IME_FABRICATED_KEY = 1 << 16, // Key event fabricated by the underlying
102 // IME without a user action.
103 // (Linux X11 only)
104 EF_IS_REPEAT = 1 << 17,
105 EF_FINAL = 1 << 18, // Do not remap; the event was created with
106 // the desired final values.
109 // Flags specific to mouse events
110 enum MouseEventFlags {
111 EF_IS_DOUBLE_CLICK = 1 << 16,
112 EF_IS_TRIPLE_CLICK = 1 << 17,
113 EF_IS_NON_CLIENT = 1 << 18,
114 EF_FROM_TOUCH = 1 << 19, // Indicates this mouse event is generated
115 // from an unconsumed touch/gesture event.
116 EF_TOUCH_ACCESSIBILITY = 1 << 20, // Indicates this event was generated from
117 // touch accessibility mode.
120 // Result of dispatching an event.
121 enum EventResult {
122 ER_UNHANDLED = 0, // The event hasn't been handled. The event can be
123 // propagated to other handlers.
124 ER_HANDLED = 1 << 0, // The event has already been handled, but it can
125 // still be propagated to other handlers.
126 ER_CONSUMED = 1 << 1, // The event has been handled, and it should not be
127 // propagated to other handlers.
128 ER_DISABLE_SYNC_HANDLING =
129 1 << 2, // The event shouldn't be handled synchronously. This
130 // happens if the event is being handled
131 // asynchronously, or if the event is invalid and
132 // shouldn't be handled at all.
135 // Phase of the event dispatch.
136 enum EventPhase {
137 EP_PREDISPATCH,
138 EP_PRETARGET,
139 EP_TARGET,
140 EP_POSTTARGET,
141 EP_POSTDISPATCH
144 // Device ID for Touch and Key Events.
145 enum EventDeviceId {
146 ED_UNKNOWN_DEVICE = -1
149 // Pointing device type.
150 enum class EventPointerType : int {
151 POINTER_TYPE_UNKNOWN = 0,
152 POINTER_TYPE_MOUSE,
153 POINTER_TYPE_PEN,
154 POINTER_TYPE_TOUCH,
157 } // namespace ui
159 #endif // UI_EVENTS_EVENT_CONSTANTS_H_