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_
10 // Event types. (prefixed because of a conflict with windows headers)
22 ET_MOUSE_CAPTURE_CHANGED
, // Event has no location.
28 ET_TRANSLATED_KEY_PRESS
,
29 ET_TRANSLATED_KEY_RELEASE
,
32 ET_GESTURE_SCROLL_BEGIN
,
33 ET_GESTURE_TYPE_START
= ET_GESTURE_SCROLL_BEGIN
,
34 ET_GESTURE_SCROLL_END
,
35 ET_GESTURE_SCROLL_UPDATE
,
38 ET_GESTURE_TAP_CANCEL
,
39 ET_GESTURE_TAP_UNCONFIRMED
, // User tapped, but the tap delay hasn't expired.
40 ET_GESTURE_DOUBLE_TAP
,
41 ET_GESTURE_BEGIN
, // The first event sent when each finger is pressed.
42 ET_GESTURE_END
, // Sent for each released finger.
43 ET_GESTURE_TWO_FINGER_TAP
,
44 ET_GESTURE_PINCH_BEGIN
,
46 ET_GESTURE_PINCH_UPDATE
,
47 ET_GESTURE_LONG_PRESS
,
49 // A SWIPE gesture can happen at the end of a touch sequence involving one or
50 // more fingers if the finger velocity was high enough when the first finger
53 ET_GESTURE_SHOW_PRESS
,
55 // Sent by Win8+ metro when the user swipes from the bottom or top.
56 ET_GESTURE_WIN8_EDGE_SWIPE
,
59 // TODO[davemoore] we need to unify these events w/ touch and gestures.
61 ET_SCROLL_FLING_START
,
62 ET_SCROLL_FLING_CANCEL
,
63 ET_GESTURE_TYPE_END
= ET_SCROLL_FLING_CANCEL
,
65 // Sent by the system to indicate any modal type operations, such as drag and
66 // drop or menus, should stop.
69 // Sent by the CrOS gesture library for interesting patterns that we want
70 // to track with the UMA system.
73 // Must always be last. User namespace starts above this value.
74 // See ui::RegisterCustomEventType().
78 // Event flags currently supported
80 EF_NONE
= 0, // Used to denote no flags explicitly
81 EF_CAPS_LOCK_DOWN
= 1 << 0,
82 EF_SHIFT_DOWN
= 1 << 1,
83 EF_CONTROL_DOWN
= 1 << 2,
85 EF_LEFT_MOUSE_BUTTON
= 1 << 4,
86 EF_MIDDLE_MOUSE_BUTTON
= 1 << 5,
87 EF_RIGHT_MOUSE_BUTTON
= 1 << 6,
88 EF_COMMAND_DOWN
= 1 << 7, // GUI Key (e.g. Command on OS X
89 // keyboards, Search on Chromebook
90 // keyboards, Windows on MS-oriented
92 EF_EXTENDED
= 1 << 8, // Windows extended key (see WM_KEYDOWN
94 EF_IS_SYNTHESIZED
= 1 << 9,
95 EF_ALTGR_DOWN
= 1 << 10,
96 EF_MOD3_DOWN
= 1 << 11,
97 EF_BACK_MOUSE_BUTTON
= 1 << 12,
98 EF_FORWARD_MOUSE_BUTTON
= 1 << 13,
101 // Flags specific to key events
103 EF_NUMPAD_KEY
= 1 << 16, // Key originates from number pad (Xkb only)
104 EF_IME_FABRICATED_KEY
= 1 << 17, // Key event fabricated by the underlying
105 // IME without a user action.
107 EF_IS_REPEAT
= 1 << 18,
108 EF_FUNCTION_KEY
= 1 << 19, // Key originates from function key row
109 EF_FINAL
= 1 << 20, // Do not remap; the event was created with
110 // the desired final values.
113 // Flags specific to mouse events
114 enum MouseEventFlags
{
115 EF_IS_DOUBLE_CLICK
= 1 << 16,
116 EF_IS_TRIPLE_CLICK
= 1 << 17,
117 EF_IS_NON_CLIENT
= 1 << 18,
118 EF_FROM_TOUCH
= 1 << 19, // Indicates this mouse event is generated
119 // from an unconsumed touch/gesture event.
120 EF_TOUCH_ACCESSIBILITY
= 1 << 20, // Indicates this event was generated from
121 // touch accessibility mode.
124 // Result of dispatching an event.
126 ER_UNHANDLED
= 0, // The event hasn't been handled. The event can be
127 // propagated to other handlers.
128 ER_HANDLED
= 1 << 0, // The event has already been handled, but it can
129 // still be propagated to other handlers.
130 ER_CONSUMED
= 1 << 1, // The event has been handled, and it should not be
131 // propagated to other handlers.
132 ER_DISABLE_SYNC_HANDLING
=
133 1 << 2, // The event shouldn't be handled synchronously. This
134 // happens if the event is being handled
135 // asynchronously, or if the event is invalid and
136 // shouldn't be handled at all.
139 // Phase of the event dispatch.
148 // Device ID for Touch and Key Events.
150 ED_UNKNOWN_DEVICE
= -1
155 #endif // UI_EVENTS_EVENT_CONSTANTS_H_