]> git.sesse.net Git - vlc/blob - projects/macosx/framework/Examples/iPodConverter/GradientBackgroundView.m
afe2fbfdec557acea29c1a3587039a75590931bb
[vlc] / projects / macosx / framework / Examples / iPodConverter / GradientBackgroundView.m
1 //
2 //  GradientBackgroundView.m
3 //  iPodConverter
4 //
5 //  Created by Pierre d'Herbemont on 1/12/08.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "GradientBackgroundView.h"
10
11 /**********************************************************
12  * Why not drawing something nice?
13  */
14
15 @implementation GradientBackgroundView
16 - (void)awakeFromNib
17 {
18     /* Buggy nib files... Force us to be on the back of the view hierarchy */
19     NSView * superView;
20     [self retain];
21     superView = [self superview];
22     [self removeFromSuperview];
23     [superView addSubview:self positioned: NSWindowBelow relativeTo:nil];
24 }
25 - (void)drawRect:(NSRect)rect
26 {
27     
28     NSColor * topGradient = [NSColor colorWithCalibratedWhite:.12f alpha:1.0];
29     NSColor * bottomGradient   = [NSColor colorWithCalibratedWhite:0.55f alpha:0.9];
30         NSGradient * gradient = [[NSGradient alloc] initWithColorsAndLocations:bottomGradient, 0.f, bottomGradient, 0.1f, topGradient, 1.f, nil];
31     [gradient drawInRect:self.bounds angle:90.0];
32     [super drawRect:rect];
33 }
34 @end