rect_based_targeting_utils.h 975 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2013 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_RECT_BASED_TARGETING_UTILS_H_
  5. #define UI_VIEWS_RECT_BASED_TARGETING_UTILS_H_
  6. #include "ui/views/views_export.h"
  7. namespace gfx {
  8. class Point;
  9. class Rect;
  10. } // namespace gfx
  11. namespace views {
  12. // Returns true if |rect| is 1x1.
  13. VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect);
  14. // Returns the percentage of |rect_1|'s area that is covered by |rect_2|.
  15. VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1,
  16. const gfx::Rect& rect_2);
  17. // Returns the square of the distance from |point| to the center of |rect|.
  18. VIEWS_EXPORT int DistanceSquaredFromCenterToPoint(const gfx::Point& point,
  19. const gfx::Rect& rect);
  20. } // namespace views
  21. #endif // UI_VIEWS_RECT_BASED_TARGETING_UTILS_H_