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

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

Issue 13925019: fix GridLayout::CreatePanel for new style dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight clean-up Created 7 years, 8 months 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 | Annotate | Revision Log
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/stl_util.h" 10 #include "base/stl_util.h"
11 #include "ui/gfx/insets.h" 11 #include "ui/gfx/insets.h"
12 #include "ui/views/layout/layout_constants.h" 12 #include "ui/views/layout/layout_constants.h"
13 #include "ui/views/view.h" 13 #include "ui/views/view.h"
14 #include "ui/views/window/dialog_delegate.h"
14 15
15 namespace views { 16 namespace views {
16 17
17 // LayoutElement ------------------------------------------------------ 18 // LayoutElement ------------------------------------------------------
18 19
19 // A LayoutElement has a size and location along one axis. It contains 20 // A LayoutElement has a size and location along one axis. It contains
20 // methods that are used along both axis. 21 // methods that are used along both axis.
21 class LayoutElement { 22 class LayoutElement {
22 public: 23 public:
23 // Invokes ResetSize on all the layout elements. 24 // Invokes ResetSize on all the layout elements.
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 669
669 GridLayout::~GridLayout() { 670 GridLayout::~GridLayout() {
670 STLDeleteElements(&column_sets_); 671 STLDeleteElements(&column_sets_);
671 STLDeleteElements(&view_states_); 672 STLDeleteElements(&view_states_);
672 STLDeleteElements(&rows_); 673 STLDeleteElements(&rows_);
673 } 674 }
674 675
675 // static 676 // static
676 GridLayout* GridLayout::CreatePanel(View* host) { 677 GridLayout* GridLayout::CreatePanel(View* host) {
677 GridLayout* layout = new GridLayout(host); 678 GridLayout* layout = new GridLayout(host);
678 layout->SetInsets(kPanelVertMargin, kPanelHorizMargin, 679
679 kPanelVertMargin, kPanelHorizMargin); 680 int horizontal_margin = DialogDelegate::UseNewStyle() ?
681 kButtonHEdgeMarginNew : kPanelHorizMargin;
682
683 layout->SetInsets(kPanelVertMargin, horizontal_margin,
684 kPanelVertMargin, horizontal_margin);
680 return layout; 685 return layout;
681 } 686 }
682 687
683 void GridLayout::SetInsets(int top, int left, int bottom, int right) { 688 void GridLayout::SetInsets(int top, int left, int bottom, int right) {
684 insets_.Set(top, left, bottom, right); 689 insets_.Set(top, left, bottom, right);
685 } 690 }
686 691
687 void GridLayout::SetInsets(const gfx::Insets& insets) { 692 void GridLayout::SetInsets(const gfx::Insets& insets) {
688 insets_ = insets; 693 insets_ = insets;
689 } 694 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 1062
1058 ColumnSet* GridLayout::GetLastValidColumnSet() { 1063 ColumnSet* GridLayout::GetLastValidColumnSet() {
1059 for (int i = current_row_ - 1; i >= 0; --i) { 1064 for (int i = current_row_ - 1; i >= 0; --i) {
1060 if (rows_[i]->column_set()) 1065 if (rows_[i]->column_set())
1061 return rows_[i]->column_set(); 1066 return rows_[i]->column_set();
1062 } 1067 }
1063 return NULL; 1068 return NULL;
1064 } 1069 }
1065 1070
1066 } // namespace views 1071 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698