Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: ui/views/view_targeter.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/view_model_utils_unittest.cc ('k') | ui/views/view_targeter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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
5 #ifndef UI_VIEWS_VIEW_TARGETER_H_
6 #define UI_VIEWS_VIEW_TARGETER_H_
7
8 #include "ui/events/event_targeter.h"
9 #include "ui/views/views_export.h"
10
11 namespace views {
12
13 namespace internal {
14 class RootView;
15 } // namespace internal
16
17 class View;
18 class ViewTargeterDelegate;
19
20 // A ViewTargeter is installed on a View that wishes to use the custom
21 // hit-testing or event-targeting behaviour defined by |delegate|.
22 class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter {
23 public:
24 explicit ViewTargeter(ViewTargeterDelegate* delegate);
25 ~ViewTargeter() override;
26
27 // A call-through to DoesIntersectRect() on |delegate_|.
28 bool DoesIntersectRect(const View* target, const gfx::Rect& rect) const;
29
30 // A call-through to TargetForRect() on |delegate_|.
31 View* TargetForRect(View* root, const gfx::Rect& rect) const;
32
33 protected:
34 // ui::EventTargeter:
35 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root,
36 ui::Event* event) override;
37 ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target,
38 ui::Event* event) override;
39 bool SubtreeCanAcceptEvent(ui::EventTarget* target,
40 const ui::LocatedEvent& event) const override;
41 bool EventLocationInsideBounds(ui::EventTarget* target,
42 const ui::LocatedEvent& event) const override;
43
44 private:
45 // TODO(tdanderson): Un-friend RootView once RootView::DispatchGestureEvent()
46 // has been removed.
47 friend class internal::RootView;
48
49 View* FindTargetForKeyEvent(View* root, const ui::KeyEvent& key);
50 View* FindTargetForScrollEvent(View* root, const ui::ScrollEvent& scroll);
51
52 virtual View* FindTargetForGestureEvent(View* root,
53 const ui::GestureEvent& gesture);
54 virtual ui::EventTarget* FindNextBestTargetForGestureEvent(
55 ui::EventTarget* previous_target,
56 const ui::GestureEvent& gesture);
57
58 // ViewTargeter does not own the |delegate_|, but |delegate_| must
59 // outlive the targeter.
60 ViewTargeterDelegate* delegate_;
61
62 DISALLOW_COPY_AND_ASSIGN(ViewTargeter);
63 };
64
65 } // namespace views
66
67 #endif // UI_VIEWS_VIEW_TARGETER_H_
OLDNEW
« no previous file with comments | « ui/views/view_model_utils_unittest.cc ('k') | ui/views/view_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698