OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 6 #define UI_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 |
11 #include <string> | 11 #include <string> |
(...skipping 28 matching lines...) Expand all Loading... |
40 class TextfieldController; | 40 class TextfieldController; |
41 | 41 |
42 // This class implements a View that wraps a native text (edit) field. | 42 // This class implements a View that wraps a native text (edit) field. |
43 class VIEWS_EXPORT Textfield : public View { | 43 class VIEWS_EXPORT Textfield : public View { |
44 public: | 44 public: |
45 // The button's class name. | 45 // The button's class name. |
46 static const char kViewClassName[]; | 46 static const char kViewClassName[]; |
47 | 47 |
48 enum StyleFlags { | 48 enum StyleFlags { |
49 STYLE_DEFAULT = 0, | 49 STYLE_DEFAULT = 0, |
50 STYLE_PASSWORD = 1 << 0, | 50 STYLE_OBSCURED = 1 << 0, |
51 STYLE_LOWERCASE = 1 << 1 | 51 STYLE_LOWERCASE = 1 << 1 |
52 }; | 52 }; |
53 | 53 |
54 Textfield(); | 54 Textfield(); |
55 explicit Textfield(StyleFlags style); | 55 explicit Textfield(StyleFlags style); |
56 virtual ~Textfield(); | 56 virtual ~Textfield(); |
57 | 57 |
58 // TextfieldController accessors | 58 // TextfieldController accessors |
59 void SetController(TextfieldController* controller); | 59 void SetController(TextfieldController* controller); |
60 TextfieldController* GetController() const; | 60 TextfieldController* GetController() const; |
61 | 61 |
62 // Gets/Sets whether or not the Textfield is read-only. | 62 // Gets/Sets whether or not the Textfield is read-only. |
63 bool read_only() const { return read_only_; } | 63 bool read_only() const { return read_only_; } |
64 void SetReadOnly(bool read_only); | 64 void SetReadOnly(bool read_only); |
65 | 65 |
66 // Gets/Sets whether or not this Textfield is a password field. | 66 // Gets/sets the STYLE_OBSCURED bit, controlling whether characters in this |
67 // TODO(bryeung): Currently this is only used in | 67 // Textfield are displayed as asterisks/bullets. |
| 68 // TODO(bryeung): Currently SetObscured is only used in |
68 // chrome/browser/chromeos/options/wifi_config_view.cc, which is being | 69 // chrome/browser/chromeos/options/wifi_config_view.cc, which is being |
69 // converted to WebUI. Please remove this when that happens. | 70 // converted to WebUI. Please remove it when that happens. |
70 bool IsPassword() const; | 71 bool IsObscured() const; |
71 void SetPassword(bool password); | 72 void SetObscured(bool obscured); |
72 | 73 |
73 // Gets/Sets the input type of this textfield. | 74 // Gets/Sets the input type of this textfield. |
74 ui::TextInputType GetTextInputType() const; | 75 ui::TextInputType GetTextInputType() const; |
75 void SetTextInputType(ui::TextInputType type); | 76 void SetTextInputType(ui::TextInputType type); |
76 | 77 |
77 // Gets/Sets the text currently displayed in the Textfield. | 78 // Gets/Sets the text currently displayed in the Textfield. |
78 const string16& text() const { return text_; } | 79 const string16& text() const { return text_; } |
79 | 80 |
80 // Sets the text currently displayed in the Textfield. This doesn't | 81 // Sets the text currently displayed in the Textfield. This doesn't |
81 // change the cursor position if the current cursor is within the | 82 // change the cursor position if the current cursor is within the |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 306 |
306 // The input type of this text field. | 307 // The input type of this text field. |
307 ui::TextInputType text_input_type_; | 308 ui::TextInputType text_input_type_; |
308 | 309 |
309 DISALLOW_COPY_AND_ASSIGN(Textfield); | 310 DISALLOW_COPY_AND_ASSIGN(Textfield); |
310 }; | 311 }; |
311 | 312 |
312 } // namespace views | 313 } // namespace views |
313 | 314 |
314 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 315 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |