| OLD | NEW |
| 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Sets the text currently displayed in the Textfield. This doesn't | 82 // Sets the text currently displayed in the Textfield. This doesn't |
| 83 // change the cursor position if the current cursor is within the | 83 // change the cursor position if the current cursor is within the |
| 84 // new text's range, or moves the cursor to the end if the cursor is | 84 // new text's range, or moves the cursor to the end if the cursor is |
| 85 // out of the new text's range. | 85 // out of the new text's range. |
| 86 void SetText(const base::string16& new_text); | 86 void SetText(const base::string16& new_text); |
| 87 | 87 |
| 88 // Appends the given string to the previously-existing text in the field. | 88 // Appends the given string to the previously-existing text in the field. |
| 89 void AppendText(const base::string16& new_text); | 89 void AppendText(const base::string16& new_text); |
| 90 | 90 |
| 91 // Inserts |new_text| at the cursor position, replacing any selected text. | 91 // Inserts |new_text| at the cursor position, replacing any selected text. |
| 92 // This method is used to handle user input via paths Textfield doesn't |
| 93 // normally handle, so it calls UpdateAfterChange() and notifies observers of |
| 94 // changes. |
| 92 void InsertOrReplaceText(const base::string16& new_text); | 95 void InsertOrReplaceText(const base::string16& new_text); |
| 93 | 96 |
| 94 // Returns the text that is currently selected. Call sites should take care to | 97 // Returns the text that is currently selected. Call sites should take care to |
| 95 // not reveal the text for a password textfield. | 98 // not reveal the text for a password textfield. |
| 96 base::string16 GetSelectedText() const; | 99 base::string16 GetSelectedText() const; |
| 97 | 100 |
| 98 // Select the entire text range. If |reversed| is true, the range will end at | 101 // Select the entire text range. If |reversed| is true, the range will end at |
| 99 // the logical beginning of the text; this generally shows the leading portion | 102 // the logical beginning of the text; this generally shows the leading portion |
| 100 // of text that overflows its display area. | 103 // of text that overflows its display area. |
| 101 void SelectAll(bool reversed); | 104 void SelectAll(bool reversed); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 521 |
| 519 // Used to bind callback functions to this object. | 522 // Used to bind callback functions to this object. |
| 520 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 523 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 521 | 524 |
| 522 DISALLOW_COPY_AND_ASSIGN(Textfield); | 525 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 523 }; | 526 }; |
| 524 | 527 |
| 525 } // namespace views | 528 } // namespace views |
| 526 | 529 |
| 527 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 530 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |