1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/cocoa/vertical_gradient_view.h"
7 @implementation VerticalGradientView
9 - (NSGradient*)gradient {
13 - (void)setGradient:(NSGradient*)gradient {
14 gradient_.reset([gradient retain]);
17 - (NSColor*)strokeColor {
21 - (void)setStrokeColor:(NSColor*)strokeColor {
22 strokeColor_.reset([strokeColor retain]);
25 - (void)drawRect:(NSRect)rect {
27 [[self gradient] drawInRect:[self bounds] angle:270];
29 // Draw bottom stroke.
30 NSColor* strokeColor = [self strokeColor];
32 [[self strokeColor] set];
33 NSRect borderRect, contentRect;
34 NSDivideRect([self bounds], &borderRect, &contentRect, 1, NSMinYEdge);
35 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);