OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEWS_EVENT_MONITOR_H_ | 5 #ifndef UI_VIEWS_EVENT_MONITOR_H_ |
6 #define UI_VIEWS_EVENT_MONITOR_H_ | 6 #define UI_VIEWS_EVENT_MONITOR_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | |
8 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/native_widget_types.h" | |
9 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
10 | 12 |
11 namespace ui { | 13 namespace ui { |
12 class EventHandler; | 14 class EventHandler; |
13 } | 15 } |
14 | 16 |
15 namespace views { | 17 namespace views { |
16 | 18 |
17 // RAII-style class that forwards events posted to the application to | 19 // RAII-style class that forwards events posted to the application to |
sky
2014/12/11 00:49:43
nit: update description to reflect changes.
Andre
2014/12/11 18:09:12
Done.
| |
18 // |event_handler| before they are dispatched. | 20 // |event_handler| before they are dispatched. |
19 class VIEWS_EXPORT EventMonitor { | 21 class VIEWS_EXPORT EventMonitor { |
20 public: | 22 public: |
21 virtual ~EventMonitor() {} | 23 virtual ~EventMonitor() {} |
22 | 24 |
23 static EventMonitor* Create(ui::EventHandler* event_handler); | 25 // Create an instance for monitoring application events. |
26 // Events will be forwarded to |event_handler| before they are dispatched to | |
27 // the application. | |
28 static scoped_ptr<EventMonitor> CreateApplicationMonitor( | |
29 ui::EventHandler* event_handler); | |
30 | |
31 // Create an instance for monitoring events on a specific window. | |
32 // Events will be forwarded to |event_handler| before they are dispatched to | |
33 // |target_window|. | |
34 // The EventMonitor instance must be destroyed before |target_window|. | |
35 static scoped_ptr<EventMonitor> CreateWindowMonitor( | |
36 ui::EventHandler* event_handler, | |
37 gfx::NativeWindow target_window); | |
24 | 38 |
25 // Returns the last mouse location seen in a mouse event in screen | 39 // Returns the last mouse location seen in a mouse event in screen |
26 // coordinates. | 40 // coordinates. |
27 static gfx::Point GetLastMouseLocation(); | 41 static gfx::Point GetLastMouseLocation(); |
28 }; | 42 }; |
29 | 43 |
30 } // namespace views | 44 } // namespace views |
31 | 45 |
32 #endif // UI_VIEWS_EVENT_MONITOR_H_ | 46 #endif // UI_VIEWS_EVENT_MONITOR_H_ |
OLD | NEW |