| 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 protected: | 20 protected: |
| 21 // Same as FindTargetForEvent(), but used for positional events. The location |
| 22 // etc. of |event| are in |root|'s coordinate system. When finding the target |
| 23 // for the event, the targeter can mutate the |event| (e.g. change the |
| 24 // coordinate to be in the returned target's coordinate system) so that it can |
| 25 // be dispatched to the target without any further modification. |
| 26 virtual ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, |
| 27 ui::LocatedEvent* event); |
| 28 |
| 29 // Returns false if neither |target| nor any of its descendants are allowed |
| 30 // to accept |event| for reasons unrelated to the event's location or the |
| 31 // target's bounds. For example, overrides of this function may consider |
| 32 // attributes such as the visibility or enabledness of |target|. Note that |
| 33 // the location etc. of |event| is in |target|'s parent's coordinate system. |
| 34 virtual bool SubtreeCanAcceptEvent(ui::EventTarget* target, |
| 35 const ui::LocatedEvent& event) const; |
| 36 |
| 37 // Returns whether the location of the event is in an actionable region of the |
| 38 // target. Note that the location etc. of |event| is in the |target|'s |
| 39 // parent's coordinate system. |
| 40 virtual bool EventLocationInsideBounds(ui::EventTarget* target, |
| 41 const ui::LocatedEvent& event) const; |
| 42 |
| 21 // ui::EventTargeter: | 43 // ui::EventTargeter: |
| 22 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 44 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| 23 ui::Event* event) override; | 45 ui::Event* event) override; |
| 24 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, | 46 |
| 25 ui::LocatedEvent* event) override; | 47 bool SubtreeShouldBeExploredForEvent(ui::EventTarget* target, |
| 26 bool SubtreeCanAcceptEvent(ui::EventTarget* target, | 48 const ui::LocatedEvent& event) override; |
| 27 const ui::LocatedEvent& event) const override; | |
| 28 bool EventLocationInsideBounds(ui::EventTarget* target, | |
| 29 const ui::LocatedEvent& event) const override; | |
| 30 | 49 |
| 31 private: | 50 private: |
| 32 Window* FindTargetForKeyEvent(Window* root_window, | 51 Window* FindTargetForKeyEvent(Window* root_window, const ui::KeyEvent& event); |
| 33 const ui::KeyEvent& event); | 52 Window* FindTargetForNonKeyEvent(Window* root_window, ui::Event* event); |
| 34 Window* FindTargetInRootWindow(Window* root_window, | 53 Window* FindTargetInRootWindow(Window* root_window, |
| 35 const ui::LocatedEvent& event); | 54 const ui::LocatedEvent& event); |
| 36 | 55 |
| 37 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); | 56 DISALLOW_COPY_AND_ASSIGN(WindowTargeter); |
| 38 }; | 57 }; |
| 39 | 58 |
| 40 } // namespace aura | 59 } // namespace aura |
| 41 | 60 |
| 42 #endif // UI_AURA_WINDOW_TARGETER_H_ | 61 #endif // UI_AURA_WINDOW_TARGETER_H_ |
| OLD | NEW |