OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ | 5 #ifndef VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ |
6 #define VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ | 6 #define VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ |
7 | 7 |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "views/controls/button/text_button.h" | 9 #include "views/controls/button/text_button.h" |
10 #include "views/controls/label.h" | 10 #include "views/controls/label.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual ~TextfieldExample() {} | 26 virtual ~TextfieldExample() {} |
27 | 27 |
28 virtual std::wstring GetExampleTitle() { | 28 virtual std::wstring GetExampleTitle() { |
29 return L"Textfield"; | 29 return L"Textfield"; |
30 } | 30 } |
31 | 31 |
32 virtual void CreateExampleView(views::View* container) { | 32 virtual void CreateExampleView(views::View* container) { |
33 name_ = new Textfield(); | 33 name_ = new Textfield(); |
34 password_ = new Textfield(Textfield::STYLE_PASSWORD); | 34 password_ = new Textfield(Textfield::STYLE_PASSWORD); |
| 35 password_->set_text_to_display_when_empty(ASCIIToUTF16("password")); |
35 show_password_ = new views::TextButton(this, L"Show password"); | 36 show_password_ = new views::TextButton(this, L"Show password"); |
36 clear_all_ = new views::TextButton(this, L"Clear All"); | 37 clear_all_ = new views::TextButton(this, L"Clear All"); |
37 append_ = new views::TextButton(this, L"Append"); | 38 append_ = new views::TextButton(this, L"Append"); |
38 name_->SetController(this); | 39 name_->SetController(this); |
39 password_->SetController(this); | 40 password_->SetController(this); |
40 | 41 |
41 views::GridLayout* layout = new views::GridLayout(container); | 42 views::GridLayout* layout = new views::GridLayout(container); |
42 container->SetLayoutManager(layout); | 43 container->SetLayoutManager(layout); |
43 | 44 |
44 views::ColumnSet* column_set = layout->AddColumnSet(0); | 45 views::ColumnSet* column_set = layout->AddColumnSet(0); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 views::TextButton* clear_all_; | 102 views::TextButton* clear_all_; |
102 views::TextButton* append_; | 103 views::TextButton* append_; |
103 | 104 |
104 DISALLOW_COPY_AND_ASSIGN(TextfieldExample); | 105 DISALLOW_COPY_AND_ASSIGN(TextfieldExample); |
105 }; | 106 }; |
106 | 107 |
107 } // namespace examples | 108 } // namespace examples |
108 | 109 |
109 #endif // VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ | 110 #endif // VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ |
110 | 111 |
OLD | NEW |