| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 adding_view_(false) { | 643 adding_view_(false) { |
| 644 DCHECK(host); | 644 DCHECK(host); |
| 645 } | 645 } |
| 646 | 646 |
| 647 GridLayout::~GridLayout() { | 647 GridLayout::~GridLayout() { |
| 648 } | 648 } |
| 649 | 649 |
| 650 // static | 650 // static |
| 651 GridLayout* GridLayout::CreatePanel(View* host) { | 651 GridLayout* GridLayout::CreatePanel(View* host) { |
| 652 GridLayout* layout = new GridLayout(host); | 652 GridLayout* layout = new GridLayout(host); |
| 653 layout->SetInsets(kPanelVertMargin, kButtonHEdgeMarginNew, | 653 LayoutDelegate* delegate = host->GetLayoutDelegate(); |
| 654 kPanelVertMargin, kButtonHEdgeMarginNew); | 654 layout->SetInsets( |
| 655 delegate->GetLayoutDistance(LayoutDelegate::PANEL_VERT_MARGIN), |
| 656 delegate->GetLayoutDistance(LayoutDelegate::BUTTON_HEDGE_MARGIN_NEW), |
| 657 delegate->GetLayoutDistance(LayoutDelegate::PANEL_VERT_MARGIN), |
| 658 delegate->GetLayoutDistance(LayoutDelegate::BUTTON_HEDGE_MARGIN_NEW)); |
| 655 return layout; | 659 return layout; |
| 656 } | 660 } |
| 657 | 661 |
| 658 void GridLayout::SetInsets(int top, int left, int bottom, int right) { | 662 void GridLayout::SetInsets(int top, int left, int bottom, int right) { |
| 659 insets_.Set(top, left, bottom, right); | 663 insets_.Set(top, left, bottom, right); |
| 660 } | 664 } |
| 661 | 665 |
| 662 void GridLayout::SetInsets(const gfx::Insets& insets) { | 666 void GridLayout::SetInsets(const gfx::Insets& insets) { |
| 663 insets_ = insets; | 667 insets_ = insets; |
| 664 } | 668 } |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 | 1021 |
| 1018 ColumnSet* GridLayout::GetLastValidColumnSet() { | 1022 ColumnSet* GridLayout::GetLastValidColumnSet() { |
| 1019 for (int i = current_row_ - 1; i >= 0; --i) { | 1023 for (int i = current_row_ - 1; i >= 0; --i) { |
| 1020 if (rows_[i]->column_set()) | 1024 if (rows_[i]->column_set()) |
| 1021 return rows_[i]->column_set(); | 1025 return rows_[i]->column_set(); |
| 1022 } | 1026 } |
| 1023 return nullptr; | 1027 return nullptr; |
| 1024 } | 1028 } |
| 1025 | 1029 |
| 1026 } // namespace views | 1030 } // namespace views |
| OLD | NEW |