summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/toolbar_view.mm
blob: 87d16e3f08b6aaa22cd36bbedeafc998838e288c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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/toolbar_view.h"

@implementation ToolbarView

- (void)drawRect:(NSRect)rect {
  BOOL isKey = [[self window] isKeyWindow];
  rect = [self bounds];

  NSColor* start =
      [NSColor colorWithCalibratedWhite: isKey ? 0.95 : 0.98 alpha:1.0];
  NSColor* end = [NSColor colorWithCalibratedWhite:0.90 alpha:1.0];
  NSGradient *gradient =
      [[[NSGradient alloc] initWithStartingColor:start endingColor:end]
          autorelease];
  [gradient drawInRect:[self bounds] angle:270.0];
  NSRect borderRect, contentRect;
  NSDivideRect(rect, &borderRect, &contentRect, 1, NSMinYEdge);

  [[NSColor colorWithDeviceWhite:0.0 alpha:0.3] set];
  NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
}

@end