Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 // Does the edit have to be merged with previous edit? | 44 // Does the edit have to be merged with previous edit? |
| 45 // This forces the merge even if the previous edit is marked | 45 // This forces the merge even if the previous edit is marked |
| 46 // as DO_NOT_MERGE. | 46 // as DO_NOT_MERGE. |
| 47 MERGE_WITH_PREVIOUS, | 47 MERGE_WITH_PREVIOUS, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace internal | 50 } // namespace internal |
| 51 | 51 |
| 52 typedef std::vector<internal::TextStyleRange*> TextStyleRanges; | 52 typedef std::vector<internal::TextStyleRange*> TextStyleRanges; |
| 53 | 53 |
| 54 // TODO(msw): Divide responsibility with RenderText; revise API and fix impls. | |
| 55 // TODO(msw): Make RenderText a member of TextfieldViewsModel? | |
|
xji
2011/07/01 18:29:44
Maybe make RenderText a member of TextfieldViewsMo
msw
2011/07/01 21:52:15
Yeah, I'm leaning in that direction now, thanks fo
| |
| 56 | |
| 54 // A model that represents a text content for TextfieldViews. | 57 // A model that represents a text content for TextfieldViews. |
| 55 // It supports editing, selection and cursor manipulation. | 58 // It supports editing, selection and cursor manipulation. |
| 56 class TextfieldViewsModel { | 59 class TextfieldViewsModel { |
| 57 public: | 60 public: |
| 58 | 61 |
| 59 // Delegate interface implemented by the textfield view class to provided | 62 // Delegate interface implemented by the textfield view class to provided |
| 60 // additional functionalities required by the model. | 63 // additional functionalities required by the model. |
| 61 class Delegate { | 64 class Delegate { |
| 62 public: | 65 public: |
| 63 // Called when the current composition text is confirmed or cleared. | 66 // Called when the current composition text is confirmed or cleared. |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 // List of style ranges. Elements in the list never overlap each other. | 398 // List of style ranges. Elements in the list never overlap each other. |
| 396 // Elements are not sorted at the time of insertion, and gets sorted | 399 // Elements are not sorted at the time of insertion, and gets sorted |
| 397 // when it's painted (if necessary). | 400 // when it's painted (if necessary). |
| 398 TextStyleRanges style_ranges_; | 401 TextStyleRanges style_ranges_; |
| 399 // True if the style_ranges_ needs to be sorted. | 402 // True if the style_ranges_ needs to be sorted. |
| 400 bool sort_style_ranges_; | 403 bool sort_style_ranges_; |
| 401 | 404 |
| 402 // List of style ranges for composition text. | 405 // List of style ranges for composition text. |
| 403 TextStyleRanges composition_style_ranges_; | 406 TextStyleRanges composition_style_ranges_; |
| 404 | 407 |
| 408 // TODO(msw): Make RenderText a member of TextfieldViewsModel? | |
| 409 //// The stylized text, cursor, selection, and the visual layout model. | |
| 410 //gfx::RenderText* render_text_; | |
| 411 | |
| 405 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 412 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
| 406 }; | 413 }; |
| 407 | 414 |
| 408 } // namespace views | 415 } // namespace views |
| 409 | 416 |
| 410 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 417 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| OLD | NEW |