| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "views/view.h" | 24 #include "views/view.h" |
| 25 #include "third_party/skia/include/core/SkColor.h" | 25 #include "third_party/skia/include/core/SkColor.h" |
| 26 | 26 |
| 27 #ifdef UNIT_TEST | 27 #ifdef UNIT_TEST |
| 28 #include "gfx/native_widget_types.h" | 28 #include "gfx/native_widget_types.h" |
| 29 #include "views/controls/textfield/native_textfield_wrapper.h" | 29 #include "views/controls/textfield/native_textfield_wrapper.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace views { | 32 namespace views { |
| 33 | 33 |
| 34 class KeyEvent; |
| 35 |
| 34 class NativeTextfieldWrapper; | 36 class NativeTextfieldWrapper; |
| 35 | 37 |
| 36 // This class implements a ChromeView that wraps a native text (edit) field. | 38 // This class implements a ChromeView that wraps a native text (edit) field. |
| 37 class Textfield : public View { | 39 class Textfield : public View { |
| 38 public: | 40 public: |
| 39 // The button's class name. | 41 // The button's class name. |
| 40 static const char kViewClassName[]; | 42 static const char kViewClassName[]; |
| 41 | 43 |
| 42 // Keystroke provides a platform-dependent way to send keystroke events. | 44 // Keystroke provides a platform-dependent way to send keystroke events. |
| 43 // Cross-platform code can use IsKeystrokeEnter/Escape to check for these | 45 // Cross-platform code can use IsKeystrokeEnter/Escape to check for these |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // changes in the state of a text field. | 89 // changes in the state of a text field. |
| 88 class Controller { | 90 class Controller { |
| 89 public: | 91 public: |
| 90 // This method is called whenever the text in the field changes. | 92 // This method is called whenever the text in the field changes. |
| 91 virtual void ContentsChanged(Textfield* sender, | 93 virtual void ContentsChanged(Textfield* sender, |
| 92 const string16& new_contents) = 0; | 94 const string16& new_contents) = 0; |
| 93 | 95 |
| 94 // This method is called to get notified about keystrokes in the edit. | 96 // This method is called to get notified about keystrokes in the edit. |
| 95 // This method returns true if the message was handled and should not be | 97 // This method returns true if the message was handled and should not be |
| 96 // processed further. If it returns false the processing continues. | 98 // processed further. If it returns false the processing continues. |
| 97 virtual bool HandleKeystroke(Textfield* sender, | 99 virtual bool HandleKeyEvent(Textfield* sender, |
| 98 const Textfield::Keystroke& keystroke) = 0; | 100 const KeyEvent& key_event) = 0; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 enum StyleFlags { | 103 enum StyleFlags { |
| 102 STYLE_DEFAULT = 0, | 104 STYLE_DEFAULT = 0, |
| 103 STYLE_PASSWORD = 1<<0, | 105 STYLE_PASSWORD = 1<<0, |
| 104 STYLE_MULTILINE = 1<<1, | 106 STYLE_MULTILINE = 1<<1, |
| 105 STYLE_LOWERCASE = 1<<2 | 107 STYLE_LOWERCASE = 1<<2 |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 Textfield(); | 110 Textfield(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 317 |
| 316 // Text to display when empty. | 318 // Text to display when empty. |
| 317 string16 text_to_display_when_empty_; | 319 string16 text_to_display_when_empty_; |
| 318 | 320 |
| 319 DISALLOW_COPY_AND_ASSIGN(Textfield); | 321 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 320 }; | 322 }; |
| 321 | 323 |
| 322 } // namespace views | 324 } // namespace views |
| 323 | 325 |
| 324 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 326 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |