Chromium Code Reviews| 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 "base/macros.h" | |
| 8 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
| 9 #include "ui/events/event_targeter.h" | 10 #include "ui/events/event_targeter.h" |
| 10 | 11 |
| 12 namespace ui { | |
| 13 | |
|
tdanderson
2015/05/22 18:29:56
nit: remove newlines
varkha
2015/05/22 22:18:34
Done.
| |
| 14 class KeyEvent; | |
| 15 class LocatedEvent; | |
| 16 | |
| 17 } // namespace ui | |
| 18 | |
| 11 namespace aura { | 19 namespace aura { |
| 12 | 20 |
| 13 class Window; | 21 class Window; |
| 14 | 22 |
| 15 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { | 23 class AURA_EXPORT WindowTargeter : public ui::EventTargeter { |
| 16 public: | 24 public: |
| 17 WindowTargeter(); | 25 WindowTargeter(); |
| 18 ~WindowTargeter() override; | 26 ~WindowTargeter() override; |
| 19 | 27 |
| 28 // Returns true if |target| or one of its descendants can be a target of | |
|
tdanderson
2015/05/22 18:29:56
nit: update |target| to |window| in docs (many pla
varkha
2015/05/22 22:18:34
Done.
| |
| 29 // |event|. This requires that |target| and its descendants are not | |
| 30 // prohibited from accepting the event, and that the event is within an | |
| 31 // actionable region of the target's bounds. Note that the location etc. of | |
| 32 // |event| is in |target|'s parent's coordinate system. | |
| 33 virtual bool SubtreeShouldBeExploredForEvent(Window* window, | |
| 34 const ui::LocatedEvent& event); | |
| 35 | |
| 20 protected: | 36 protected: |
| 37 // Same as FindTargetForEvent(), but used for positional events. The location | |
| 38 // etc. of |event| are in |root|'s coordinate system. When finding the target | |
| 39 // for the event, the targeter can mutate the |event| (e.g. change the | |
| 40 // coordinate to be in the returned target's coordinate system) so that it can | |
| 41 // be dispatched to the target without any further modification. | |
| 42 virtual Window* FindTargetForLocatedEvent(Window* window, | |
| 43 ui::LocatedEvent* event); | |
| 44 | |
| 45 // Returns false if neither |target| nor any of its descendants are allowed | |
| 46 // to accept |event| for reasons unrelated to the event's location or the | |
| 47 // target's bounds. For example, overrides of this function may consider | |
| 48 // attributes such as the visibility or enabledness of |target|. Note that | |
| 49 // the location etc. of |event| is in |target|'s parent's coordinate system. | |
| 50 virtual bool SubtreeCanAcceptEvent(Window* window, | |
| 51 const ui::LocatedEvent& event) const; | |
| 52 | |
| 53 // Returns whether the location of the event is in an actionable region of the | |
| 54 // target. Note that the location etc. of |event| is in the |target|'s | |
| 55 // parent's coordinate system. | |
| 56 virtual bool EventLocationInsideBounds(Window* target, | |
| 57 const ui::LocatedEvent& event) const; | |
| 58 | |
| 21 // ui::EventTargeter: | 59 // ui::EventTargeter: |
| 22 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 60 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| 23 ui::Event* event) override; | 61 ui::Event* event) override; |
| 24 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, | 62 ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, |
| 25 ui::LocatedEvent* event) override; | 63 ui::Event* 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 | 64 |
| 31 private: | 65 private: |
| 32 Window* FindTargetForKeyEvent(Window* root_window, | 66 Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event); |
| 33 const ui::KeyEvent& event); | 67 Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event); |
| 34 Window* FindTargetInRootWindow(Window* root_window, | 68 Window* FindTargetInRootWindow(Window* root_window, |
| 35 const ui::LocatedEvent& event); | 69 const ui::LocatedEvent& event); |
| 70 Window* FindTargetForLocatedEventRecursively(Window* root_window, | |
| 71 ui::LocatedEvent* event); | |
| 36 | 72 |
| 37 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); | 73 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); |
| 38 }; | 74 }; |
| 39 | 75 |
| 40 } // namespace aura | 76 } // namespace aura |
| 41 | 77 |
| 42 #endif // UI_AURA_WINDOW_TARGETER_H_ | 78 #endif // UI_AURA_WINDOW_TARGETER_H_ |
| OLD | NEW |