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

Side by Side Diff: ui/views/view_targeter_delegate.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_targeter.cc ('k') | ui/views/view_targeter_delegate.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_DELEGATE_H_
6 #define UI_VIEWS_VIEW_TARGETER_DELEGATE_H_
7
8 #include "base/macros.h"
9 #include "ui/views/views_export.h"
10
11 namespace gfx {
12 class Rect;
13 }
14
15 namespace views {
16 class View;
17
18 // Defines the default behaviour for hit-testing and event-targeting against a
19 // View using a rectangular region representing an event's location. Views
20 // wishing to define custom hit-testing or event-targeting behaviour do so by
21 // extending ViewTargeterDelegate and then installing a ViewTargeter on
22 // themselves.
23 class VIEWS_EXPORT ViewTargeterDelegate {
24 public:
25 ViewTargeterDelegate() {}
26 virtual ~ViewTargeterDelegate() {}
27
28 // Returns true if the bounds of |target| intersects |rect|, where |rect|
29 // is in the local coodinate space of |target|. Overrides of this method by
30 // a View subclass should enforce DCHECK_EQ(this, target).
31 virtual bool DoesIntersectRect(const View* target,
32 const gfx::Rect& rect) const;
33
34 // If point-based targeting should be used, return the deepest visible
35 // descendant of |root| that contains the center point of |rect|.
36 // If rect-based targeting (i.e., fuzzing) should be used, return the
37 // closest visible descendant of |root| having at least kRectTargetOverlap of
38 // its area covered by |rect|. If no such descendant exists, return the
39 // deepest visible descendant of |root| that contains the center point of
40 // |rect|. See http://goo.gl/3Jp2BD for more information about rect-based
41 // targeting.
42 virtual View* TargetForRect(View* root, const gfx::Rect& rect);
43
44 private:
45 DISALLOW_COPY_AND_ASSIGN(ViewTargeterDelegate);
46 };
47
48 } // namespace views
49
50 #endif // UI_VIEWS_VIEW_TARGETER_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/views/view_targeter.cc ('k') | ui/views/view_targeter_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698