OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_VIEWS_MASKED_VIEW_TARGETER_H_ | 5 #ifndef UI_VIEWS_MASKED_VIEW_TARGETER_H_ |
6 #define UI_VIEWS_MASKED_VIEW_TARGETER_H_ | 6 #define UI_VIEWS_MASKED_VIEW_TARGETER_H_ |
7 | 7 |
8 #include "ui/views/view_targeter.h" | 8 #include "ui/views/view_targeter.h" |
9 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 class Path; | 12 class Path; |
13 } | 13 } |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 | 16 |
17 // Derived classes of MaskedViewTargeter are used to define custom-shaped | 17 // Derived classes of MaskedViewTargeter are used to define custom-shaped |
18 // hit test regions for a View used in event targeting. | 18 // hit test regions for a View used in event targeting. |
19 // TODO(tdanderson|sadrul): Some refactoring opportunities may be possible | 19 // TODO(tdanderson|sadrul): Some refactoring opportunities may be possible |
20 // between this class and MaskedWindowTargeter. | 20 // between this class and MaskedWindowTargeter. |
21 class VIEWS_EXPORT MaskedViewTargeter : public ViewTargeter { | 21 class VIEWS_EXPORT MaskedViewTargeter : public ViewTargeter { |
22 public: | 22 public: |
23 explicit MaskedViewTargeter(View* masked_view); | 23 explicit MaskedViewTargeter(View* masked_view); |
24 virtual ~MaskedViewTargeter(); | 24 virtual ~MaskedViewTargeter(); |
25 | 25 |
26 protected: | |
27 // Sets the hit-test mask for |view| in |mask| (in |view|'s local | 26 // Sets the hit-test mask for |view| in |mask| (in |view|'s local |
28 // coordinate system). Returns whether a valid mask has been set in |mask|. | 27 // coordinate system). Returns whether a valid mask has been set in |mask|. |
29 virtual bool GetHitTestMask(View* view, gfx::Path* mask) const = 0; | 28 virtual bool GetHitTestMask(const View* view, gfx::Path* mask) const = 0; |
30 | 29 |
| 30 protected: |
31 // ui::EventTargeter: | 31 // ui::EventTargeter: |
32 virtual bool EventLocationInsideBounds( | 32 virtual bool EventLocationInsideBounds( |
33 ui::EventTarget* target, | 33 ui::EventTarget* target, |
34 const ui::LocatedEvent& event) const OVERRIDE; | 34 const ui::LocatedEvent& event) const OVERRIDE; |
35 | 35 |
36 private: | 36 private: |
37 View* masked_view_; | 37 View* masked_view_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(MaskedViewTargeter); | 39 DISALLOW_COPY_AND_ASSIGN(MaskedViewTargeter); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace views | 42 } // namespace views |
43 | 43 |
44 #endif // UI_VIEWS_MASKED_VIEW_TARGETER_H_ | 44 #endif // UI_VIEWS_MASKED_VIEW_TARGETER_H_ |
OLD | NEW |