shelf_control_button.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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_SHELF_SHELF_CONTROL_BUTTON_H_
  5. #define ASH_SHELF_SHELF_CONTROL_BUTTON_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/shelf/shelf_button.h"
  8. #include "ui/views/controls/button/button.h"
  9. namespace ash {
  10. class ShelfButtonDelegate;
  11. // Base class for controls shown on the shelf that are not app shortcuts, such
  12. // as the app list, back, and overflow buttons.
  13. class ASH_EXPORT ShelfControlButton : public ShelfButton {
  14. public:
  15. ShelfControlButton(Shelf* shelf, ShelfButtonDelegate* shelf_button_delegate_);
  16. ShelfControlButton(const ShelfControlButton&) = delete;
  17. ShelfControlButton& operator=(const ShelfControlButton&) = delete;
  18. ~ShelfControlButton() override;
  19. // Get the center point of the button used to draw its background and ink
  20. // drops.
  21. gfx::Point GetCenterPoint() const;
  22. const gfx::Rect& ideal_bounds() const { return ideal_bounds_; }
  23. void set_ideal_bounds(const gfx::Rect& bounds) { ideal_bounds_ = bounds; }
  24. // ShelfButton:
  25. const char* GetClassName() const override;
  26. gfx::Size CalculatePreferredSize() const override;
  27. void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
  28. protected:
  29. void PaintBackground(gfx::Canvas* canvas, const gfx::Rect& bounds);
  30. // ShelfButton:
  31. void PaintButtonContents(gfx::Canvas* canvas) override;
  32. private:
  33. gfx::Rect ideal_bounds_;
  34. };
  35. } // namespace ash
  36. #endif // ASH_SHELF_SHELF_CONTROL_BUTTON_H_