diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 23:35:24 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-20 23:35:24 +0000 |
commit | e1b58df5167ebd4374ee36ec57ee77d4f2e68595 (patch) | |
tree | ad520f91eb90596d93382ead3eb2b9d42a6aa99c /chrome/browser/cocoa/infobar_gradient_view.mm | |
parent | f88f164cd5cbf64075fbfa5d95b0178c2fbb7f4c (diff) | |
download | chromium_src-e1b58df5167ebd4374ee36ec57ee77d4f2e68595.zip chromium_src-e1b58df5167ebd4374ee36ec57ee77d4f2e68595.tar.gz chromium_src-e1b58df5167ebd4374ee36ec57ee77d4f2e68595.tar.bz2 |
Infobar UI cleanup on Mac. Adds the yellow background gradient and
centers all of the buttons.
Also adds the ok/cancel buttons to the xib file. Infobars that do not
need the buttons can remove them from the view before displaying.
BUG=http://crbug.com/14462
BUG=http://crbug.com/17195
TEST=Infobars should have yellow background, look less ugly.
Review URL: http://codereview.chromium.org/155788
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21128 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 | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/infobar_gradient_view.mm b/chrome/browser/cocoa/infobar_gradient_view.mm new file mode 100644 index 0000000..41944ff --- /dev/null +++ b/chrome/browser/cocoa/infobar_gradient_view.mm @@ -0,0 +1,48 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/cocoa/infobar_gradient_view.h" +#import "third_party/GTM/AppKit/GTMTheme.h" + +const double kBackgroundColorTop[3] = + {255.0 / 255.0, 242.0 / 255.0, 183.0 / 255.0}; +const double kBackgroundColorBottom[3] = + {250.0 / 255.0, 230.0 / 255.0, 145.0 / 255.0}; + +@implementation InfoBarGradientView +- (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]; + + // Draw bottom stroke + [[self strokeColor] set]; + NSRect borderRect, contentRect; + NSDivideRect([self bounds], &borderRect, &contentRect, 1, NSMinYEdge); + NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); +} + +- (BOOL)mouseDownCanMoveWindow { + return NO; +} + +// This view is intentionally not opaque because it overlaps with the findbar. + +@end |