Chromium Code Reviews| 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_GRID_LAYOUT_H_ | 5 #ifndef UI_VIEWS_LAYOUT_GRID_LAYOUT_H_ |
| 6 #define UI_VIEWS_LAYOUT_GRID_LAYOUT_H_ | 6 #define UI_VIEWS_LAYOUT_GRID_LAYOUT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 int fixed_width, | 293 int fixed_width, |
| 294 int min_width); | 294 int min_width); |
| 295 | 295 |
| 296 // Forces the specified columns to have the same size. The size of | 296 // Forces the specified columns to have the same size. The size of |
| 297 // linked columns is that of the max of the specified columns. This | 297 // linked columns is that of the max of the specified columns. This |
| 298 // must end with -1. For example, the following forces the first and | 298 // must end with -1. For example, the following forces the first and |
| 299 // second column to have the same size: | 299 // second column to have the same size: |
| 300 // LinkColumnSizes(0, 1, -1); | 300 // LinkColumnSizes(0, 1, -1); |
| 301 void LinkColumnSizes(int first, ...); | 301 void LinkColumnSizes(int first, ...); |
| 302 | 302 |
| 303 // When sizing linked columns, columns wider than |size_limit| are ignored. | |
| 304 void set_linked_column_size_limit(int size_limit) { | |
| 305 linked_column_size_limit_ = size_limit; | |
| 306 } | |
| 307 | |
| 303 // ID of this ColumnSet. | 308 // ID of this ColumnSet. |
| 304 int id() const { return id_; } | 309 int id() const { return id_; } |
| 305 | 310 |
| 306 int num_columns() const { return static_cast<int>(columns_.size()); } | 311 int num_columns() const { return static_cast<int>(columns_.size()); } |
| 307 | 312 |
| 308 private: | 313 private: |
| 309 friend class GridLayout; | 314 friend class GridLayout; |
| 310 | 315 |
| 311 explicit ColumnSet(int id); | 316 explicit ColumnSet(int id); |
| 312 | 317 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 // Calculate the preferred width of each view in this column set, as well | 353 // Calculate the preferred width of each view in this column set, as well |
| 349 // as updating the remaining_width. | 354 // as updating the remaining_width. |
| 350 void CalculateSize(); | 355 void CalculateSize(); |
| 351 | 356 |
| 352 // Distributes delta among the resizable columns. | 357 // Distributes delta among the resizable columns. |
| 353 void Resize(int delta); | 358 void Resize(int delta); |
| 354 | 359 |
| 355 // ID for this columnset. | 360 // ID for this columnset. |
| 356 const int id_; | 361 const int id_; |
| 357 | 362 |
| 363 // Threshold to ignore a column when unifying same sized columns. | |
|
Peter Kasting
2017/03/07 02:50:37
Nit: "Columns wider than this limit will be ignore
tapted
2017/03/07 12:06:41
Done.
Peter Kasting
2017/03/07 21:22:49
SGTM
| |
| 364 int linked_column_size_limit_; | |
| 365 | |
| 358 // The columns. | 366 // The columns. |
| 359 std::vector<std::unique_ptr<Column>> columns_; | 367 std::vector<std::unique_ptr<Column>> columns_; |
| 360 | 368 |
| 361 // The ViewStates. This is sorted based on column_span in ascending | 369 // The ViewStates. This is sorted based on column_span in ascending |
| 362 // order. | 370 // order. |
| 363 std::vector<ViewState*> view_states_; | 371 std::vector<ViewState*> view_states_; |
| 364 | 372 |
| 365 // The master column of those columns that are linked. See Column | 373 // The master column of those columns that are linked. See Column |
| 366 // for a description of what the master column is. | 374 // for a description of what the master column is. |
| 367 std::vector<Column*> master_columns_; | 375 std::vector<Column*> master_columns_; |
| 368 | 376 |
| 369 DISALLOW_COPY_AND_ASSIGN(ColumnSet); | 377 DISALLOW_COPY_AND_ASSIGN(ColumnSet); |
| 370 }; | 378 }; |
| 371 | 379 |
| 372 } // namespace views | 380 } // namespace views |
| 373 | 381 |
| 374 #endif // UI_VIEWS_LAYOUT_GRID_LAYOUT_H_ | 382 #endif // UI_VIEWS_LAYOUT_GRID_LAYOUT_H_ |
| OLD | NEW |