custom_shape_button.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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_SYSTEM_UNIFIED_CUSTOM_SHAPE_BUTTON_H_
  5. #define ASH_SYSTEM_UNIFIED_CUSTOM_SHAPE_BUTTON_H_
  6. #include "ui/base/metadata/metadata_header_macros.h"
  7. #include "ui/views/controls/button/image_button.h"
  8. namespace ash {
  9. // Abstract base class of buttons that have custom shape with Material Design
  10. // ink drop.
  11. class CustomShapeButton : public views::ImageButton {
  12. public:
  13. METADATA_HEADER(CustomShapeButton);
  14. explicit CustomShapeButton(PressedCallback callback);
  15. CustomShapeButton(const CustomShapeButton&) = delete;
  16. CustomShapeButton& operator=(const CustomShapeButton&) = delete;
  17. ~CustomShapeButton() override;
  18. // Return the custom shape for the button in SkPath.
  19. virtual SkPath CreateCustomShapePath(const gfx::Rect& bounds) const = 0;
  20. // views::ImageButton:
  21. void PaintButtonContents(gfx::Canvas* canvas) override;
  22. protected:
  23. void PaintCustomShapePath(gfx::Canvas* canvas);
  24. };
  25. } // namespace ash
  26. #endif // ASH_SYSTEM_UNIFIED_CUSTOM_SHAPE_BUTTON_H_