diff options
Diffstat (limited to 'ui/base/text/text_elider.h')
-rw-r--r-- | ui/base/text/text_elider.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/ui/base/text/text_elider.h b/ui/base/text/text_elider.h index 5dd3dc5..c87011f 100644 --- a/ui/base/text/text_elider.h +++ b/ui/base/text/text_elider.h @@ -12,13 +12,14 @@ #include "base/basictypes.h" #include "base/string16.h" #include "ui/gfx/font.h" +#include "ui/ui_api.h" class FilePath; class GURL; namespace ui { -extern const char kEllipsis[]; +UI_API extern const char kEllipsis[]; // This function takes a GURL object and elides it. It returns a string // which composed of parts from subdomain, domain, path, filename and query. @@ -33,18 +34,18 @@ extern const char kEllipsis[]; // as an LTR string (using base::i18n::WrapStringWithLTRFormatting()) so that it // is displayed properly in an RTL context. Please refer to // http://crbug.com/6487 for more information. -string16 ElideUrl(const GURL& url, - const gfx::Font& font, - int available_pixel_width, - const std::string& languages); +UI_API string16 ElideUrl(const GURL& url, + const gfx::Font& font, + 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. -string16 ElideText(const string16& text, - const gfx::Font& font, - int available_pixel_width, - bool elide_in_middle); +UI_API string16 ElideText(const string16& text, + const gfx::Font& font, + int available_pixel_width, + bool elide_in_middle); // 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 @@ -52,16 +53,16 @@ string16 ElideText(const string16& text, // filename is forced to have LTR directionality, which means that in RTL UI // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and // PDF (Pop Directional Formatting) mark. -string16 ElideFilename(const FilePath& filename, - const gfx::Font& font, - int available_pixel_width); +UI_API string16 ElideFilename(const FilePath& filename, + const gfx::Font& font, + int available_pixel_width); // SortedDisplayURL maintains a string from a URL suitable for display to the // use. SortedDisplayURL also provides a function used for comparing two // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. // // SortedDisplayURL is relatively cheap and supports value semantics. -class SortedDisplayURL { +class UI_API SortedDisplayURL { public: SortedDisplayURL(const GURL& url, const std::string& languages); SortedDisplayURL(); @@ -102,7 +103,8 @@ class SortedDisplayURL { // puts "Hell...Tom" in str and returns true. // TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly. // TODO(tsepez): Doesn't handle bidi properly. -bool ElideString(const string16& input, int max_len, string16* output); +UI_API bool ElideString(const string16& input, int max_len, + string16* output); // Reformat |input| into |output| so that it fits into a |max_rows| by // |max_cols| rectangle of characters. Input newlines are respected, but @@ -113,8 +115,9 @@ bool ElideString(const string16& input, int max_len, string16* output); // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation // (indicated by an added 3 dots) occurs if the result is still too long. // Returns true if the input had to be truncated (and not just reformatted). -bool ElideRectangleString(const string16& input, size_t max_rows, - size_t max_cols, bool strict, string16* output); +UI_API bool ElideRectangleString(const string16& input, size_t max_rows, + size_t max_cols, bool strict, + string16* output); } // namespace ui |