OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 5 #ifndef UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
6 #define UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 6 #define UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 void set_inside_border_insets(const gfx::Insets& insets) { | 76 void set_inside_border_insets(const gfx::Insets& insets) { |
77 inside_border_insets_ = insets; | 77 inside_border_insets_ = insets; |
78 } | 78 } |
79 | 79 |
80 void set_minimum_cross_axis_size(int size) { | 80 void set_minimum_cross_axis_size(int size) { |
81 minimum_cross_axis_size_ = size; | 81 minimum_cross_axis_size_ = size; |
82 } | 82 } |
83 | 83 |
| 84 // Sets whether the preferred size is empty when the host is not visible. |
| 85 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } |
| 86 |
84 // Sets the flex weight for the given |view|. Using the preferred size as | 87 // Sets the flex weight for the given |view|. Using the preferred size as |
85 // the basis, free space along the main axis is distributed to views in the | 88 // the basis, free space along the main axis is distributed to views in the |
86 // ratio of their flex weights. Similarly, if the views will overflow the | 89 // ratio of their flex weights. Similarly, if the views will overflow the |
87 // parent, space is subtracted in these ratios. | 90 // parent, space is subtracted in these ratios. |
88 // | 91 // |
89 // A flex of 0 means this view is not resized. Flex values must not be | 92 // A flex of 0 means this view is not resized. Flex values must not be |
90 // negative. | 93 // negative. |
91 void SetFlexForView(const View* view, int flex); | 94 void SetFlexForView(const View* view, int flex); |
92 | 95 |
93 // Clears the flex for the given |view|, causing it to use the default | 96 // Clears the flex for the given |view|, causing it to use the default |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 161 |
159 // A map of views to their flex weights. | 162 // A map of views to their flex weights. |
160 std::map<const View*, int> flex_map_; | 163 std::map<const View*, int> flex_map_; |
161 | 164 |
162 // The flex weight for views if none is set. Defaults to 0. | 165 // The flex weight for views if none is set. Defaults to 0. |
163 int default_flex_; | 166 int default_flex_; |
164 | 167 |
165 // The minimum cross axis size for the layout. | 168 // The minimum cross axis size for the layout. |
166 int minimum_cross_axis_size_; | 169 int minimum_cross_axis_size_; |
167 | 170 |
| 171 // Whether to collapse the host when it's not visible. |
| 172 bool collapse_when_hidden_; |
| 173 |
168 // The view that this BoxLayout is managing the layout for. | 174 // The view that this BoxLayout is managing the layout for. |
169 views::View* host_; | 175 views::View* host_; |
170 | 176 |
171 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); | 177 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); |
172 }; | 178 }; |
173 | 179 |
174 } // namespace views | 180 } // namespace views |
175 | 181 |
176 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 182 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
OLD | NEW |