OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/multiline_example.h" | 5 #include "ui/views/examples/multiline_example.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
9 #include "ui/gfx/render_text.h" | 9 #include "ui/gfx/render_text.h" |
10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 label_->SetText(ASCIIToUTF16(kTestString)); | 108 label_->SetText(ASCIIToUTF16(kTestString)); |
109 label_->SetMultiLine(true); | 109 label_->SetMultiLine(true); |
110 label_->set_border(Border::CreateSolidBorder(2, SK_ColorCYAN)); | 110 label_->set_border(Border::CreateSolidBorder(2, SK_ColorCYAN)); |
111 | 111 |
112 label_checkbox_ = new Checkbox(ASCIIToUTF16("views::Label:")); | 112 label_checkbox_ = new Checkbox(ASCIIToUTF16("views::Label:")); |
113 label_checkbox_->SetChecked(true); | 113 label_checkbox_->SetChecked(true); |
114 label_checkbox_->set_listener(this); | 114 label_checkbox_->set_listener(this); |
115 label_checkbox_->set_request_focus_on_press(false); | 115 label_checkbox_->set_request_focus_on_press(false); |
116 | 116 |
117 textfield_ = new Textfield(); | 117 textfield_ = new Textfield(); |
118 textfield_->SetController(this); | 118 textfield_->set_controller(this); |
119 textfield_->SetText(ASCIIToUTF16(kTestString)); | 119 textfield_->SetText(ASCIIToUTF16(kTestString)); |
120 | 120 |
121 GridLayout* layout = new GridLayout(container); | 121 GridLayout* layout = new GridLayout(container); |
122 container->SetLayoutManager(layout); | 122 container->SetLayoutManager(layout); |
123 | 123 |
124 ColumnSet* column_set = layout->AddColumnSet(0); | 124 ColumnSet* column_set = layout->AddColumnSet(0); |
125 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, | 125 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, |
126 0.0f, GridLayout::USE_PREF, 0, 0); | 126 0.0f, GridLayout::USE_PREF, 0, 0); |
127 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, | 127 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, |
128 1.0f, GridLayout::FIXED, 0, 0); | 128 1.0f, GridLayout::FIXED, 0, 0); |
(...skipping 28 matching lines...) Expand all Loading... |
157 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { | 157 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { |
158 DCHECK_EQ(sender, label_checkbox_); | 158 DCHECK_EQ(sender, label_checkbox_); |
159 label_->SetText(label_checkbox_->checked() ? textfield_->text() : | 159 label_->SetText(label_checkbox_->checked() ? textfield_->text() : |
160 base::string16()); | 160 base::string16()); |
161 container()->Layout(); | 161 container()->Layout(); |
162 container()->SchedulePaint(); | 162 container()->SchedulePaint(); |
163 } | 163 } |
164 | 164 |
165 } // namespace examples | 165 } // namespace examples |
166 } // namespace views | 166 } // namespace views |
OLD | NEW |