OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WINDOW_TARGETER_H_ | 5 #ifndef UI_AURA_WINDOW_TARGETER_H_ |
6 #define UI_AURA_WINDOW_TARGETER_H_ | 6 #define UI_AURA_WINDOW_TARGETER_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 #include "ui/events/event_targeter.h" | 9 #include "ui/events/event_targeter.h" |
10 | 10 |
11 namespace aura { | 11 namespace aura { |
12 | 12 |
13 class Window; | 13 class Window; |
14 | 14 |
15 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { | 15 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { |
16 public: | 16 public: |
17 WindowTargeter(); | 17 WindowTargeter(); |
18 ~WindowTargeter() override; | 18 ~WindowTargeter() override; |
19 | 19 |
20 // Returns true if |target| or one of its descendants can be a target of | |
21 // |event|. This requires that |target| and its descendants are not | |
22 // prohibited from accepting the event, and that the event is within an | |
23 // actionable region of the target's bounds. Note that the location etc. of | |
24 // |event| is in |target|'s parent's coordinate system. | |
25 virtual bool SubtreeShouldBeExploredForEvent(ui::EventTarget* target, | |
26 const ui::LocatedEvent& event); | |
27 | |
20 protected: | 28 protected: |
29 // Same as FindTargetForEvent(), but used for positional events. The location | |
30 // etc. of |event| are in |root|'s coordinate system. When finding the target | |
31 // for the event, the targeter can mutate the |event| (e.g. change the | |
32 // coordinate to be in the returned target's coordinate system) so that it can | |
33 // be dispatched to the target without any further modification. | |
34 virtual ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, | |
tdanderson
2015/05/13 18:38:25
Since these four methods are being removed from th
varkha
2015/05/21 19:11:04
Done. Seems like there are fewer casts than before
| |
35 ui::LocatedEvent* event); | |
36 | |
37 // Returns false if neither |target| nor any of its descendants are allowed | |
38 // to accept |event| for reasons unrelated to the event's location or the | |
39 // target's bounds. For example, overrides of this function may consider | |
40 // attributes such as the visibility or enabledness of |target|. Note that | |
41 // the location etc. of |event| is in |target|'s parent's coordinate system. | |
42 virtual bool SubtreeCanAcceptEvent(ui::EventTarget* target, | |
43 const ui::LocatedEvent& event) const; | |
44 | |
45 // Returns whether the location of the event is in an actionable region of the | |
46 // target. Note that the location etc. of |event| is in the |target|'s | |
47 // parent's coordinate system. | |
48 virtual bool EventLocationInsideBounds(ui::EventTarget* target, | |
49 const ui::LocatedEvent& event) const; | |
50 | |
21 // ui::EventTargeter: | 51 // ui::EventTargeter: |
22 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 52 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
23 ui::Event* event) override; | 53 ui::Event* event) override; |
24 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, | |
25 ui::LocatedEvent* event) override; | |
26 bool SubtreeCanAcceptEvent(ui::EventTarget* target, | |
27 const ui::LocatedEvent& event) const override; | |
28 bool EventLocationInsideBounds(ui::EventTarget* target, | |
29 const ui::LocatedEvent& event) const override; | |
30 | |
31 private: | 54 private: |
32 Window* FindTargetForKeyEvent(Window* root_window, | 55 Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event); |
33 const ui::KeyEvent& event); | 56 Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event); |
34 Window* FindTargetInRootWindow(Window* root_window, | 57 Window* FindTargetInRootWindow(Window* root_window, |
35 const ui::LocatedEvent& event); | 58 const ui::LocatedEvent& event); |
59 ui::EventTarget* FindTargetForEventRecursively(Window* root_window, | |
tdanderson
2015/05/13 18:38:25
nit: FindTargetForLocatedEventRecursively?
varkha
2015/05/21 19:11:04
Done.
| |
60 ui::LocatedEvent* event); | |
36 | 61 |
37 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); | 62 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); |
38 }; | 63 }; |
39 | 64 |
40 } // namespace aura | 65 } // namespace aura |
41 | 66 |
42 #endif // UI_AURA_WINDOW_TARGETER_H_ | 67 #endif // UI_AURA_WINDOW_TARGETER_H_ |
OLD | NEW |