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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/base/event.h" | 8 #include "ui/base/event.h" |
9 #include "ui/base/range/range.h" | 9 #include "ui/base/range/range.h" |
10 #include "ui/gfx/render_text.h" | 10 #include "ui/gfx/render_text.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } else if (sender == password_) { | 67 } else if (sender == password_) { |
68 PrintStatus("Password [%s]", UTF16ToUTF8(new_contents).c_str()); | 68 PrintStatus("Password [%s]", UTF16ToUTF8(new_contents).c_str()); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 bool TextfieldExample::HandleKeyEvent(Textfield* sender, | 72 bool TextfieldExample::HandleKeyEvent(Textfield* sender, |
73 const ui::KeyEvent& key_event) { | 73 const ui::KeyEvent& key_event) { |
74 return false; | 74 return false; |
75 } | 75 } |
76 | 76 |
77 void TextfieldExample::ButtonPressed(Button* sender, | 77 void TextfieldExample::ButtonPressed(Button* sender, const ui::Event& event) { |
78 const Event& event) { | |
79 if (sender == show_password_) { | 78 if (sender == show_password_) { |
80 PrintStatus("Password [%s]", UTF16ToUTF8(password_->text()).c_str()); | 79 PrintStatus("Password [%s]", UTF16ToUTF8(password_->text()).c_str()); |
81 } else if (sender == clear_all_) { | 80 } else if (sender == clear_all_) { |
82 string16 empty; | 81 string16 empty; |
83 name_->SetText(empty); | 82 name_->SetText(empty); |
84 password_->SetText(empty); | 83 password_->SetText(empty); |
85 } else if (sender == append_) { | 84 } else if (sender == append_) { |
86 name_->AppendText(ASCIIToUTF16("[append]")); | 85 name_->AppendText(ASCIIToUTF16("[append]")); |
87 } else if (sender == set_) { | 86 } else if (sender == set_) { |
88 name_->SetText(ASCIIToUTF16("[set]")); | 87 name_->SetText(ASCIIToUTF16("[set]")); |
(...skipping 17 matching lines...) Expand all Loading... |
106 strike.foreground = SK_ColorRED; | 105 strike.foreground = SK_ColorRED; |
107 strike.range = ui::Range(2 * fifth, 3 * fifth); | 106 strike.range = ui::Range(2 * fifth, 3 * fifth); |
108 name_->ApplyStyleRange(strike); | 107 name_->ApplyStyleRange(strike); |
109 } | 108 } |
110 } | 109 } |
111 } | 110 } |
112 } | 111 } |
113 | 112 |
114 } // namespace examples | 113 } // namespace examples |
115 } // namespace views | 114 } // namespace views |
OLD | NEW |