Files
gitx/PBGitGradientBarView.m
Nathan Kinsinger 64f4276e21 Delete old toolbars and create new ones
- remove the separate window toolbars from the history and commit views and create a new window toolbar in the repository window
    - add new toolbars inside the history view
        - new class to draw a gradient in the background of a view
        - moved the search field from the main toolbar to the scope bar
2010-03-13 22:14:36 -07:00

53 lines
1010 B
Objective-C

//
// PBGitGradientBarView.m
// GitX
//
// Created by Nathan Kinsinger on 2/22/10.
// Copyright 2010 Nathan Kinsinger. All rights reserved.
//
#import "PBGitGradientBarView.h"
@implementation PBGitGradientBarView
- (id) initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (!self)
return nil;
[self setTopShade:1.0 bottomShade:0.0];
return self;
}
- (void) drawRect:(NSRect)dirtyRect
{
[gradient drawInRect:[self bounds] angle:90];
}
- (void) setTopColor:(NSColor *)topColor bottomColor:(NSColor *)bottomColor
{
if (!topColor || !bottomColor)
return;
gradient = [[NSGradient alloc] initWithStartingColor:bottomColor endingColor:topColor];
[self setNeedsDisplay:YES];
}
- (void) setTopShade:(float)topShade bottomShade:(float)bottomShade
{
NSColor *topColor = [NSColor colorWithCalibratedWhite:topShade alpha:1.0];
NSColor *bottomColor = [NSColor colorWithCalibratedWhite:bottomShade alpha:1.0];
[self setTopColor:topColor bottomColor:bottomColor];
}
@end