| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 static bool CompareByRowSpan(const ViewState* v1, const ViewState* v2) { | 367 static bool CompareByRowSpan(const ViewState* v1, const ViewState* v2) { |
| 368 return v1->row_span < v2->row_span; | 368 return v1->row_span < v2->row_span; |
| 369 } | 369 } |
| 370 | 370 |
| 371 // ColumnSet ------------------------------------------------------------- | 371 // ColumnSet ------------------------------------------------------------- |
| 372 | 372 |
| 373 ColumnSet::ColumnSet(int id) : id_(id) { | 373 ColumnSet::ColumnSet(int id) : id_(id) { |
| 374 } | 374 } |
| 375 | 375 |
| 376 ColumnSet::~ColumnSet() { | 376 ColumnSet::~ColumnSet() { |
| 377 STLDeleteElements(&columns_); | 377 base::STLDeleteElements(&columns_); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void ColumnSet::AddPaddingColumn(float resize_percent, int width) { | 380 void ColumnSet::AddPaddingColumn(float resize_percent, int width) { |
| 381 AddColumn(GridLayout::FILL, GridLayout::FILL, resize_percent, | 381 AddColumn(GridLayout::FILL, GridLayout::FILL, resize_percent, |
| 382 GridLayout::FIXED, width, width, true); | 382 GridLayout::FIXED, width, width, true); |
| 383 } | 383 } |
| 384 | 384 |
| 385 void ColumnSet::AddColumn(GridLayout::Alignment h_align, | 385 void ColumnSet::AddColumn(GridLayout::Alignment h_align, |
| 386 GridLayout::Alignment v_align, | 386 GridLayout::Alignment v_align, |
| 387 float resize_percent, | 387 float resize_percent, |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 calculated_master_columns_(false), | 655 calculated_master_columns_(false), |
| 656 remaining_row_span_(0), | 656 remaining_row_span_(0), |
| 657 current_row_(-1), | 657 current_row_(-1), |
| 658 next_column_(0), | 658 next_column_(0), |
| 659 current_row_col_set_(NULL), | 659 current_row_col_set_(NULL), |
| 660 adding_view_(false) { | 660 adding_view_(false) { |
| 661 DCHECK(host); | 661 DCHECK(host); |
| 662 } | 662 } |
| 663 | 663 |
| 664 GridLayout::~GridLayout() { | 664 GridLayout::~GridLayout() { |
| 665 STLDeleteElements(&column_sets_); | 665 base::STLDeleteElements(&column_sets_); |
| 666 STLDeleteElements(&view_states_); | 666 base::STLDeleteElements(&view_states_); |
| 667 STLDeleteElements(&rows_); | 667 base::STLDeleteElements(&rows_); |
| 668 } | 668 } |
| 669 | 669 |
| 670 // static | 670 // static |
| 671 GridLayout* GridLayout::CreatePanel(View* host) { | 671 GridLayout* GridLayout::CreatePanel(View* host) { |
| 672 GridLayout* layout = new GridLayout(host); | 672 GridLayout* layout = new GridLayout(host); |
| 673 layout->SetInsets(kPanelVertMargin, kButtonHEdgeMarginNew, | 673 layout->SetInsets(kPanelVertMargin, kButtonHEdgeMarginNew, |
| 674 kPanelVertMargin, kButtonHEdgeMarginNew); | 674 kPanelVertMargin, kButtonHEdgeMarginNew); |
| 675 return layout; | 675 return layout; |
| 676 } | 676 } |
| 677 | 677 |
| (...skipping 377 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 |