| 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 UI_GFX_RENDER_TEXT_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
| 6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class RenderTextTest; | 35 class RenderTextTest; |
| 36 | 36 |
| 37 // A visual style applicable to a range of text. | 37 // A visual style applicable to a range of text. |
| 38 struct UI_EXPORT StyleRange { | 38 struct UI_EXPORT StyleRange { |
| 39 StyleRange(); | 39 StyleRange(); |
| 40 | 40 |
| 41 Font font; | 41 Font font; |
| 42 SkColor foreground; | 42 SkColor foreground; |
| 43 bool strike; | 43 bool strike; |
| 44 bool underline; | 44 bool underline; |
| 45 bool password; // make all glyphs look the same (password mode) |
| 45 ui::Range range; | 46 ui::Range range; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 typedef std::vector<StyleRange> StyleRanges; | 49 typedef std::vector<StyleRange> StyleRanges; |
| 49 | 50 |
| 50 // TODO(msw): Distinguish between logical character stops and glyph stops? | 51 // TODO(msw): Distinguish between logical character stops and glyph stops? |
| 51 // CHARACTER_BREAK cursor movements should stop at neighboring characters. | 52 // CHARACTER_BREAK cursor movements should stop at neighboring characters. |
| 52 // WORD_BREAK cursor movements should stop at the nearest word boundaries. | 53 // WORD_BREAK cursor movements should stop at the nearest word boundaries. |
| 53 // LINE_BREAK cursor movements should stop at the text ends as shown on screen. | 54 // LINE_BREAK cursor movements should stop at the text ends as shown on screen. |
| 54 enum BreakType { | 55 enum BreakType { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 66 class UI_EXPORT RenderText { | 67 class UI_EXPORT RenderText { |
| 67 public: | 68 public: |
| 68 virtual ~RenderText(); | 69 virtual ~RenderText(); |
| 69 | 70 |
| 70 // Creates a platform-specific RenderText instance. | 71 // Creates a platform-specific RenderText instance. |
| 71 static RenderText* CreateRenderText(); | 72 static RenderText* CreateRenderText(); |
| 72 | 73 |
| 73 const string16& text() const { return text_; } | 74 const string16& text() const { return text_; } |
| 74 void SetText(const string16& text); | 75 void SetText(const string16& text); |
| 75 | 76 |
| 77 // Like text() except that regions with the password property set are |
| 78 // replaced with asterisks or bullets. |
| 79 string16 GetCensoredText() const; |
| 80 |
| 76 const SelectionModel& selection_model() const { return selection_model_; } | 81 const SelectionModel& selection_model() const { return selection_model_; } |
| 77 | 82 |
| 78 bool cursor_visible() const { return cursor_visible_; } | 83 bool cursor_visible() const { return cursor_visible_; } |
| 79 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } | 84 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } |
| 80 | 85 |
| 81 bool insert_mode() const { return insert_mode_; } | 86 bool insert_mode() const { return insert_mode_; } |
| 82 void ToggleInsertMode(); | 87 void ToggleInsertMode(); |
| 83 | 88 |
| 84 bool focused() const { return focused_; } | 89 bool focused() const { return focused_; } |
| 85 void set_focused(bool focused) { focused_ = focused; } | 90 void set_focused(bool focused) { focused_ = focused; } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // The cached bounds and offset are invalidated by changes to the cursor, | 310 // The cached bounds and offset are invalidated by changes to the cursor, |
| 306 // selection, font, and other operations that adjust the visible text bounds. | 311 // selection, font, and other operations that adjust the visible text bounds. |
| 307 bool cached_bounds_and_offset_valid_; | 312 bool cached_bounds_and_offset_valid_; |
| 308 | 313 |
| 309 DISALLOW_COPY_AND_ASSIGN(RenderText); | 314 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 310 }; | 315 }; |
| 311 | 316 |
| 312 } // namespace gfx | 317 } // namespace gfx |
| 313 | 318 |
| 314 #endif // UI_GFX_RENDER_TEXT_H_ | 319 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |