diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 15:17:11 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 15:17:11 +0000 |
commit | 203aa8f73aad8d63c836da3d00f1ab52c0021d8b (patch) | |
tree | 7a07fa5242f65aaa8522c79259b1e305f2d02de7 /chrome/browser/cocoa/tab_cell.mm | |
parent | f6e0b0e9fcf638713d82b8e0cc5b3fcc9d845fef (diff) | |
download | chromium_src-203aa8f73aad8d63c836da3d00f1ab52c0021d8b.zip chromium_src-203aa8f73aad8d63c836da3d00f1ab52c0021d8b.tar.gz chromium_src-203aa8f73aad8d63c836da3d00f1ab52c0021d8b.tar.bz2 |
Updates to clean up default theme and add hover states.
Patch by Cole.
BUG=http://crbug.com/18573;http://crbug.com/18574;http://crbug.com/18360;http://crbug.com/18438
TEST=none
Review URL: http://codereview.chromium.org/165499
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_cell.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_cell.mm | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/tab_cell.mm b/chrome/browser/cocoa/tab_cell.mm index 326f1f7..6823e3b 100644 --- a/chrome/browser/cocoa/tab_cell.mm +++ b/chrome/browser/cocoa/tab_cell.mm @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import "base/scoped_nsobject.h" #import "chrome/browser/cocoa/tab_cell.h" #import "third_party/GTM/AppKit/GTMTheme.h" #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" + @implementation TabCell - (id)initTextCell:(NSString *)aString { @@ -18,7 +20,7 @@ - (NSBackgroundStyle)interiorBackgroundStyle { return [[[self controlView] gtm_theme] - interiorBackgroundStyleForStyle:GTMThemeStyleTabBarSelected + interiorBackgroundStyleForStyle:GTMThemeStyleToolBar state:GTMThemeStateActiveWindow]; } @@ -37,6 +39,34 @@ inView:controlView]; } +- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { + GTMTheme* theme = [[self controlView] gtm_theme]; + NSColor* textColor = [theme textColorForStyle:GTMThemeStyleToolBar + state:[self isHighlighted]]; + + scoped_nsobject<NSShadow> textShadow([[NSShadow alloc] init]); + [textShadow setShadowBlurRadius:0.0f]; + [textShadow setShadowColor:[textColor gtm_legibleTextColor]]; + [textShadow setShadowOffset:NSMakeSize(0.0f, -1.0f)]; + + NSDictionary* attributes = + [NSDictionary dictionaryWithObjectsAndKeys: + [self font], NSFontAttributeName, + textColor, NSForegroundColorAttributeName, + textShadow.get(), NSShadowAttributeName, + nil]; + + [[self title] drawInRect:[self titleRectForBounds:cellFrame] + withAttributes:attributes]; + + NSRect imageBounds = NSZeroRect; + imageBounds.size = [[self image] size]; + [[self image] drawInRect:[self imageRectForBounds:cellFrame] + fromRect:imageBounds + operation:NSCompositeSourceOver + fraction:1.0]; +} + - (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView *)controlView { |