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

Unified Diff: ui/views/masked_view_targeter.h

Issue 286933014: Introduce the MaskedViewTargeter class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: quick nit Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/masked_view_targeter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/masked_view_targeter.h
diff --git a/ui/views/masked_view_targeter.h b/ui/views/masked_view_targeter.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a70c9e5b6a057814d61e6d4a9bde217583663ed
--- /dev/null
+++ b/ui/views/masked_view_targeter.h
@@ -0,0 +1,44 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_MASKED_VIEW_TARGETER_H_
+#define UI_VIEWS_MASKED_VIEW_TARGETER_H_
+
+#include "ui/views/view_targeter.h"
+#include "ui/views/views_export.h"
+
+namespace gfx {
+class Path;
+}
+
+namespace views {
+
+// Derived classes of MaskedViewTargeter are used to define custom-shaped
+// hit test regions for a View used in event targeting.
+// TODO(tdanderson|sadrul): Some refactoring opportunities may be possible
+// between this class and MaskedWindowTargeter.
+class VIEWS_EXPORT MaskedViewTargeter : public ViewTargeter {
+ public:
+ explicit MaskedViewTargeter(View* masked_view);
+ virtual ~MaskedViewTargeter();
+
+ protected:
+ // Sets the hit-test mask for |view| in |mask| (in |view|'s local
+ // coordinate system). Returns whether a valid mask has been set in |mask|.
+ virtual bool GetHitTestMask(View* view, gfx::Path* mask) const = 0;
+
+ // ui::EventTargeter:
+ virtual bool EventLocationInsideBounds(
+ ui::EventTarget* target,
+ const ui::LocatedEvent& event) const OVERRIDE;
+
+ private:
+ View* masked_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(MaskedViewTargeter);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_MASKED_VIEW_TARGETER_H_
« no previous file with comments | « no previous file | ui/views/masked_view_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698