collapse_button.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2018 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_COLLAPSE_BUTTON_H_
  5. #define ASH_SYSTEM_UNIFIED_COLLAPSE_BUTTON_H_
  6. #include "ash/style/icon_button.h"
  7. #include "ui/base/metadata/metadata_header_macros.h"
  8. namespace ash {
  9. // The button with `kUnifiedMenuExpandIcon`. This button can be set as expanded
  10. // or collapsed through SetExpandedAmount and the icon will be rotated on the
  11. // `expanded_amount_`. Expanded is the default state.
  12. class CollapseButton : public IconButton {
  13. public:
  14. METADATA_HEADER(CollapseButton);
  15. explicit CollapseButton(PressedCallback callback);
  16. CollapseButton(const CollapseButton&) = delete;
  17. CollapseButton& operator=(const CollapseButton&) = delete;
  18. ~CollapseButton() override;
  19. // Change the expanded state. The icon will change.
  20. void SetExpandedAmount(double expanded_amount);
  21. // IconButton:
  22. void PaintButtonContents(gfx::Canvas* canvas) override;
  23. private:
  24. double expanded_amount_ = 1.0;
  25. };
  26. } // namespace ash
  27. #endif // ASH_SYSTEM_UNIFIED_COLLAPSE_BUTTON_H_