diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 10:14:17 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 10:14:17 +0000 |
commit | 49008b7d77d37804f3a5ffda1c743531d83ba038 (patch) | |
tree | 47c17189723869d59ff4e655144118605b68dcf5 /chrome/browser/cocoa/infobar_gradient_view.mm | |
parent | 8b5dd3eedbdee7dc8c900a904a47caa943c55b74 (diff) | |
download | chromium_src-49008b7d77d37804f3a5ffda1c743531d83ba038.zip chromium_src-49008b7d77d37804f3a5ffda1c743531d83ba038.tar.gz chromium_src-49008b7d77d37804f3a5ffda1c743531d83ba038.tar.bz2 |
Allow gradient color override.
Translate infobars are blue, allow override.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/583010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/infobar_gradient_view.mm')
-rw-r--r-- | chrome/browser/cocoa/infobar_gradient_view.mm | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/infobar_gradient_view.mm b/chrome/browser/cocoa/infobar_gradient_view.mm index cdd648b..a5422c5 100644 --- a/chrome/browser/cocoa/infobar_gradient_view.mm +++ b/chrome/browser/cocoa/infobar_gradient_view.mm @@ -11,26 +11,44 @@ const double kBackgroundColorBottom[3] = {250.0 / 255.0, 230.0 / 255.0, 145.0 / 255.0}; @implementation InfoBarGradientView + +- (id)initWithFrame:(NSRect)frameRect { + if ((self = [super initWithFrame:frameRect])) { + NSColor* startingColor = + [NSColor colorWithCalibratedRed:kBackgroundColorTop[0] + green:kBackgroundColorTop[1] + blue:kBackgroundColorTop[2] + alpha:1.0]; + NSColor* endingColor = + [NSColor colorWithCalibratedRed:kBackgroundColorBottom[0] + green:kBackgroundColorBottom[1] + blue:kBackgroundColorBottom[2] + alpha:1.0]; + gradient_ = + [[NSGradient alloc] initWithStartingColor:startingColor + endingColor:endingColor]; + } + return self; +} + +- (void)dealloc { + [gradient_ release]; + [super dealloc]; +} + +- (void)setGradient:(NSGradient*)gradient { + [gradient retain]; + [gradient_ release]; + gradient_ = gradient; +} + - (NSColor*)strokeColor { return [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBar state:[[self window] isKeyWindow]]; } - (void)drawRect:(NSRect)rect { - NSColor* startingColor = - [NSColor colorWithCalibratedRed:kBackgroundColorTop[0] - green:kBackgroundColorTop[1] - blue:kBackgroundColorTop[2] - alpha:1.0]; - NSColor* endingColor = - [NSColor colorWithCalibratedRed:kBackgroundColorBottom[0] - green:kBackgroundColorBottom[1] - blue:kBackgroundColorBottom[2] - alpha:1.0]; - NSGradient* gradient = - [[[NSGradient alloc] initWithStartingColor:startingColor - endingColor:endingColor] autorelease]; - [gradient drawInRect:[self bounds] angle:270]; + [gradient_ drawInRect:[self bounds] angle:270]; // Draw bottom stroke [[self strokeColor] set]; |