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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/base/events/event.h" | 8 #include "ui/base/events/event.h" |
9 #include "ui/base/range/range.h" | 9 #include "ui/gfx/range/range.h" |
10 #include "ui/gfx/render_text.h" | 10 #include "ui/gfx/render_text.h" |
11 #include "ui/views/controls/button/label_button.h" | 11 #include "ui/views/controls/button/label_button.h" |
12 #include "ui/views/controls/label.h" | 12 #include "ui/views/controls/label.h" |
13 #include "ui/views/controls/textfield/textfield.h" | 13 #include "ui/views/controls/textfield/textfield.h" |
14 #include "ui/views/layout/grid_layout.h" | 14 #include "ui/views/layout/grid_layout.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 namespace examples { | 18 namespace examples { |
19 | 19 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 name_->SetText(ASCIIToUTF16("[set]")); | 114 name_->SetText(ASCIIToUTF16("[set]")); |
115 password_->SetText(ASCIIToUTF16("[set]")); | 115 password_->SetText(ASCIIToUTF16("[set]")); |
116 read_only_->SetText(ASCIIToUTF16("[set]")); | 116 read_only_->SetText(ASCIIToUTF16("[set]")); |
117 } else if (sender == set_style_) { | 117 } else if (sender == set_style_) { |
118 if (!name_->text().empty()) { | 118 if (!name_->text().empty()) { |
119 name_->SetColor(SK_ColorGREEN); | 119 name_->SetColor(SK_ColorGREEN); |
120 name_->SetStyle(gfx::BOLD, true); | 120 name_->SetStyle(gfx::BOLD, true); |
121 | 121 |
122 if (name_->text().length() >= 5) { | 122 if (name_->text().length() >= 5) { |
123 size_t fifth = name_->text().length() / 5; | 123 size_t fifth = name_->text().length() / 5; |
124 const ui::Range big_range(1 * fifth, 4 * fifth); | 124 const gfx::Range big_range(1 * fifth, 4 * fifth); |
125 name_->ApplyStyle(gfx::BOLD, false, big_range); | 125 name_->ApplyStyle(gfx::BOLD, false, big_range); |
126 name_->ApplyStyle(gfx::UNDERLINE, true, big_range); | 126 name_->ApplyStyle(gfx::UNDERLINE, true, big_range); |
127 name_->ApplyColor(SK_ColorBLUE, big_range); | 127 name_->ApplyColor(SK_ColorBLUE, big_range); |
128 | 128 |
129 const ui::Range small_range(2 * fifth, 3 * fifth); | 129 const gfx::Range small_range(2 * fifth, 3 * fifth); |
130 name_->ApplyStyle(gfx::ITALIC, true, small_range); | 130 name_->ApplyStyle(gfx::ITALIC, true, small_range); |
131 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); | 131 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); |
132 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); | 132 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); |
133 name_->ApplyColor(SK_ColorRED, small_range); | 133 name_->ApplyColor(SK_ColorRED, small_range); |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 } // namespace examples | 139 } // namespace examples |
140 } // namespace views | 140 } // namespace views |
OLD | NEW |