OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EVENTS_EVENT_UTILS_H_ | 5 #ifndef UI_EVENTS_EVENT_UTILS_H_ |
6 #define UI_EVENTS_EVENT_UTILS_H_ | 6 #define UI_EVENTS_EVENT_UTILS_H_ |
7 | 7 |
8 #include "base/event_types.h" | 8 #include "base/event_types.h" |
| 9 #include "base/memory/scoped_ptr.h" |
9 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 11 #include "ui/events/keycodes/keyboard_codes.h" |
11 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/events/events_export.h" | 14 #include "ui/events/events_export.h" |
14 | 15 |
15 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
16 #include <windows.h> | 17 #include <windows.h> |
17 #endif | 18 #endif |
18 | 19 |
19 namespace gfx { | 20 namespace gfx { |
20 class Point; | 21 class Point; |
21 class Vector2d; | 22 class Vector2d; |
22 } | 23 } |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class TimeDelta; | 26 class TimeDelta; |
26 } | 27 } |
27 | 28 |
28 namespace ui { | 29 namespace ui { |
29 | 30 |
30 class Event; | 31 class Event; |
31 | 32 |
32 // Updates the list of devices for cached properties. | 33 // Updates the list of devices for cached properties. |
33 EVENTS_EXPORT void UpdateDeviceList(); | 34 EVENTS_EXPORT void UpdateDeviceList(); |
34 | 35 |
| 36 // Returns a ui::Event wrapping a native event. Ownership of the returned value |
| 37 // is transferred to the caller. |
| 38 EVENTS_EXPORT scoped_ptr<Event> EventFromNative( |
| 39 const base::NativeEvent& native_event); |
| 40 |
35 // Get the EventType from a native event. | 41 // Get the EventType from a native event. |
36 EVENTS_EXPORT EventType EventTypeFromNative( | 42 EVENTS_EXPORT EventType EventTypeFromNative( |
37 const base::NativeEvent& native_event); | 43 const base::NativeEvent& native_event); |
38 | 44 |
39 // Get the EventFlags from a native event. | 45 // Get the EventFlags from a native event. |
40 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); | 46 EVENTS_EXPORT int EventFlagsFromNative(const base::NativeEvent& native_event); |
41 | 47 |
42 // Get the timestamp from a native event. | 48 // Get the timestamp from a native event. |
43 EVENTS_EXPORT base::TimeDelta EventTimeFromNative( | 49 EVENTS_EXPORT base::TimeDelta EventTimeFromNative( |
44 const base::NativeEvent& native_event); | 50 const base::NativeEvent& native_event); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 EVENTS_EXPORT uint16 GetScanCodeFromLParam(LPARAM lParam); | 162 EVENTS_EXPORT uint16 GetScanCodeFromLParam(LPARAM lParam); |
157 EVENTS_EXPORT LPARAM GetLParamFromScanCode(uint16 scan_code); | 163 EVENTS_EXPORT LPARAM GetLParamFromScanCode(uint16 scan_code); |
158 #endif | 164 #endif |
159 | 165 |
160 // Registers a custom event type. | 166 // Registers a custom event type. |
161 EVENTS_EXPORT int RegisterCustomEventType(); | 167 EVENTS_EXPORT int RegisterCustomEventType(); |
162 | 168 |
163 } // namespace ui | 169 } // namespace ui |
164 | 170 |
165 #endif // UI_EVENTS_EVENT_UTILS_H_ | 171 #endif // UI_EVENTS_EVENT_UTILS_H_ |
OLD | NEW |