0

views: Make CreatePanelGridLayout a static method of GridLayout class.

Move it from standard_layout.h and rename to just CreatePanel.

BUG=None
TEST=trybots

Review URL: http://codereview.chromium.org/6384002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72128 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
tfarina@chromium.org
2011-01-21 12:52:29 +00:00
parent 3846fb2460
commit 8d0f800145
36 changed files with 55 additions and 54 deletions

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -154,7 +154,7 @@ void CaptchaView::Init() {
set_background(views::Background::CreateBackgroundPainter(true, painter));
}
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
int column_view_set_id = 0;

@ -130,7 +130,7 @@ class TpmInfoView : public views::View,
};
void TpmInfoView::Init() {
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
views::ColumnSet* column_set = layout->AddColumnSet(0);
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -117,7 +117,7 @@ void PasswordChangedView::Init() {
old_password_field_->SetController(this);
// Define controls layout.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
views::ColumnSet* column_set = layout->AddColumnSet(0);

@ -534,7 +534,7 @@ void InternetPageContentView::DidChangeBounds(const gfx::Rect& previous,
}
void InternetPageContentView::InitControlLayout() {
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
int single_column_view_set_id = 0;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -379,7 +379,7 @@ void AccessibilitySection::NotifyPrefChanged(const std::string* pref_name) {
// SystemPageView, SettingsPageView implementation:
void SystemPageView::InitControlLayout() {
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
int single_column_view_set_id = 0;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -282,7 +282,7 @@ const std::string WifiConfigView::GetPassphrase() const {
}
void WifiConfigView::Init() {
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
int column_view_set_id = 0;

@ -643,7 +643,7 @@ class TryChromeDialog : public views::ButtonListener,
root_view->set_background(
views::Background::CreateSolidBackground(0xfc, 0xfc, 0xfc));
views::GridLayout* layout = CreatePanelGridLayout(root_view);
views::GridLayout* layout = views::GridLayout::CreatePanel(root_view);
if (!layout) {
NOTREACHED();
return Upgrade::TD_DIALOG_ERROR;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -171,7 +171,7 @@ void ContentView::InitControlLayout() {
using views::GridLayout;
// TODO(sky): Vertical alignment should be baseline.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
ColumnSet* c1 = layout->AddColumnSet(0);

@ -222,7 +222,7 @@ void AboutIPCDialog::RunDialog() {
}
void AboutIPCDialog::SetupControls() {
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
track_toggle_ = new views::TextButton(this, kStartTrackingLabel);

@ -468,7 +468,7 @@ void AutoFillProfilesView::Init() {
remove_button_ = new views::NativeButton(this,
UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_DELETE_BUTTON)));
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int table_with_buttons_column_view_set_id = 0;

@ -314,7 +314,7 @@ void BookmarkEditorView::Init() {
}
// Yummy layout code.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int labels_column_set_id = 0;

@ -156,7 +156,7 @@ void ClearBrowsingDataView2::Init() {
}
void ClearBrowsingDataView2::InitControlLayout() {
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
this->SetLayoutManager(layout);
int leading_column_set_id = 0;

@ -112,7 +112,7 @@ void ClearServerDataView::Init() {
}
void ClearServerDataView::InitControlLayout() {
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
this->SetLayoutManager(layout);
int centered_column_set_id = 0;

@ -221,7 +221,7 @@ void CollectedCookiesWin::Init() {
using views::GridLayout;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int single_column_layout_id = 0;

@ -119,7 +119,7 @@ void AppInfoView::PrepareDescriptionLabel(const string16& description) {
}
void AppInfoView::SetupLayout() {
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
static const int kColumnSetId = 0;
@ -263,7 +263,7 @@ void CreateApplicationShortcutView::InitControls() {
#endif
// Layout controls
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
static const int kHeaderColumnSetId = 0;

@ -147,7 +147,7 @@ void EditSearchEngineDialog::Init() {
const int unrelated_y = kUnrelatedControlVerticalSpacing;
// View and GridLayout take care of deleting GridLayout for us.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
// Define the structure of the layout.

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -364,7 +364,7 @@ void HungRendererDialogView::Init() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int double_column_set_id = 0;

@ -79,7 +79,7 @@ void ImporterView::SetupControl() {
// Arranges controls by using GridLayout.
const int column_set_id = 0;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
ColumnSet* column_set = layout->AddColumnSet(column_set_id);
column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,

@ -228,7 +228,7 @@ void ImportingProgressView::InitControlLayout() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
gfx::Size ps = state_history_->GetPreferredSize();

@ -31,7 +31,7 @@ InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) {
learn_more_link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
learn_more_link->SetController(this);
views::GridLayout* layout = CreatePanelGridLayout(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int first_column_set = 1;

@ -198,7 +198,7 @@ void KeywordEditorView::InitLayoutManager() {
const int related_y = kRelatedControlVerticalSpacing;
const int unrelated_y = kUnrelatedControlVerticalSpacing;
GridLayout* contents_layout = CreatePanelGridLayout(this);
GridLayout* contents_layout = GridLayout::CreatePanel(this);
SetLayoutManager(contents_layout);
// For the table and buttons.

@ -43,7 +43,7 @@ LoginView::LoginView(const std::wstring& explanation,
message_label_->SetAllowCharacterBreak(true);
// Initialize the Grid Layout Manager used for this dialog box.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
// Add the column set for the information message at the top of the dialog

@ -1570,7 +1570,7 @@ void AdvancedContentsView::DidChangeBounds(const gfx::Rect& previous,
// AdvancedContentsView, OptionsPageView implementation:
void AdvancedContentsView::InitControlLayout() {
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int single_column_view_set_id = 0;

@ -129,7 +129,7 @@ void AdvancedPageView::InitControlLayout() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int single_column_view_set_id = 0;

@ -320,7 +320,7 @@ void CookiesView::Init() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int five_column_layout_id = 0;

@ -123,7 +123,7 @@ void ExceptionEditorView::Init() {
UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTION_EDITOR_OTR_TITLE)));
incognito_cb_->SetChecked(is_off_the_record_);
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
// For the Textfields.

@ -129,7 +129,7 @@ void ExceptionsPageView::InitControlLayout() {
SetupTable();
// Do the layout thing.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int top_column_set_id = 0;

@ -257,7 +257,7 @@ void FontsPageView::InitControlLayout() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int single_column_view_set_id = 0;

@ -265,7 +265,7 @@ void LanguagesPageView::InitControlLayout() {
using views::GridLayout;
using views::ColumnSet;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int single_column_view_set_id = 0;

@ -277,7 +277,7 @@ void PasswordsPageView::InitControlLayout() {
// Do the layout thing.
const int top_column_set_id = 0;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
// Design the grid.

@ -38,7 +38,7 @@ void UninstallView::SetupControls() {
using views::ColumnSet;
using views::GridLayout;
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
// Message to confirm uninstallation.

@ -66,7 +66,7 @@ UrlPicker::UrlPicker(UrlPickerDelegate* delegate,
url_table_->SetObserver(this);
// Yummy layout code.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
const int labels_column_set_id = 0;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -150,7 +150,7 @@ void MessageBoxView::ResetLayoutManager() {
using views::ColumnSet;
// Initialize the Grid Layout Manager used for this dialog box.
GridLayout* layout = CreatePanelGridLayout(this);
GridLayout* layout = GridLayout::CreatePanel(this);
SetLayoutManager(layout);
gfx::Size icon_size;

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -676,6 +676,14 @@ GridLayout::~GridLayout() {
STLDeleteElements(&rows_);
}
// static
GridLayout* GridLayout::CreatePanel(View* host) {
GridLayout* layout = new GridLayout(host);
layout->SetInsets(kPanelVertMargin, kPanelHorizMargin,
kPanelVertMargin, kPanelHorizMargin);
return layout;
}
void GridLayout::SetInsets(int top, int left, int bottom, int right) {
top_inset_ = top;
bottom_inset_ = bottom;
@ -1060,10 +1068,3 @@ ColumnSet* GridLayout::GetLastValidColumnSet() {
}
} // namespace views
views::GridLayout* CreatePanelGridLayout(views::View* host) {
views::GridLayout* layout = new views::GridLayout(host);
layout->SetInsets(kPanelVertMargin, kPanelHorizMargin,
kPanelVertMargin, kPanelHorizMargin);
return layout;
}

@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -105,6 +105,9 @@ class GridLayout : public LayoutManager {
explicit GridLayout(View* host);
virtual ~GridLayout();
// Creates a GridLayout with kPanel*Margin insets.
static GridLayout* CreatePanel(View* host);
// Sets the insets. All views are placed relative to these offsets.
void SetInsets(int top, int left, int bottom, int right);
void SetInsets(const gfx::Insets& insets);

@ -1,4 +1,4 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -67,7 +67,4 @@ const int kButtonHEdgeMargin = 7;
// Horizontal spacing between buttons that are logically related.
const int kRelatedButtonHSpacing = 6;
// Creates a GridLayout with kPanel*Margin insets.
views::GridLayout* CreatePanelGridLayout(views::View* host);
#endif // VIEWS_STANDARD_LAYOUT_H_