| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void SetReadOnly(bool read_only); | 67 void SetReadOnly(bool read_only); |
| 68 | 68 |
| 69 // Gets/Sets whether or not this Textfield is a password field. | 69 // Gets/Sets whether or not this Textfield is a password field. |
| 70 bool IsPassword() const; | 70 bool IsPassword() const; |
| 71 void SetPassword(bool password); | 71 void SetPassword(bool password); |
| 72 | 72 |
| 73 // Whether the text field is multi-line or not, must be set when the text | 73 // Whether the text field is multi-line or not, must be set when the text |
| 74 // field is created, using StyleFlags. | 74 // field is created, using StyleFlags. |
| 75 bool IsMultiLine() const; | 75 bool IsMultiLine() const; |
| 76 | 76 |
| 77 // Gets/Sets the text currently displayed in the Textfield. | 77 // Gets the text currently displayed in the Textfield. |
| 78 const string16& text() const { return text_; } | 78 const string16& text() const { return text_; } |
| 79 |
| 80 // Sets the text currently displayed in the Textfield. This doesn't |
| 81 // change the cursor position if the current cursor is within the |
| 82 // new text's range, or moves the cursor to the end if the cursor is |
| 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. |
| 82 void AppendText(const string16& text); | 87 void AppendText(const string16& text); |
| 83 | 88 |
| 84 // Returns the text that is currently selected. | 89 // Returns the text that is currently selected. |
| 85 string16 GetSelectedText() const; | 90 string16 GetSelectedText() const; |
| 86 | 91 |
| 87 // Causes the edit field to be fully selected. | 92 // Causes the edit field to be fully selected. |
| 88 void SelectAll(); | 93 void SelectAll(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // be ignored if range is empty or invalid. This is | 207 // be ignored if range is empty or invalid. This is |
| 203 // views-implementation only and has to be called after the wrapper | 208 // views-implementation only and has to be called after the wrapper |
| 204 // is created. | 209 // is created. |
| 205 void ApplyTextStyle(const TextStyle* style, const ui::Range& range); | 210 void ApplyTextStyle(const TextStyle* style, const ui::Range& range); |
| 206 | 211 |
| 207 // Clears All TextStyles. | 212 // Clears All TextStyles. |
| 208 // This is views-implementation only and has to be called after the | 213 // This is views-implementation only and has to be called after the |
| 209 // wrapper is created. | 214 // wrapper is created. |
| 210 void ClearAllTextStyles(); | 215 void ClearAllTextStyles(); |
| 211 | 216 |
| 217 // Clears Edit history. |
| 218 void ClearEditHistory(); |
| 219 |
| 212 // Set the accessible name of the text field. | 220 // Set the accessible name of the text field. |
| 213 void SetAccessibleName(const string16& name); | 221 void SetAccessibleName(const string16& name); |
| 214 | 222 |
| 215 #ifdef UNIT_TEST | 223 #ifdef UNIT_TEST |
| 216 gfx::NativeView GetTestingHandle() const { | 224 gfx::NativeView GetTestingHandle() const { |
| 217 return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL; | 225 return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL; |
| 218 } | 226 } |
| 219 NativeTextfieldWrapper* native_wrapper() const { | 227 NativeTextfieldWrapper* native_wrapper() const { |
| 220 return native_wrapper_; | 228 return native_wrapper_; |
| 221 } | 229 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 313 |
| 306 // The accessible name of the text field. | 314 // The accessible name of the text field. |
| 307 string16 accessible_name_; | 315 string16 accessible_name_; |
| 308 | 316 |
| 309 DISALLOW_COPY_AND_ASSIGN(Textfield); | 317 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 310 }; | 318 }; |
| 311 | 319 |
| 312 } // namespace views | 320 } // namespace views |
| 313 | 321 |
| 314 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 322 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |