summaryrefslogtreecommitdiffstats
path: root/ui/gfx/canvas_skia.h
diff options
context:
space:
mode:
authorsail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 06:07:56 +0000
committersail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 06:07:56 +0000
commit189b01cd199726bd100fcd66fcbaee4f898c04a4 (patch)
tree0435b8dbf4af0444b47a8d3368eca7cf67302175 /ui/gfx/canvas_skia.h
parent429f687ce523db9114bd6284865ecf4d0737322e (diff)
downloadchromium_src-189b01cd199726bd100fcd66fcbaee4f898c04a4.zip
chromium_src-189b01cd199726bd100fcd66fcbaee4f898c04a4.tar.gz
chromium_src-189b01cd199726bd100fcd66fcbaee4f898c04a4.tar.bz2
Fade tab titles
This change fades tab titles instead of truncating them with a "...". I tried to copy the Mac implemenation from here: http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/AppKit/GTMFadeTruncatingTextFieldCell.m but my version is not as good since I couldn't figure out how to draw text on a transparent background. BUG=69301 TEST=Ran Chromium and verified that things looked ok. Review URL: http://codereview.chromium.org/6695043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/canvas_skia.h')
-rw-r--r--ui/gfx/canvas_skia.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/gfx/canvas_skia.h b/ui/gfx/canvas_skia.h
index 9516e8a3..4811a81 100644
--- a/ui/gfx/canvas_skia.h
+++ b/ui/gfx/canvas_skia.h
@@ -37,6 +37,12 @@ class Canvas;
class CanvasSkia : public skia::PlatformCanvas,
public Canvas {
public:
+ enum TruncateFadeMode {
+ TruncateFadeTail,
+ TruncateFadeHead,
+ TruncateFadeHeadAndTail,
+ };
+
// Creates an empty Canvas. Callers must use initialize before using the
// canvas.
CanvasSkia();
@@ -132,6 +138,19 @@ class CanvasSkia : public skia::PlatformCanvas,
const SkColor& color,
int x, int y, int w, int h,
int flags);
+#if defined(OS_WIN)
+ // Draws the given string with the beginning and/or the end using a fade
+ // gradient. When truncating the head
+ // |desired_characters_to_truncate_from_head| specifies the maximum number of
+ // characters that can be truncated.
+ virtual void DrawFadeTruncatingString(
+ const string16& text,
+ TruncateFadeMode truncate_mode,
+ size_t desired_characters_to_truncate_from_head,
+ const gfx::Font& font,
+ const SkColor& color,
+ const gfx::Rect& display_rect);
+#endif
virtual void DrawFocusRect(int x, int y, int width, int height);
virtual void TileImageInt(const SkBitmap& bitmap, int x, int y, int w, int h);
virtual void TileImageInt(const SkBitmap& bitmap,