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 #include "ui/views/layout/grid_layout.h" | 5 #include "ui/views/layout/grid_layout.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 fixed_width_(fixed_width), | 171 fixed_width_(fixed_width), |
172 min_width_(min_width), | 172 min_width_(min_width), |
173 is_padding_(is_padding), | 173 is_padding_(is_padding), |
174 master_column_(NULL) {} | 174 master_column_(NULL) {} |
175 | 175 |
176 virtual ~Column() {} | 176 virtual ~Column() {} |
177 | 177 |
178 GridLayout::Alignment h_align() { return h_align_; } | 178 GridLayout::Alignment h_align() { return h_align_; } |
179 GridLayout::Alignment v_align() { return v_align_; } | 179 GridLayout::Alignment v_align() { return v_align_; } |
180 | 180 |
181 virtual void ResetSize() OVERRIDE; | 181 virtual void ResetSize() override; |
182 | 182 |
183 private: | 183 private: |
184 friend class ColumnSet; | 184 friend class ColumnSet; |
185 friend class GridLayout; | 185 friend class GridLayout; |
186 | 186 |
187 Column* GetLastMasterColumn(); | 187 Column* GetLastMasterColumn(); |
188 | 188 |
189 // Determines the max size of all linked columns, and sets each column | 189 // Determines the max size of all linked columns, and sets each column |
190 // to that size. This should only be used for the master column. | 190 // to that size. This should only be used for the master column. |
191 void UnifySameSizedColumnSizes(); | 191 void UnifySameSizedColumnSizes(); |
192 | 192 |
193 virtual void AdjustSize(int size) OVERRIDE; | 193 virtual void AdjustSize(int size) override; |
194 | 194 |
195 const GridLayout::Alignment h_align_; | 195 const GridLayout::Alignment h_align_; |
196 const GridLayout::Alignment v_align_; | 196 const GridLayout::Alignment v_align_; |
197 const GridLayout::SizeType size_type_; | 197 const GridLayout::SizeType size_type_; |
198 int same_size_column_; | 198 int same_size_column_; |
199 const int fixed_width_; | 199 const int fixed_width_; |
200 const int min_width_; | 200 const int min_width_; |
201 | 201 |
202 const bool is_padding_; | 202 const bool is_padding_; |
203 | 203 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 Row(int height, float resize_percent, ColumnSet* column_set) | 262 Row(int height, float resize_percent, ColumnSet* column_set) |
263 : LayoutElement(resize_percent), | 263 : LayoutElement(resize_percent), |
264 height_(height), | 264 height_(height), |
265 column_set_(column_set), | 265 column_set_(column_set), |
266 max_ascent_(0), | 266 max_ascent_(0), |
267 max_descent_(0) { | 267 max_descent_(0) { |
268 } | 268 } |
269 | 269 |
270 virtual ~Row() {} | 270 virtual ~Row() {} |
271 | 271 |
272 virtual void ResetSize() OVERRIDE { | 272 virtual void ResetSize() override { |
273 max_ascent_ = max_descent_ = 0; | 273 max_ascent_ = max_descent_ = 0; |
274 SetSize(height_); | 274 SetSize(height_); |
275 } | 275 } |
276 | 276 |
277 ColumnSet* column_set() { | 277 ColumnSet* column_set() { |
278 return column_set_; | 278 return column_set_; |
279 } | 279 } |
280 | 280 |
281 // Adjusts the size to accomodate the specified ascent/descent. | 281 // Adjusts the size to accomodate the specified ascent/descent. |
282 void AdjustSizeForBaseline(int ascent, int descent) { | 282 void AdjustSizeForBaseline(int ascent, int descent) { |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 | 1055 |
1056 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1056 ColumnSet* GridLayout::GetLastValidColumnSet() { |
1057 for (int i = current_row_ - 1; i >= 0; --i) { | 1057 for (int i = current_row_ - 1; i >= 0; --i) { |
1058 if (rows_[i]->column_set()) | 1058 if (rows_[i]->column_set()) |
1059 return rows_[i]->column_set(); | 1059 return rows_[i]->column_set(); |
1060 } | 1060 } |
1061 return NULL; | 1061 return NULL; |
1062 } | 1062 } |
1063 | 1063 |
1064 } // namespace views | 1064 } // namespace views |
OLD | NEW |