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

Side by Side Diff: ui/views/controls/message_box_view.cc

Issue 13925019: fix GridLayout::CreatePanel for new style dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: msw review 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
« no previous file with comments | « ui/views/controls/message_box_view.h ('k') | ui/views/layout/grid_layout.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/controls/message_box_view.h" 5 #include "ui/views/controls/message_box_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 namespace views { 60 namespace views {
61 61
62 /////////////////////////////////////////////////////////////////////////////// 62 ///////////////////////////////////////////////////////////////////////////////
63 // MessageBoxView, public: 63 // MessageBoxView, public:
64 64
65 MessageBoxView::InitParams::InitParams(const string16& message) 65 MessageBoxView::InitParams::InitParams(const string16& message)
66 : options(NO_OPTIONS), 66 : options(NO_OPTIONS),
67 message(message), 67 message(message),
68 message_width(kDefaultMessageWidth), 68 message_width(kDefaultMessageWidth),
69 top_inset(kPanelVertMargin),
70 bottom_inset(kPanelVertMargin),
71 left_inset(kPanelHorizMargin),
72 right_inset(kPanelHorizMargin),
73 inter_row_vertical_spacing(kRelatedControlVerticalSpacing), 69 inter_row_vertical_spacing(kRelatedControlVerticalSpacing),
74 clipboard_source_tag() 70 clipboard_source_tag() {}
75 {
76 }
77 71
78 MessageBoxView::InitParams::~InitParams() { 72 MessageBoxView::InitParams::~InitParams() {
79 } 73 }
80 74
81 MessageBoxView::MessageBoxView(const InitParams& params) 75 MessageBoxView::MessageBoxView(const InitParams& params)
82 : prompt_field_(NULL), 76 : prompt_field_(NULL),
83 icon_(NULL), 77 icon_(NULL),
84 checkbox_(NULL), 78 checkbox_(NULL),
85 message_width_(params.message_width) { 79 message_width_(params.message_width) {
86 Init(params); 80 Init(params);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 message_label->SetAllowCharacterBreak(true); 182 message_label->SetAllowCharacterBreak(true);
189 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 183 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
190 message_labels_.push_back(message_label); 184 message_labels_.push_back(message_label);
191 } 185 }
192 186
193 if (params.options & HAS_PROMPT_FIELD) { 187 if (params.options & HAS_PROMPT_FIELD) {
194 prompt_field_ = new Textfield; 188 prompt_field_ = new Textfield;
195 prompt_field_->SetText(params.default_prompt); 189 prompt_field_->SetText(params.default_prompt);
196 } 190 }
197 191
198 top_inset_ = params.top_inset;
199 bottom_inset_ = params.bottom_inset;
200 left_inset_ = params.left_inset;
201 right_inset_ = params.right_inset;
202 inter_row_vertical_spacing_ = params.inter_row_vertical_spacing; 192 inter_row_vertical_spacing_ = params.inter_row_vertical_spacing;
203 source_tag_ = params.clipboard_source_tag; 193 source_tag_ = params.clipboard_source_tag;
204 194
205 ResetLayoutManager(); 195 ResetLayoutManager();
206 } 196 }
207 197
208 void MessageBoxView::ResetLayoutManager() { 198 void MessageBoxView::ResetLayoutManager() {
209 // Initialize the Grid Layout Manager used for this dialog box. 199 // Initialize the Grid Layout Manager used for this dialog box.
210 GridLayout* layout = GridLayout::CreatePanel(this); 200 GridLayout* layout = GridLayout::CreatePanel(this);
211 layout->SetInsets(top_inset_, bottom_inset_, left_inset_, right_inset_);
212 SetLayoutManager(layout); 201 SetLayoutManager(layout);
213 202
214 gfx::Size icon_size; 203 gfx::Size icon_size;
215 if (icon_) 204 if (icon_)
216 icon_size = icon_->GetPreferredSize(); 205 icon_size = icon_->GetPreferredSize();
217 206
218 // Add the column set for the message displayed at the top of the dialog box. 207 // Add the column set for the message displayed at the top of the dialog box.
219 // And an icon, if one has been set. 208 // And an icon, if one has been set.
220 const int message_column_view_set_id = 0; 209 const int message_column_view_set_id = 0;
221 ColumnSet* column_set = layout->AddColumnSet(message_column_view_set_id); 210 ColumnSet* column_set = layout->AddColumnSet(message_column_view_set_id);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (checkbox_) { 261 if (checkbox_) {
273 layout->AddPaddingRow(0, inter_row_vertical_spacing_); 262 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
274 layout->StartRow(0, checkbox_column_view_set_id); 263 layout->StartRow(0, checkbox_column_view_set_id);
275 layout->AddView(checkbox_); 264 layout->AddView(checkbox_);
276 } 265 }
277 266
278 layout->AddPaddingRow(0, inter_row_vertical_spacing_); 267 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
279 } 268 }
280 269
281 } // namespace views 270 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/message_box_view.h ('k') | ui/views/layout/grid_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698