Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 // This class implements a View that wraps a native text (edit) field. | 44 // This class implements a View that wraps a native text (edit) field. |
| 45 class VIEWS_EXPORT Textfield : public View { | 45 class VIEWS_EXPORT Textfield : public View { |
| 46 public: | 46 public: |
| 47 // The button's class name. | 47 // The button's class name. |
| 48 static const char kViewClassName[]; | 48 static const char kViewClassName[]; |
| 49 | 49 |
| 50 enum StyleFlags { | 50 enum StyleFlags { |
| 51 STYLE_DEFAULT = 0, | 51 STYLE_DEFAULT = 0, |
| 52 STYLE_PASSWORD = 1 << 0, | 52 STYLE_PASSWORD = 1 << 0, |
| 53 STYLE_LOWERCASE = 1 << 1 | 53 STYLE_LOWERCASE = 1 << 1, |
| 54 STYLE_URL = 1 << 2 | |
|
oshima
2011/09/02 20:54:02
I'm a bit worried about expanding this for input t
| |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 Textfield(); | 57 Textfield(); |
| 57 explicit Textfield(StyleFlags style); | 58 explicit Textfield(StyleFlags style); |
| 58 virtual ~Textfield(); | 59 virtual ~Textfield(); |
| 59 | 60 |
| 60 // TextfieldController accessors | 61 // TextfieldController accessors |
| 61 void SetController(TextfieldController* controller); | 62 void SetController(TextfieldController* controller); |
| 62 TextfieldController* GetController() const; | 63 TextfieldController* GetController() const; |
| 63 | 64 |
| 64 // Gets/Sets whether or not the Textfield is read-only. | 65 // Gets/Sets whether or not the Textfield is read-only. |
| 65 bool read_only() const { return read_only_; } | 66 bool read_only() const { return read_only_; } |
| 66 void SetReadOnly(bool read_only); | 67 void SetReadOnly(bool read_only); |
| 67 | 68 |
| 68 // Gets/Sets whether or not this Textfield is a password field. | 69 // Gets/Sets whether or not this Textfield is a password field. |
| 69 bool IsPassword() const; | 70 bool IsPassword() const; |
| 70 void SetPassword(bool password); | 71 void SetPassword(bool password); |
| 71 | 72 |
| 73 // Gets/Sets whether or not this Textfield is a URL field. | |
| 74 bool IsUrl() const; | |
| 75 void SetUrl(bool password); | |
| 76 | |
| 72 // Gets/Sets the text currently displayed in the Textfield. | 77 // Gets/Sets the text currently displayed in the Textfield. |
| 73 const string16& text() const { return text_; } | 78 const string16& text() const { return text_; } |
| 74 | 79 |
| 75 // Sets the text currently displayed in the Textfield. This doesn't | 80 // Sets the text currently displayed in the Textfield. This doesn't |
| 76 // change the cursor position if the current cursor is within the | 81 // change the cursor position if the current cursor is within the |
| 77 // new text's range, or moves the cursor to the end if the cursor is | 82 // new text's range, or moves the cursor to the end if the cursor is |
| 78 // out of the new text's range. | 83 // out of the new text's range. |
| 79 void SetText(const string16& text); | 84 void SetText(const string16& text); |
| 80 | 85 |
| 81 // Appends the given string to the previously-existing text in the field. | 86 // Appends the given string to the previously-existing text in the field. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 | 295 |
| 291 // The accessible name of the text field. | 296 // The accessible name of the text field. |
| 292 string16 accessible_name_; | 297 string16 accessible_name_; |
| 293 | 298 |
| 294 DISALLOW_COPY_AND_ASSIGN(Textfield); | 299 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 295 }; | 300 }; |
| 296 | 301 |
| 297 } // namespace views | 302 } // namespace views |
| 298 | 303 |
| 299 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 304 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |