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

Side by Side Diff: ui/views/layout/grid_layout.cc

Issue 2485083003: views: add layout delegates (Closed)
Patch Set: Created 4 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
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 #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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698