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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_EVENT_MONITOR_H_
6 #define UI_VIEWS_EVENT_MONITOR_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views/views_export.h"
19 // RAII-style class that forwards events to |event_handler| before they are
21 class VIEWS_EXPORT EventMonitor
{
23 virtual ~EventMonitor() {}
25 // Create an instance for monitoring application events.
26 // Events will be forwarded to |event_handler| before they are dispatched to
28 static scoped_ptr
<EventMonitor
> CreateApplicationMonitor(
29 ui::EventHandler
* event_handler
);
31 // Create an instance for monitoring events on a specific window.
32 // Events will be forwarded to |event_handler| before they are dispatched to
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
);
39 // Returns the last mouse location seen in a mouse event in screen
41 static gfx::Point
GetLastMouseLocation();
46 #endif // UI_VIEWS_EVENT_MONITOR_H_