OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_AURA_EVENT_FILTER_H_ | 5 #ifndef UI_AURA_EVENT_FILTER_H_ |
6 #define UI_AURA_EVENT_FILTER_H_ | 6 #define UI_AURA_EVENT_FILTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 | 13 |
14 class Window; | 14 class Window; |
15 class MouseEvent; | 15 class MouseEvent; |
16 | 16 |
17 // An object that filters events sent to an owner window, potentially performing | 17 // An object that filters events sent to an owner window, potentially performing |
18 // adjustments to the window's position, size and z-index. | 18 // adjustments to the window's position, size and z-index. |
19 class EventFilter { | 19 class EventFilter { |
20 public: | 20 public: |
21 explicit EventFilter(Window* owner); | 21 explicit EventFilter(Window* owner); |
22 virtual ~EventFilter(); | 22 virtual ~EventFilter(); |
23 | 23 |
24 // Try to handle |event| (before the owner's delegate gets a chance to). | 24 // Try to handle |event| (before the owner's delegate gets a chance to). |
25 // Returns true if the event was handled by the WindowManager and should not | 25 // Returns true if the event was handled by the WindowManager and should not |
26 // be forwarded to the owner's delegate. | 26 // be forwarded to the owner's delegate. |
| 27 // Default implementation for ET_MOUSE_PRESSED focuses the window. |
27 virtual bool OnMouseEvent(Window* target, MouseEvent* event); | 28 virtual bool OnMouseEvent(Window* target, MouseEvent* event); |
28 | 29 |
29 protected: | 30 protected: |
30 Window* owner() { return owner_; } | 31 Window* owner() { return owner_; } |
31 | 32 |
32 private: | 33 private: |
33 Window* owner_; | 34 Window* owner_; |
34 | 35 |
35 DISALLOW_COPY_AND_ASSIGN(EventFilter); | 36 DISALLOW_COPY_AND_ASSIGN(EventFilter); |
36 }; | 37 }; |
37 | 38 |
38 } // namespace aura | 39 } // namespace aura |
39 | 40 |
40 #endif // UI_AURA_EVENT_FILTER_H_ | 41 #endif // UI_AURA_EVENT_FILTER_H_ |
OLD | NEW |