OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ |
6 #define ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ | 6 #define ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // container->AddChildView(label); | 38 // container->AddChildView(label); |
39 // SizeRangeLayout* layout = new SizeRangeLayout(); | 39 // SizeRangeLayout* layout = new SizeRangeLayout(); |
40 // layout->SetSize(gfx::Size(50, 50)); | 40 // layout->SetSize(gfx::Size(50, 50)); |
41 // container->SetLayoutManager(layout); | 41 // container->SetLayoutManager(layout); |
42 // | 42 // |
43 class ASH_EXPORT SizeRangeLayout : public views::LayoutManager { | 43 class ASH_EXPORT SizeRangeLayout : public views::LayoutManager { |
44 public: | 44 public: |
45 // Create a layout with no minimum or maximum preferred size. | 45 // Create a layout with no minimum or maximum preferred size. |
46 SizeRangeLayout(); | 46 SizeRangeLayout(); |
47 | 47 |
| 48 // Create a layout using the given size set as the minimum and maximum sizes. |
| 49 SizeRangeLayout(const gfx::Size& size); |
| 50 |
48 // Create a layout with the given minimum and maximum preferred sizes. If | 51 // Create a layout with the given minimum and maximum preferred sizes. If |
49 // |max_size| is smaller than |min_size| then |min_size| will be set to the | 52 // |max_size| is smaller than |min_size| then |min_size| will be set to the |
50 // smaller |max_size| value. | 53 // smaller |max_size| value. |
51 SizeRangeLayout(const gfx::Size& min_size, const gfx::Size& max_size); | 54 SizeRangeLayout(const gfx::Size& min_size, const gfx::Size& max_size); |
52 | 55 |
53 ~SizeRangeLayout() override; | 56 ~SizeRangeLayout() override; |
54 | 57 |
55 // The absolute minimum possible width/height. Use this with SetMinSize() to | 58 // The absolute minimum possible width/height. Use this with SetMinSize() to |
56 // effectively unset the minimum preferred size. | 59 // effectively unset the minimum preferred size. |
57 static const int kAbsoluteMinSize; | 60 static const int kAbsoluteMinSize; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 110 |
108 // The maximum preferred size. | 111 // The maximum preferred size. |
109 gfx::Size max_size_; | 112 gfx::Size max_size_; |
110 | 113 |
111 DISALLOW_COPY_AND_ASSIGN(SizeRangeLayout); | 114 DISALLOW_COPY_AND_ASSIGN(SizeRangeLayout); |
112 }; | 115 }; |
113 | 116 |
114 } // namespace ash | 117 } // namespace ash |
115 | 118 |
116 #endif // ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ | 119 #endif // ASH_SYSTEM_TRAY_SIZE_RANGE_LAYOUT_H_ |
OLD | NEW |