diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 20:20:51 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 20:20:51 +0000 |
commit | 71f4c1dc80499f254b9f06e510002ff3b43a87e0 (patch) | |
tree | 6eeb8693a47e7990e5bb3995812e2fa641bcda09 /chrome/browser/cocoa/status_bubble_mac.mm | |
parent | 7cc6c0ba59df63f9f084f8cdfc695fa7b4ae1823 (diff) | |
download | chromium_src-71f4c1dc80499f254b9f06e510002ff3b43a87e0.zip chromium_src-71f4c1dc80499f254b9f06e510002ff3b43a87e0.tar.gz chromium_src-71f4c1dc80499f254b9f06e510002ff3b43a87e0.tar.bz2 |
Updates to clean up default theme and add hover states.
Path 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@24512 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: |