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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 void set_cross_axis_alignment(CrossAxisAlignment cross_axis_alignment) { | 72 void set_cross_axis_alignment(CrossAxisAlignment cross_axis_alignment) { |
73 cross_axis_alignment_ = cross_axis_alignment; | 73 cross_axis_alignment_ = cross_axis_alignment; |
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) { |
| 81 minimum_cross_axis_size_ = size; |
| 82 } |
| 83 |
80 // Sets the flex weight for the given |view|. Using the preferred size as | 84 // Sets the flex weight for the given |view|. Using the preferred size as |
81 // the basis, free space along the main axis is distributed to views in the | 85 // the basis, free space along the main axis is distributed to views in the |
82 // ratio of their flex weights. Similarly, if the views will overflow the | 86 // ratio of their flex weights. Similarly, if the views will overflow the |
83 // parent, space is subtracted in these ratios. | 87 // parent, space is subtracted in these ratios. |
84 // | 88 // |
85 // A flex of 0 means this view is not resized. Flex values must not be | 89 // A flex of 0 means this view is not resized. Flex values must not be |
86 // negative. | 90 // negative. |
87 void SetFlexForView(const View* view, int flex); | 91 void SetFlexForView(const View* view, int flex); |
88 | 92 |
89 // Clears the flex for the given |view|, causing it to use the default | 93 // Clears the flex for the given |view|, causing it to use the default |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // The alignment of children in the cross axis. This is | 156 // The alignment of children in the cross axis. This is |
153 // CROSS_AXIS_ALIGNMENT_STRETCH by default. | 157 // CROSS_AXIS_ALIGNMENT_STRETCH by default. |
154 CrossAxisAlignment cross_axis_alignment_; | 158 CrossAxisAlignment cross_axis_alignment_; |
155 | 159 |
156 // A map of views to their flex weights. | 160 // A map of views to their flex weights. |
157 std::map<const View*, int> flex_map_; | 161 std::map<const View*, int> flex_map_; |
158 | 162 |
159 // The flex weight for views if none is set. Defaults to 0. | 163 // The flex weight for views if none is set. Defaults to 0. |
160 int default_flex_; | 164 int default_flex_; |
161 | 165 |
| 166 // The minimum cross axis size for the layout. |
| 167 int minimum_cross_axis_size_; |
| 168 |
162 // The view that this BoxLayout is managing the layout for. | 169 // The view that this BoxLayout is managing the layout for. |
163 views::View* host_; | 170 views::View* host_; |
164 | 171 |
165 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); | 172 DISALLOW_IMPLICIT_CONSTRUCTORS(BoxLayout); |
166 }; | 173 }; |
167 | 174 |
168 } // namespace views | 175 } // namespace views |
169 | 176 |
170 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ | 177 #endif // UI_VIEWS_LAYOUT_BOX_LAYOUT_H_ |
OLD | NEW |