OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 |
| 5 #ifndef UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_ |
| 6 #define UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_ |
| 7 |
| 8 #include "ui/gfx/geometry/size.h" |
| 9 #include "ui/views/layout/layout_manager.h" |
| 10 #include "ui/views/views_export.h" |
| 11 |
| 12 namespace views { |
| 13 namespace test { |
| 14 |
| 15 // A stub layout manager that returns a specific preferred size and height for |
| 16 // width. |
| 17 class VIEWS_EXPORT TestLayoutManager : public LayoutManager { |
| 18 public: |
| 19 TestLayoutManager(); |
| 20 ~TestLayoutManager() override; |
| 21 |
| 22 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; } |
| 23 |
| 24 void set_preferred_height_for_width(int height) { |
| 25 preferred_height_for_width_ = height; |
| 26 } |
| 27 |
| 28 // LayoutManager: |
| 29 void Layout(View* host) override; |
| 30 gfx::Size GetPreferredSize(const View* host) const override; |
| 31 int GetPreferredHeightForWidth(const View* host, int width) const override; |
| 32 |
| 33 private: |
| 34 // The return value of GetPreferredSize(); |
| 35 gfx::Size preferred_size_ = gfx::Size(0, 0); |
| 36 |
| 37 // The return value for GetPreferredHeightForWidth(). |
| 38 int preferred_height_for_width_ = 0; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(TestLayoutManager); |
| 41 }; |
| 42 |
| 43 } // namespace test |
| 44 } // namespace views |
| 45 |
| 46 #endif // UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_ |
OLD | NEW |