| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "views/controls/button/text_button.h" | 10 #include "views/controls/button/text_button.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 virtual void ContentsChanged(Textfield* sender, | 68 virtual void ContentsChanged(Textfield* sender, |
| 69 const string16& new_contents) { | 69 const string16& new_contents) { |
| 70 if (sender == name_) { | 70 if (sender == name_) { |
| 71 PrintStatus(L"Name [%ls]", UTF16ToWideHack(new_contents).c_str()); | 71 PrintStatus(L"Name [%ls]", UTF16ToWideHack(new_contents).c_str()); |
| 72 } else if (sender == password_) { | 72 } else if (sender == password_) { |
| 73 PrintStatus(L"Password [%ls]", UTF16ToWideHack(new_contents).c_str()); | 73 PrintStatus(L"Password [%ls]", UTF16ToWideHack(new_contents).c_str()); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Let the control handle keystrokes. | 77 // Let the control handle keystrokes. |
| 78 virtual bool HandleKeystroke(Textfield* sender, | 78 virtual bool HandleKeyEvent(Textfield* sender, |
| 79 const Textfield::Keystroke& keystroke) { | 79 const views::KeyEvent& key_event) { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // ButtonListner implementation. | 83 // ButtonListner implementation. |
| 84 virtual void ButtonPressed(views::Button* sender, const views::Event& event) { | 84 virtual void ButtonPressed(views::Button* sender, const views::Event& event) { |
| 85 if (sender == show_password_) { | 85 if (sender == show_password_) { |
| 86 PrintStatus(L"Password [%ls]", | 86 PrintStatus(L"Password [%ls]", |
| 87 UTF16ToWideHack(password_->text()).c_str()); | 87 UTF16ToWideHack(password_->text()).c_str()); |
| 88 } else if (sender == clear_all_) { | 88 } else if (sender == clear_all_) { |
| 89 string16 empty; | 89 string16 empty; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 views::TextButton* show_password_; | 102 views::TextButton* show_password_; |
| 103 views::TextButton* clear_all_; | 103 views::TextButton* clear_all_; |
| 104 views::TextButton* append_; | 104 views::TextButton* append_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(TextfieldExample); | 106 DISALLOW_COPY_AND_ASSIGN(TextfieldExample); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace examples | 109 } // namespace examples |
| 110 | 110 |
| 111 #endif // VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ | 111 #endif // VIEWS_EXAMPLES_TEXTFIELD_EXAMPLE_H_ |
| 112 | |
| OLD | NEW |