| 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_BASE_TEXT_TEXT_ELIDER_H_ | 5 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ |
| 6 #define UI_BASE_TEXT_TEXT_ELIDER_H_ | 6 #define UI_BASE_TEXT_TEXT_ELIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <unicode/coll.h> | 9 #include <unicode/coll.h> |
| 10 #include <unicode/uchar.h> | 10 #include <unicode/uchar.h> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // we break first at naturally occuring whitespace boundaries, otherwise | 112 // we break first at naturally occuring whitespace boundaries, otherwise |
| 113 // we assume some other mechanism will do this in approximately the same | 113 // we assume some other mechanism will do this in approximately the same |
| 114 // spot after the fact. If the word itself is too long, we always break | 114 // spot after the fact. If the word itself is too long, we always break |
| 115 // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation | 115 // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation |
| 116 // (indicated by an added 3 dots) occurs if the result is still too long. | 116 // (indicated by an added 3 dots) occurs if the result is still too long. |
| 117 // Returns true if the input had to be truncated (and not just reformatted). | 117 // Returns true if the input had to be truncated (and not just reformatted). |
| 118 UI_EXPORT bool ElideRectangleString(const string16& input, size_t max_rows, | 118 UI_EXPORT bool ElideRectangleString(const string16& input, size_t max_rows, |
| 119 size_t max_cols, bool strict, | 119 size_t max_cols, bool strict, |
| 120 string16* output); | 120 string16* output); |
| 121 | 121 |
| 122 // Truncates the string to length characters. This breaks the string at |
| 123 // the first word break before length, adding the horizontal ellipsis |
| 124 // character (unicode character 0x2026) to render ... |
| 125 // The supplied string is returned if the string has length characters or |
| 126 // less. |
| 127 UI_EXPORT string16 TruncateString(const string16& string, size_t length); |
| 122 | 128 |
| 123 } // namespace ui | 129 } // namespace ui |
| 124 | 130 |
| 125 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ | 131 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ |
| OLD | NEW |