Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / events / event_constants.h
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_EVENTS_EVENT_CONSTANTS_H_
6 #define UI_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_CANCELLED,
27   ET_DROP_TARGET_EVENT,
28   ET_TRANSLATED_KEY_PRESS,
29   ET_TRANSLATED_KEY_RELEASE,
30
31   // GestureEvent types
32   ET_GESTURE_SCROLL_BEGIN,
33   ET_GESTURE_TYPE_START = 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_TAP_UNCONFIRMED, // User tapped, but the tap delay hasn't expired.
40   ET_GESTURE_DOUBLE_TAP,
41   ET_GESTURE_BEGIN,  // Sent before any other gesture types.
42   ET_GESTURE_END,    // Sent after any other gestures.
43   ET_GESTURE_TWO_FINGER_TAP,
44   ET_GESTURE_PINCH_BEGIN,
45   ET_GESTURE_PINCH_END,
46   ET_GESTURE_PINCH_UPDATE,
47   ET_GESTURE_LONG_PRESS,
48   ET_GESTURE_LONG_TAP,
49   // A SWIPE gesture can happen at the end of a TAP_UP gesture if the
50   // finger(s) were moving quickly before they are released.
51   ET_GESTURE_MULTIFINGER_SWIPE,
52   ET_GESTURE_SHOW_PRESS,
53
54   // Sent by Win8+ metro when the user swipes from the bottom or top.
55   ET_GESTURE_WIN8_EDGE_SWIPE,
56
57   // Scroll support.
58   // TODO[davemoore] we need to unify these events w/ touch and gestures.
59   ET_SCROLL,
60   ET_SCROLL_FLING_START,
61   ET_SCROLL_FLING_CANCEL,
62   ET_GESTURE_TYPE_END = ET_SCROLL_FLING_CANCEL,
63
64   // Sent by the system to indicate any modal type operations, such as drag and
65   // drop or menus, should stop.
66   ET_CANCEL_MODE,
67
68   // Sent by the CrOS gesture library for interesting patterns that we want
69   // to track with the UMA system.
70   ET_UMA_DATA,
71
72   // Must always be last. User namespace starts above this value.
73   // See ui::RegisterCustomEventType().
74   ET_LAST
75 };
76
77 // Event flags currently supported
78 enum EventFlags {
79   EF_NONE                = 0,       // Used to denote no flags explicitly
80   EF_CAPS_LOCK_DOWN      = 1 << 0,
81   EF_SHIFT_DOWN          = 1 << 1,
82   EF_CONTROL_DOWN        = 1 << 2,
83   EF_ALT_DOWN            = 1 << 3,
84   EF_LEFT_MOUSE_BUTTON   = 1 << 4,
85   EF_MIDDLE_MOUSE_BUTTON = 1 << 5,
86   EF_RIGHT_MOUSE_BUTTON  = 1 << 6,
87   EF_COMMAND_DOWN        = 1 << 7,  // GUI Key (e.g. Command on OS X keyboards,
88                                     // Search on Chromebook keyboards,
89                                     // Windows on MS-oriented keyboards)
90   EF_EXTENDED            = 1 << 8,  // Windows extended key (see WM_KEYDOWN doc)
91   EF_IS_SYNTHESIZED      = 1 << 9,
92   EF_ALTGR_DOWN          = 1 << 10,
93   EF_MOD3_DOWN           = 1 << 11,
94 };
95
96 // Flags specific to key events
97 enum KeyEventFlags {
98   EF_NUMPAD_KEY         = 1 << 16,  // Key originates from number pad (Xkb only)
99   EF_IME_FABRICATED_KEY = 1 << 17,  // Key event fabricated by the underlying
100                                     // IME without a user action.
101                                     // (Linux X11 only)
102 };
103
104 // Flags specific to mouse events
105 enum MouseEventFlags {
106   EF_IS_DOUBLE_CLICK    = 1 << 16,
107   EF_IS_TRIPLE_CLICK    = 1 << 17,
108   EF_IS_NON_CLIENT      = 1 << 18,
109   EF_FROM_TOUCH         = 1 << 19,  // Indicates this mouse event is generated
110                                     // from an unconsumed touch/gesture event.
111 };
112
113 // Result of dispatching an event.
114 enum EventResult {
115   ER_UNHANDLED = 0,       // The event hasn't been handled. The event can be
116                           // propagated to other handlers.
117   ER_HANDLED   = 1 << 0,  // The event has already been handled, but it can
118                           // still be propagated to other handlers.
119   ER_CONSUMED  = 1 << 1,  // The event has been handled, and it should not be
120                           // propagated to other handlers.
121 };
122
123 // Phase of the event dispatch.
124 enum EventPhase {
125   EP_PREDISPATCH,
126   EP_PRETARGET,
127   EP_TARGET,
128   EP_POSTTARGET,
129   EP_POSTDISPATCH
130 };
131
132 }  // namespace ui
133
134 #endif  // UI_EVENTS_EVENT_CONSTANTS_H_