diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 23:51:17 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 23:51:17 +0000 |
commit | 9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c (patch) | |
tree | 06f68e313e76256c0245f7082dba8e6b23d7569e /chrome/browser/cocoa/status_bubble_mac.mm | |
parent | 15123a7ca58102854802075f6efb3c5e5cc23e23 (diff) | |
download | chromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.zip chromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.tar.gz chromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.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@24700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/status_bubble_mac.mm')
-rw-r--r-- | chrome/browser/cocoa/status_bubble_mac.mm | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm index 67b920b..a415421 100644 --- a/chrome/browser/cocoa/status_bubble_mac.mm +++ b/chrome/browser/cocoa/status_bubble_mac.mm @@ -9,6 +9,8 @@ #include "base/sys_string_conversions.h" #include "googleurl/src/gurl.h" #import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h" +#import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" +#import "third_party/GTM/AppKit/GTMTheme.h" namespace { @@ -49,10 +51,12 @@ enum BubbleStyle { @private NSString* content_; BubbleStyle style_; + NSWindow* parent_; } - (void)setContent:(NSString*)content; - (void)setStyle:(BubbleStyle)style; +- (void)setParent:(NSWindow*)parent; - (NSFont*)font; @end @@ -220,6 +224,8 @@ void StatusBubbleMac::Create() { StatusBubbleViewCocoa* view = [[[StatusBubbleViewCocoa alloc] initWithFrame:NSZeroRect] autorelease]; + [view setParent:parent_]; + [window_ setContentView:view]; [parent_ addChildWindow:window_ ordered:NSWindowAbove]; @@ -263,6 +269,16 @@ void StatusBubbleMac::FadeOut() { [self setNeedsDisplay:YES]; } +- (void)setParent:(NSWindow*)parent { + [parent_ autorelease]; + parent_ = [parent retain]; + [self setNeedsDisplay:YES]; +} + +- (GTMTheme*)gtm_theme { + return [parent_ gtm_theme]; +} + - (NSFont*)font { return [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; } @@ -300,13 +316,24 @@ void StatusBubbleMac::FadeOut() { // Background / Edge NSRect bounds = [self bounds]; + bounds = NSInsetRect(bounds, 0.5, 0.5); NSBezierPath *border = [NSBezierPath gtm_bezierPathWithRoundRect:bounds topLeftCornerRadius:tl_radius topRightCornerRadius:tr_radius bottomLeftCornerRadius:bl_radius bottomRightCornerRadius:br_radius]; - [[NSColor colorWithDeviceWhite:kWindowFill alpha:1.0f] set]; + NSColor* color = + [[self gtm_theme] backgroundColorForStyle:GTMThemeStyleToolBar + state:GTMThemeStateActiveWindow]; + + // workaround for default theme + // TODO(alcor) next GTM update return nil for background color if not set; + if ([color isEqual:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]]) + color = nil; + if (!color) + color = [NSColor colorWithCalibratedWhite:0.9 alpha:1.0]; + [color set]; [border fill]; border = [NSBezierPath gtm_bezierPathWithRoundRect:bounds @@ -319,11 +346,11 @@ void StatusBubbleMac::FadeOut() { [border stroke]; // Text - + NSColor* textColor = [color gtm_legibleTextColor]; NSFont* textFont = [self font]; NSShadow* textShadow = [[[NSShadow alloc] init] autorelease]; - [textShadow setShadowBlurRadius:1.5f]; - [textShadow setShadowColor:[NSColor whiteColor]]; + [textShadow setShadowBlurRadius:0.0f]; + [textShadow setShadowColor:[textColor gtm_legibleTextColor]]; [textShadow setShadowOffset:NSMakeSize(0.0f, -1.0f)]; NSDictionary* textDict = [NSDictionary dictionaryWithObjectsAndKeys: |