| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/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/gfx/font_list.h" | 10 #include "ui/gfx/font_list.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); | 248 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); |
| 249 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); | 249 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); |
| 250 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); | 250 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); |
| 251 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE); | 251 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE); |
| 252 text_view_->set_halo(halo_checkbox_->checked()); | 252 text_view_->set_halo(halo_checkbox_->checked()); |
| 253 text_view_->set_text_flags(flags); | 253 text_view_->set_text_flags(flags); |
| 254 text_view_->SetFontStyle(style); | 254 text_view_->SetFontStyle(style); |
| 255 text_view_->SchedulePaint(); | 255 text_view_->SchedulePaint(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void TextExample::OnSelectedIndexChanged(Combobox* combobox) { | 258 void TextExample::OnPerformAction(Combobox* combobox) { |
| 259 int text_flags = text_view_->text_flags(); | 259 int text_flags = text_view_->text_flags(); |
| 260 if (combobox == h_align_cb_) { | 260 if (combobox == h_align_cb_) { |
| 261 text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT | | 261 text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT | |
| 262 gfx::Canvas::TEXT_ALIGN_CENTER | | 262 gfx::Canvas::TEXT_ALIGN_CENTER | |
| 263 gfx::Canvas::TEXT_ALIGN_RIGHT); | 263 gfx::Canvas::TEXT_ALIGN_RIGHT); |
| 264 switch (combobox->selected_index()) { | 264 switch (combobox->selected_index()) { |
| 265 case 0: | 265 case 0: |
| 266 break; | 266 break; |
| 267 case 1: | 267 case 1: |
| 268 text_flags |= gfx::Canvas::TEXT_ALIGN_LEFT; | 268 text_flags |= gfx::Canvas::TEXT_ALIGN_LEFT; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 text_flags |= gfx::Canvas::HIDE_PREFIX; | 323 text_flags |= gfx::Canvas::HIDE_PREFIX; |
| 324 break; | 324 break; |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 text_view_->set_text_flags(text_flags); | 327 text_view_->set_text_flags(text_flags); |
| 328 text_view_->SchedulePaint(); | 328 text_view_->SchedulePaint(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace examples | 331 } // namespace examples |
| 332 } // namespace views | 332 } // namespace views |
| OLD | NEW |