masked_targeter_delegate.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifndef UI_VIEWS_MASKED_TARGETER_DELEGATE_H_
  5. #define UI_VIEWS_MASKED_TARGETER_DELEGATE_H_
  6. #include "ui/base/ui_base_types.h"
  7. #include "ui/views/view_targeter_delegate.h"
  8. #include "ui/views/views_export.h"
  9. class SkPath;
  10. namespace gfx {
  11. class Rect;
  12. }
  13. namespace views {
  14. class View;
  15. // Defines the default behaviour for hit-testing a rectangular region against
  16. // the bounds of a View having a custom-shaped hit test mask. Views define
  17. // such a mask by extending this class.
  18. class VIEWS_EXPORT MaskedTargeterDelegate : public ViewTargeterDelegate {
  19. public:
  20. MaskedTargeterDelegate() = default;
  21. MaskedTargeterDelegate(const MaskedTargeterDelegate&) = delete;
  22. MaskedTargeterDelegate& operator=(const MaskedTargeterDelegate&) = delete;
  23. ~MaskedTargeterDelegate() override = default;
  24. // Sets the hit-test mask for the view which implements this interface,
  25. // in that view's local coordinate space. Returns whether a valid mask
  26. // has been set in |mask|.
  27. virtual bool GetHitTestMask(SkPath* mask) const = 0;
  28. // ViewTargeterDelegate:
  29. bool DoesIntersectRect(const View* target,
  30. const gfx::Rect& rect) const override;
  31. };
  32. } // namespace views
  33. #endif // UI_VIEWS_MASKED_TARGETER_DELEGATE_H_