| 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/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/gfx/range/range.h" | 9 #include "ui/gfx/range/range.h" |
| 10 #include "ui/gfx/render_text.h" | 10 #include "ui/gfx/render_text.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 append_(NULL), | 30 append_(NULL), |
| 31 set_(NULL), | 31 set_(NULL), |
| 32 set_style_(NULL) { | 32 set_style_(NULL) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 TextfieldExample::~TextfieldExample() { | 35 TextfieldExample::~TextfieldExample() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void TextfieldExample::CreateExampleView(View* container) { | 38 void TextfieldExample::CreateExampleView(View* container) { |
| 39 name_ = new Textfield(); | 39 name_ = new Textfield(); |
| 40 password_ = new Textfield(Textfield::STYLE_OBSCURED); | 40 password_ = new Textfield(); |
| 41 password_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 41 password_->set_placeholder_text(ASCIIToUTF16("password")); | 42 password_->set_placeholder_text(ASCIIToUTF16("password")); |
| 42 read_only_ = new Textfield(); | 43 read_only_ = new Textfield(); |
| 43 read_only_->SetReadOnly(true); | 44 read_only_->SetReadOnly(true); |
| 44 read_only_->SetText(ASCIIToUTF16("read only")); | 45 read_only_->SetText(ASCIIToUTF16("read only")); |
| 45 show_password_ = new LabelButton(this, ASCIIToUTF16("Show password")); | 46 show_password_ = new LabelButton(this, ASCIIToUTF16("Show password")); |
| 46 clear_all_ = new LabelButton(this, ASCIIToUTF16("Clear All")); | 47 clear_all_ = new LabelButton(this, ASCIIToUTF16("Clear All")); |
| 47 append_ = new LabelButton(this, ASCIIToUTF16("Append")); | 48 append_ = new LabelButton(this, ASCIIToUTF16("Append")); |
| 48 set_ = new LabelButton(this, ASCIIToUTF16("Set")); | 49 set_ = new LabelButton(this, ASCIIToUTF16("Set")); |
| 49 set_style_ = new LabelButton(this, ASCIIToUTF16("Set Styles")); | 50 set_style_ = new LabelButton(this, ASCIIToUTF16("Set Styles")); |
| 50 name_->SetController(this); | 51 name_->set_controller(this); |
| 51 password_->SetController(this); | 52 password_->set_controller(this); |
| 52 | 53 |
| 53 GridLayout* layout = new GridLayout(container); | 54 GridLayout* layout = new GridLayout(container); |
| 54 container->SetLayoutManager(layout); | 55 container->SetLayoutManager(layout); |
| 55 | 56 |
| 56 ColumnSet* column_set = layout->AddColumnSet(0); | 57 ColumnSet* column_set = layout->AddColumnSet(0); |
| 57 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, | 58 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, |
| 58 0.2f, GridLayout::USE_PREF, 0, 0); | 59 0.2f, GridLayout::USE_PREF, 0, 0); |
| 59 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, | 60 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, |
| 60 0.8f, GridLayout::USE_PREF, 0, 0); | 61 0.8f, GridLayout::USE_PREF, 0, 0); |
| 61 layout->StartRow(0, 0); | 62 layout->StartRow(0, 0); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); | 135 name_->ApplyStyle(gfx::UNDERLINE, false, small_range); |
| 135 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); | 136 name_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, small_range); |
| 136 name_->ApplyColor(SK_ColorRED, small_range); | 137 name_->ApplyColor(SK_ColorRED, small_range); |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace examples | 143 } // namespace examples |
| 143 } // namespace views | 144 } // namespace views |
| OLD | NEW |