Add ICU message format support
[chromium-blink-merge.git] / ui / views / view_targeter_delegate.h
blob0ad461abac416df1596698ac093aec382c568492
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.
5 #ifndef UI_VIEWS_VIEW_TARGETER_DELEGATE_H_
6 #define UI_VIEWS_VIEW_TARGETER_DELEGATE_H_
8 #include "base/macros.h"
9 #include "ui/views/views_export.h"
11 namespace gfx {
12 class Rect;
15 namespace views {
16 class View;
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() {}
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;
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);
44 private:
45 DISALLOW_COPY_AND_ASSIGN(ViewTargeterDelegate);
48 } // namespace views
50 #endif // UI_VIEWS_VIEW_TARGETER_DELEGATE_H_