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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <vector> | 10 #include <vector> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 178 |
179 // Cuts the currently selected text and puts it to clipboard. Returns true | 179 // Cuts the currently selected text and puts it to clipboard. Returns true |
180 // if text has changed after cutting. | 180 // if text has changed after cutting. |
181 bool Cut(); | 181 bool Cut(); |
182 | 182 |
183 // Copies the currently selected text and puts it to clipboard. Returns true | 183 // Copies the currently selected text and puts it to clipboard. Returns true |
184 // if something was copied to the clipboard. | 184 // if something was copied to the clipboard. |
185 bool Copy(); | 185 bool Copy(); |
186 | 186 |
187 // Pastes text from the clipboard at current cursor position. Returns true | 187 // Pastes text from the clipboard at current cursor position. Returns true |
188 // if text has changed after pasting. | 188 // if any text is pasted. |
xji
2012/04/11 04:06:35
thanks for making the change.
| |
189 bool Paste(); | 189 bool Paste(); |
190 | 190 |
191 // Tells if any text is selected, even if the selection is in composition | 191 // Tells if any text is selected, even if the selection is in composition |
192 // text. | 192 // text. |
193 bool HasSelection() const; | 193 bool HasSelection() const; |
194 | 194 |
195 // Deletes the selected text. This method shouldn't be called with | 195 // Deletes the selected text. This method shouldn't be called with |
196 // composition text. | 196 // composition text. |
197 void DeleteSelection(); | 197 void DeleteSelection(); |
198 | 198 |
199 // Deletes the selected text (if any) and insert text at given | 199 // Deletes the selected text (if any) and insert text at given |
200 // position. | 200 // position. |
201 void DeleteSelectionAndInsertTextAt( | 201 void DeleteSelectionAndInsertTextAt( |
202 const string16& text, size_t position); | 202 const string16& text, size_t position); |
203 | 203 |
204 // Retrieves the text content in a given range. | 204 // Retrieves the text content in a given range. |
205 string16 GetTextFromRange(const ui::Range& range) const; | 205 string16 GetTextFromRange(const ui::Range& range) const; |
206 | 206 |
207 // Retrieves the range containing all text in the model. | 207 // Retrieves the range containing all text in the model. |
208 void GetTextRange(ui::Range* range) const; | 208 void GetTextRange(ui::Range* range) const; |
209 | 209 |
210 // Sets composition text and attributes. If there is composition text already, | 210 // Sets composition text and attributes. If there is composition text already, |
211 // it’ll be replaced by the new one. Otherwise, current selection will be | 211 // it'll be replaced by the new one. Otherwise, current selection will be |
212 // replaced. If there is no selection, the composition text will be inserted | 212 // replaced. If there is no selection, the composition text will be inserted |
213 // at the insertion point. | 213 // at the insertion point. |
214 // Any changes to the model except text insertion will confirm the current | 214 // Any changes to the model except text insertion will confirm the current |
215 // composition text. | 215 // composition text. |
216 void SetCompositionText(const ui::CompositionText& composition); | 216 void SetCompositionText(const ui::CompositionText& composition); |
217 | 217 |
218 // Converts current composition text into final content. | 218 // Converts current composition text into final content. |
219 void ConfirmCompositionText(); | 219 void ConfirmCompositionText(); |
220 | 220 |
221 // Removes current composition text. | 221 // Removes current composition text. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 // 2) new edit is added. (redo history is cleared) | 305 // 2) new edit is added. (redo history is cleared) |
306 // 3) redone all undone edits. | 306 // 3) redone all undone edits. |
307 EditHistory::iterator current_edit_; | 307 EditHistory::iterator current_edit_; |
308 | 308 |
309 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 309 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
310 }; | 310 }; |
311 | 311 |
312 } // namespace views | 312 } // namespace views |
313 | 313 |
314 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 314 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
OLD | NEW |