OLD | NEW |
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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/controls/button/checkbox.h" | 10 #include "ui/views/controls/button/checkbox.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 column_set->AddPaddingColumn(0, 16); | 253 column_set->AddPaddingColumn(0, 16); |
254 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, | 254 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, |
255 1, GridLayout::USE_PREF, 0, 0); | 255 1, GridLayout::USE_PREF, 0, 0); |
256 column_set->AddPaddingColumn(0, 16); | 256 column_set->AddPaddingColumn(0, 16); |
257 layout->StartRow(1, 1); | 257 layout->StartRow(1, 1); |
258 layout->AddView(text_view_); | 258 layout->AddView(text_view_); |
259 | 259 |
260 layout->AddPaddingRow(0, 8); | 260 layout->AddPaddingRow(0, 8); |
261 } | 261 } |
262 | 262 |
263 void TextExample::ButtonPressed(Button* button, | 263 void TextExample::ButtonPressed(Button* button, const ui::Event& event) { |
264 const Event& event) { | |
265 int flags = text_view_->text_flags(); | 264 int flags = text_view_->text_flags(); |
266 int style = text_view_->GetFontStyle(); | 265 int style = text_view_->GetFontStyle(); |
267 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE); | 266 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE); |
268 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); | 267 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); |
269 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); | 268 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); |
270 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); | 269 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); |
271 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINED); | 270 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINED); |
272 text_view_->set_halo(halo_checkbox_->checked()); | 271 text_view_->set_halo(halo_checkbox_->checked()); |
273 text_view_->set_text_flags(flags); | 272 text_view_->set_text_flags(flags); |
274 text_view_->SetFontStyle(style); | 273 text_view_->SetFontStyle(style); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 text_flags |= gfx::Canvas::HIDE_PREFIX; | 365 text_flags |= gfx::Canvas::HIDE_PREFIX; |
367 break; | 366 break; |
368 } | 367 } |
369 } | 368 } |
370 text_view_->set_text_flags(text_flags); | 369 text_view_->set_text_flags(text_flags); |
371 text_view_->SchedulePaint(); | 370 text_view_->SchedulePaint(); |
372 } | 371 } |
373 | 372 |
374 } // namespace examples | 373 } // namespace examples |
375 } // namespace views | 374 } // namespace views |
OLD | NEW |