shelf_container_view.h 1.4 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_SHELF_SHELF_CONTAINER_VIEW_H_
  5. #define ASH_SHELF_SHELF_CONTAINER_VIEW_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/shelf/shelf_view.h"
  8. #include "ui/views/view.h"
  9. namespace ash {
  10. class ASH_EXPORT ShelfContainerView : public views::View {
  11. public:
  12. explicit ShelfContainerView(ShelfView* shelf_view);
  13. ShelfContainerView(const ShelfContainerView&) = delete;
  14. ShelfContainerView& operator=(const ShelfContainerView&) = delete;
  15. ~ShelfContainerView() override;
  16. void Initialize();
  17. // Calculates the ideal size of |shelf_view_| to accommodate all of app
  18. // buttons without scrolling.
  19. gfx::Size CalculateIdealSize(int button_size) const;
  20. // Translate |shelf_view_| by |offset|.
  21. // TODO(https://crbug.com/973481): now we implement ShelfView scrolling
  22. // through view translation, which is not as efficient as ScrollView. Redesign
  23. // this class with ScrollView.
  24. virtual void TranslateShelfView(const gfx::Vector2dF& offset);
  25. // views::View:
  26. gfx::Size CalculatePreferredSize() const override;
  27. void ChildPreferredSizeChanged(views::View* child) override;
  28. const char* GetClassName() const override;
  29. protected:
  30. // Owned by views hierarchy.
  31. ShelfView* shelf_view_ = nullptr;
  32. };
  33. } // namespace ash
  34. #endif // ASH_SHELF_SHELF_CONTAINER_VIEW_H_