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/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/aura/aura_export.h" | 10 #include "ui/aura/aura_export.h" |
11 #include "ui/base/events.h" | 11 #include "ui/base/events.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 | 14 |
15 class KeyEvent; | 15 class KeyEvent; |
16 class MouseEvent; | 16 class MouseEvent; |
17 class TouchEvent; | 17 class TouchEvent; |
| 18 class TranslatedKeyEvent; |
18 class Window; | 19 class Window; |
19 | 20 |
20 // An object that filters events sent to an owner window. The filter can stop | 21 // An object that filters events sent to an owner window. The filter can stop |
21 // further processing of events. | 22 // further processing of events. |
22 // | 23 // |
23 // When the Desktop receives an event, it determines the "target window" for | 24 // When the Desktop receives an event, it determines the "target window" for |
24 // the event, this is typically the visible window whose bounds most tightly | 25 // the event, this is typically the visible window whose bounds most tightly |
25 // enclose the event coordinates, in the case of mouse events, or the focused | 26 // enclose the event coordinates, in the case of mouse events, or the focused |
26 // window, in the case of key events. | 27 // window, in the case of key events. |
27 // | 28 // |
(...skipping 10 matching lines...) Expand all Loading... |
38 // window the event was targeted at. If |event| is a LocatedEvent, its | 39 // window the event was targeted at. If |event| is a LocatedEvent, its |
39 // coordinates are relative to |target|. | 40 // coordinates are relative to |target|. |
40 | 41 |
41 // For all PreHandle*() functions that return a bool, return true if the | 42 // For all PreHandle*() functions that return a bool, return true if the |
42 // filter consumes the event and further processing (by the target, for | 43 // filter consumes the event and further processing (by the target, for |
43 // example) is not performed. Return false if the filter does not consume the | 44 // example) is not performed. Return false if the filter does not consume the |
44 // event and further processing is performed. Note that in this case the | 45 // event and further processing is performed. Note that in this case the |
45 // filter may still perform some action, the return value simply indicates | 46 // filter may still perform some action, the return value simply indicates |
46 // that further processing can occur. | 47 // that further processing can occur. |
47 | 48 |
| 49 // All filters except the one bound to a system IME (input method) should NOT |
| 50 // consume a KeyEvent. Instead, they should handle a TranslatedKeyEvent. |
48 virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) = 0; | 51 virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) = 0; |
| 52 virtual bool PreHandleTranslatedKeyEvent(Window* target, |
| 53 TranslatedKeyEvent* event) = 0; |
| 54 |
49 virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) = 0; | 55 virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) = 0; |
50 | 56 |
51 // Returns a value other than ui::TOUCH_STATUS_UNKNOWN if the event is | 57 // Returns a value other than ui::TOUCH_STATUS_UNKNOWN if the event is |
52 // consumed. | 58 // consumed. |
53 virtual ui::TouchStatus PreHandleTouchEvent(Window* target, | 59 virtual ui::TouchStatus PreHandleTouchEvent(Window* target, |
54 TouchEvent* event) = 0; | 60 TouchEvent* event) = 0; |
55 | 61 |
56 protected: | 62 protected: |
57 Window* owner() { return owner_; } | 63 Window* owner() { return owner_; } |
58 | 64 |
59 private: | 65 private: |
60 Window* owner_; | 66 Window* owner_; |
61 | 67 |
62 DISALLOW_COPY_AND_ASSIGN(EventFilter); | 68 DISALLOW_COPY_AND_ASSIGN(EventFilter); |
63 }; | 69 }; |
64 | 70 |
65 } // namespace aura | 71 } // namespace aura |
66 | 72 |
67 #endif // UI_AURA_EVENT_FILTER_H_ | 73 #endif // UI_AURA_EVENT_FILTER_H_ |
OLD | NEW |