| 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_VIEWS_MODEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 gfx::RenderText* render_text() { return render_text_.get(); } | 76 gfx::RenderText* render_text() { return render_text_.get(); } |
| 77 | 77 |
| 78 // Inserts given |text| at the current cursor position. | 78 // Inserts given |text| at the current cursor position. |
| 79 // The current composition text will be cleared. | 79 // The current composition text will be cleared. |
| 80 void InsertText(const base::string16& text) { | 80 void InsertText(const base::string16& text) { |
| 81 InsertTextInternal(text, false); | 81 InsertTextInternal(text, false); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Inserts a character at the current cursor position. | 84 // Inserts a character at the current cursor position. |
| 85 void InsertChar(char16 c) { | 85 void InsertChar(base::char16 c) { |
| 86 InsertTextInternal(base::string16(&c, 1), true); | 86 InsertTextInternal(base::string16(&c, 1), true); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Replaces characters at the current position with characters in given text. | 89 // Replaces characters at the current position with characters in given text. |
| 90 // The current composition text will be cleared. | 90 // The current composition text will be cleared. |
| 91 void ReplaceText(const base::string16& text) { | 91 void ReplaceText(const base::string16& text) { |
| 92 ReplaceTextInternal(text, false); | 92 ReplaceTextInternal(text, false); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Replaces the char at the current position with given character. | 95 // Replaces the char at the current position with given character. |
| 96 void ReplaceChar(char16 c) { | 96 void ReplaceChar(base::char16 c) { |
| 97 ReplaceTextInternal(base::string16(&c, 1), true); | 97 ReplaceTextInternal(base::string16(&c, 1), true); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Appends the text. | 100 // Appends the text. |
| 101 // The current composition text will be confirmed. | 101 // The current composition text will be confirmed. |
| 102 void Append(const base::string16& text); | 102 void Append(const base::string16& text); |
| 103 | 103 |
| 104 // Deletes the first character after the current cursor position (as if, the | 104 // Deletes the first character after the current cursor position (as if, the |
| 105 // the user has pressed delete key in the textfield). Returns true if | 105 // the user has pressed delete key in the textfield). Returns true if |
| 106 // the deletion is successful. | 106 // the deletion is successful. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // 2) new edit is added. (redo history is cleared) | 304 // 2) new edit is added. (redo history is cleared) |
| 305 // 3) redone all undone edits. | 305 // 3) redone all undone edits. |
| 306 EditHistory::iterator current_edit_; | 306 EditHistory::iterator current_edit_; |
| 307 | 307 |
| 308 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 308 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 } // namespace views | 311 } // namespace views |
| 312 | 312 |
| 313 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 313 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| OLD | NEW |