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 // This file defines utility functions for eliding and formatting UI text. | 5 // This file defines utility functions for eliding and formatting UI text. |
6 | 6 |
7 #ifndef UI_BASE_TEXT_TEXT_ELIDER_H_ | 7 #ifndef UI_GFX_TEXT_ELIDER_H_ |
8 #define UI_BASE_TEXT_TEXT_ELIDER_H_ | 8 #define UI_GFX_TEXT_ELIDER_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "third_party/icu/source/common/unicode/uchar.h" | 15 #include "third_party/icu/source/common/unicode/uchar.h" |
16 #include "third_party/icu/source/i18n/unicode/coll.h" | 16 #include "third_party/icu/source/i18n/unicode/coll.h" |
17 #include "ui/base/ui_export.h" | 17 #include "ui/gfx/gfx_export.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class FilePath; | 22 class FilePath; |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 class Font; | 26 class Font; |
27 class FontList; | 27 class FontList; |
28 } // namespace gfx | |
29 | |
30 namespace ui { | |
31 | 28 |
32 UI_EXPORT extern const char kEllipsis[]; | 29 UI_EXPORT extern const char kEllipsis[]; |
33 UI_EXPORT extern const char16 kEllipsisUTF16[]; | 30 UI_EXPORT extern const char16 kEllipsisUTF16[]; |
34 | 31 |
35 // Elides a well-formed email address (e.g. username@domain.com) to fit into | 32 // Elides a well-formed email address (e.g. username@domain.com) to fit into |
36 // |available_pixel_width| using the specified |font_list|. | 33 // |available_pixel_width| using the specified |font_list|. |
37 // This function guarantees that the string returned will contain at least one | 34 // This function guarantees that the string returned will contain at least one |
38 // character, other than the ellipses, on either side of the '@'. If it is | 35 // character, other than the ellipses, on either side of the '@'. If it is |
39 // impossible to achieve these requirements: only an ellipsis will be returned. | 36 // impossible to achieve these requirements: only an ellipsis will be returned. |
40 // If possible: this elides only the username portion of the |email|. Otherwise, | 37 // If possible: this elides only the username portion of the |email|. Otherwise, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 WordWrapBehavior wrap_behavior, | 220 WordWrapBehavior wrap_behavior, |
224 std::vector<string16>* lines); | 221 std::vector<string16>* lines); |
225 | 222 |
226 // Truncates the string to length characters. This breaks the string at | 223 // Truncates the string to length characters. This breaks the string at |
227 // the first word break before length, adding the horizontal ellipsis | 224 // the first word break before length, adding the horizontal ellipsis |
228 // character (unicode character 0x2026) to render ... | 225 // character (unicode character 0x2026) to render ... |
229 // The supplied string is returned if the string has length characters or | 226 // The supplied string is returned if the string has length characters or |
230 // less. | 227 // less. |
231 UI_EXPORT string16 TruncateString(const string16& string, size_t length); | 228 UI_EXPORT string16 TruncateString(const string16& string, size_t length); |
232 | 229 |
233 } // namespace ui | 230 } // namespace gfx |
234 | 231 |
235 #endif // UI_BASE_TEXT_TEXT_ELIDER_H_ | 232 #endif // UI_GFX_TEXT_ELIDER_H_ |
OLD | NEW |