accessibility_focus_ring_info.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2019 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 ASH_PUBLIC_CPP_ACCESSIBILITY_FOCUS_RING_INFO_H_
  5. #define ASH_PUBLIC_CPP_ACCESSIBILITY_FOCUS_RING_INFO_H_
  6. #include <vector>
  7. #include "ash/public/cpp/ash_public_export.h"
  8. #include "third_party/skia/include/core/SkColor.h"
  9. #include "ui/gfx/geometry/rect.h"
  10. namespace ash {
  11. // Whether the focus ring should persist or fade.
  12. enum class ASH_PUBLIC_EXPORT FocusRingBehavior { FADE_OUT, PERSIST };
  13. // The visual style of the focus ring.
  14. enum class ASH_PUBLIC_EXPORT FocusRingType { GLOW, SOLID, DASHED };
  15. // How focus rings are layered.
  16. enum class ASH_PUBLIC_EXPORT FocusRingStackingOrder {
  17. // Above most UI, including accessibility bubble panels.
  18. ABOVE_ACCESSIBILITY_BUBBLES,
  19. // Above most UI, except below accessibility bubble panels.
  20. BELOW_ACCESSIBILITY_BUBBLES
  21. };
  22. // Defines a specific focus ring by specifying:
  23. // - |rects_in_screen| the regions around which to draw the focus ring (in
  24. // screen coordinates).
  25. // - |focus_ring_behavior| whether it should persist or fade.
  26. // - |focus_ring_type| the visual style of the focus ring.
  27. // - |color| the color of the focus ring.
  28. // - |secondary_color| a secondary color, used by some visual styles.
  29. // - |background_color| The color to draw a background outside of the focus
  30. // ring and over the rest of the display. Set to fully transparent
  31. // for none.
  32. // TODO: This struct could possibly be merged with ash::AccessibilityFocusRing.
  33. struct ASH_PUBLIC_EXPORT AccessibilityFocusRingInfo {
  34. AccessibilityFocusRingInfo();
  35. AccessibilityFocusRingInfo(const AccessibilityFocusRingInfo&) = delete;
  36. AccessibilityFocusRingInfo& operator=(const AccessibilityFocusRingInfo&) =
  37. delete;
  38. ~AccessibilityFocusRingInfo();
  39. bool operator==(const AccessibilityFocusRingInfo& other) const;
  40. std::vector<gfx::Rect> rects_in_screen;
  41. FocusRingBehavior behavior = FocusRingBehavior::FADE_OUT;
  42. FocusRingType type = FocusRingType::GLOW;
  43. FocusRingStackingOrder stacking_order =
  44. FocusRingStackingOrder::ABOVE_ACCESSIBILITY_BUBBLES;
  45. SkColor color = SK_ColorTRANSPARENT;
  46. SkColor secondary_color = SK_ColorTRANSPARENT;
  47. SkColor background_color = SK_ColorTRANSPARENT;
  48. };
  49. } // namespace ash
  50. #endif // ASH_PUBLIC_CPP_ACCESSIBILITY_FOCUS_RING_INFO_H_