event_targeter.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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
  3. // found in the LICENSE file.
  4. #ifndef UI_EVENTS_EVENT_TARGETER_H_
  5. #define UI_EVENTS_EVENT_TARGETER_H_
  6. #include "ui/events/events_export.h"
  7. namespace ui {
  8. class Event;
  9. class EventTarget;
  10. class EVENTS_EXPORT EventTargeter {
  11. public:
  12. virtual ~EventTargeter() {}
  13. // Returns the target |event| should be dispatched to. If there is no such
  14. // target, return NULL. If |event| is a located event, the location of |event|
  15. // is in the coordinate space of |root|. Furthermore, the targeter can mutate
  16. // the event (e.g., by changing the location of the event to be in the
  17. // returned target's coordinate space) so that it can be dispatched to the
  18. // target without any further modification.
  19. virtual EventTarget* FindTargetForEvent(EventTarget* root, Event* event) = 0;
  20. // Returns the next best target for |event| as compared to |previous_target|.
  21. // |event| is in the local coordinate space of |previous_target|.
  22. // Also mutates |event| so that it can be dispatched to the returned target
  23. // (e.g., by changing |event|'s location to be in the returned target's
  24. // coordinate space).
  25. virtual EventTarget* FindNextBestTarget(EventTarget* previous_target,
  26. Event* event) = 0;
  27. };
  28. } // namespace ui
  29. #endif // UI_EVENTS_EVENT_TARGETER_H_