Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: ui/views/layout/box_layout.h

Issue 1422703004: BoxLayout: Added set_collapse_when_hidden(), like views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exclusiveaccess-minor-refactor
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/layout/box_layout.cc » ('j') | ui/views/layout/box_layout.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | ui/views/layout/box_layout.cc » ('j') | ui/views/layout/box_layout.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698