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

Side by Side Diff: ui/views/examples/text_example.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge 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
« no previous file with comments | « ui/views/examples/multiline_example.cc ('k') | ui/views/examples/vector_example.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/examples/text_example.h" 5 #include "ui/views/examples/text_example.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 example_combobox_model_.push_back(model); 141 example_combobox_model_.push_back(model);
142 Combobox* combobox = new Combobox(model); 142 Combobox* combobox = new Combobox(model);
143 combobox->SetSelectedIndex(0); 143 combobox->SetSelectedIndex(0);
144 combobox->set_listener(this); 144 combobox->set_listener(this);
145 layout->AddView(combobox, kNumColumns - 1, 1); 145 layout->AddView(combobox, kNumColumns - 1, 1);
146 return combobox; 146 return combobox;
147 } 147 }
148 148
149 void TextExample::CreateExampleView(View* container) { 149 void TextExample::CreateExampleView(View* container) {
150 text_view_ = new TextExampleView; 150 text_view_ = new TextExampleView;
151 text_view_->SetBorder(Border::CreateSolidBorder(1, SK_ColorGRAY)); 151 text_view_->SetBorder(CreateSolidBorder(1, SK_ColorGRAY));
152 GridLayout* layout = new GridLayout(container); 152 GridLayout* layout = new GridLayout(container);
153 container->SetLayoutManager(layout); 153 container->SetLayoutManager(layout);
154 layout->AddPaddingRow(0, 8); 154 layout->AddPaddingRow(0, 8);
155 155
156 ColumnSet* column_set = layout->AddColumnSet(0); 156 ColumnSet* column_set = layout->AddColumnSet(0);
157 column_set->AddPaddingColumn(0, 8); 157 column_set->AddPaddingColumn(0, 8);
158 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 158 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
159 0.1f, GridLayout::USE_PREF, 0, 0); 159 0.1f, GridLayout::USE_PREF, 0, 0);
160 for (int i = 0; i < kNumColumns - 1; i++) 160 for (int i = 0; i < kNumColumns - 1; i++)
161 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 161 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 flags |= gfx::Canvas::HIDE_PREFIX; 263 flags |= gfx::Canvas::HIDE_PREFIX;
264 break; 264 break;
265 } 265 }
266 } 266 }
267 text_view_->set_flags(flags); 267 text_view_->set_flags(flags);
268 text_view_->SchedulePaint(); 268 text_view_->SchedulePaint();
269 } 269 }
270 270
271 } // namespace examples 271 } // namespace examples
272 } // namespace views 272 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/multiline_example.cc ('k') | ui/views/examples/vector_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698