| 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/textfield_example.h" | 5 #include "ui/views/examples/textfield_example.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 name_->AppendText(ASCIIToUTF16("[append]")); | 116 name_->AppendText(ASCIIToUTF16("[append]")); |
| 117 password_->AppendText(ASCIIToUTF16("[append]")); | 117 password_->AppendText(ASCIIToUTF16("[append]")); |
| 118 read_only_->AppendText(ASCIIToUTF16("[append]")); | 118 read_only_->AppendText(ASCIIToUTF16("[append]")); |
| 119 } else if (sender == set_) { | 119 } else if (sender == set_) { |
| 120 name_->SetText(ASCIIToUTF16("[set]")); | 120 name_->SetText(ASCIIToUTF16("[set]")); |
| 121 password_->SetText(ASCIIToUTF16("[set]")); | 121 password_->SetText(ASCIIToUTF16("[set]")); |
| 122 read_only_->SetText(ASCIIToUTF16("[set]")); | 122 read_only_->SetText(ASCIIToUTF16("[set]")); |
| 123 } else if (sender == set_style_) { | 123 } else if (sender == set_style_) { |
| 124 if (!name_->text().empty()) { | 124 if (!name_->text().empty()) { |
| 125 name_->SetColor(SK_ColorGREEN); | 125 name_->SetColor(SK_ColorGREEN); |
| 126 name_->SetStyle(gfx::BOLD, true); | 126 name_->SetWeight(gfx::Font::Weight::BOLD); |
| 127 | 127 |
| 128 if (name_->text().length() >= 5) { | 128 if (name_->text().length() >= 5) { |
| 129 size_t fifth = name_->text().length() / 5; | 129 size_t fifth = name_->text().length() / 5; |
| 130 const gfx::Range big_range(1 * fifth, 4 * fifth); | 130 const gfx::Range big_range(1 * fifth, 4 * fifth); |
| 131 name_->ApplyStyle(gfx::BOLD, false, big_range); | |
| 132 name_->ApplyStyle(gfx::UNDERLINE, true, big_range); | 131 name_->ApplyStyle(gfx::UNDERLINE, true, big_range); |
| 132 name_->ApplyWeight(gfx::Font::Weight::NORMAL, big_range); |
| 133 name_->ApplyColor(SK_ColorBLUE, big_range); | 133 name_->ApplyColor(SK_ColorBLUE, big_range); |
| 134 | 134 |
| 135 const gfx::Range small_range(2 * fifth, 3 * fifth); | 135 const gfx::Range small_range(2 * fifth, 3 * fifth); |
| 136 name_->ApplyStyle(gfx::ITALIC, true, small_range); | 136 name_->ApplyStyle(gfx::ITALIC, true, small_range); |
| 137 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); | 137 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); |
| 138 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); | 138 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); |
| 139 name_->ApplyColor(SK_ColorRED, small_range); | 139 name_->ApplyColor(SK_ColorRED, small_range); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace examples | 145 } // namespace examples |
| 146 } // namespace views | 146 } // namespace views |
| OLD | NEW |