Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Unified Diff: ui/base/text/text_elider.h

Issue 8917011: Change signature of |ui::ElideText()|. Add a truncate mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura_shell/shell_tooltip_manager.cc ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/text/text_elider.h
===================================================================
--- ui/base/text/text_elider.h (revision 114022)
+++ ui/base/text/text_elider.h (working copy)
@@ -40,13 +40,21 @@
int available_pixel_width,
const std::string& languages);
-// Elides |text| to fit in |available_pixel_width|. If |elide_in_middle| is
-// set the ellipsis is placed in the middle of the string; otherwise it is
-// placed at the end.
+enum ElideBehavior {
+ // Add ellipsis at the end of the string.
+ ELIDE_AT_END,
+ // Add ellipsis in the middle of the string.
+ ELIDE_IN_MIDDLE,
+ // Truncate the end of the string.
+ TRUNCATE_AT_END
+};
+
+// Elides |text| to fit in |available_pixel_width| according to the specified
+// |elide_behavior|.
UI_EXPORT string16 ElideText(const string16& text,
const gfx::Font& font,
int available_pixel_width,
- bool elide_in_middle);
+ ElideBehavior elide_behavior);
// Elide a filename to fit a given pixel width, with an emphasis on not hiding
// the extension unless we have to. If filename contains a path, the path will
« no previous file with comments | « ui/aura_shell/shell_tooltip_manager.cc ('k') | ui/base/text/text_elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698