| 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_VIEWS_MODEL_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // Moves the selection to the specified selection in |selection|. | 137 // Moves the selection to the specified selection in |selection|. |
| 138 // If there is composition text, it will be confirmed, which will update the | 138 // If there is composition text, it will be confirmed, which will update the |
| 139 // selection range, and it overrides the selection_start to which the | 139 // selection range, and it overrides the selection_start to which the |
| 140 // selection will move to. | 140 // selection will move to. |
| 141 bool MoveCursorTo(const gfx::SelectionModel& selection); | 141 bool MoveCursorTo(const gfx::SelectionModel& selection); |
| 142 | 142 |
| 143 // Helper function to call MoveCursorTo on the TextfieldViewsModel. | 143 // Helper function to call MoveCursorTo on the TextfieldViewsModel. |
| 144 bool MoveCursorTo(const gfx::Point& point, bool select); | 144 bool MoveCursorTo(const gfx::Point& point, bool select); |
| 145 | 145 |
| 146 // Returns the bounds of selected text. | |
| 147 std::vector<gfx::Rect> GetSelectionBounds() const; | |
| 148 | |
| 149 // Selection related method | 146 // Selection related method |
| 150 | 147 |
| 151 // Returns the selected text. | 148 // Returns the selected text. |
| 152 string16 GetSelectedText() const; | 149 string16 GetSelectedText() const; |
| 153 | 150 |
| 154 void GetSelectedRange(ui::Range* range) const; | 151 void GetSelectedRange(ui::Range* range) const; |
| 155 | 152 |
| 156 // The current composition text will be confirmed. The | 153 // The current composition text will be confirmed. The |
| 157 // selection starts with the range's start position, | 154 // selection starts with the range's start position, |
| 158 // and ends with the range's end position, therefore | 155 // and ends with the range's end position, therefore |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // 2) new edit is added. (redo history is cleared) | 322 // 2) new edit is added. (redo history is cleared) |
| 326 // 3) redone all undone edits. | 323 // 3) redone all undone edits. |
| 327 EditHistory::iterator current_edit_; | 324 EditHistory::iterator current_edit_; |
| 328 | 325 |
| 329 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 326 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
| 330 }; | 327 }; |
| 331 | 328 |
| 332 } // namespace views | 329 } // namespace views |
| 333 | 330 |
| 334 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 331 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| OLD | NEW |