wm_highlight_item_border.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_WM_WM_HIGHLIGHT_ITEM_BORDER_H_
  5. #define ASH_WM_WM_HIGHLIGHT_ITEM_BORDER_H_
  6. #include "third_party/skia/include/core/SkColor.h"
  7. #include "ui/views/border.h"
  8. namespace ash {
  9. // Defines a border to be used on the views of window management items which can
  10. // be highlighted in overview or window cycle, such as the DeskPreviewView,
  11. // NewDeskButton and WindowMiniView. This paints a border around the view with
  12. // an empty gap (padding) in-between, so that the border is more obvious against
  13. // white or light backgrounds. If a |SK_ColorTRANSPARENT| was provided, it will
  14. // paint nothing.
  15. class WmHighlightItemBorder : public views::Border {
  16. public:
  17. explicit WmHighlightItemBorder(
  18. int corner_radius,
  19. gfx::Insets padding = gfx::Insets(0));
  20. WmHighlightItemBorder(const WmHighlightItemBorder&) = delete;
  21. WmHighlightItemBorder& operator=(const WmHighlightItemBorder&) = delete;
  22. ~WmHighlightItemBorder() override = default;
  23. // This highlight meant to indicate focus. No border will be painted if
  24. // |focused| is false. Returns true if the |color_| is changed.
  25. bool SetFocused(bool focused);
  26. // views::Border:
  27. void Paint(const views::View& view, gfx::Canvas* canvas) override;
  28. gfx::Insets GetInsets() const override;
  29. gfx::Size GetMinimumSize() const override;
  30. private:
  31. const int corner_radius_;
  32. gfx::Insets border_insets_;
  33. };
  34. } // namespace ash
  35. #endif // ASH_WM_WM_HIGHLIGHT_ITEM_BORDER_H_