Added sliding in from all four corners both horizontal and vertical.
[ITKit.git] / ITTSWBackgroundView.m
1 #import "ITGrayRoundedView.h"
2
3
4 @implementation ITGrayRoundedView
5
6 - (id)initWithFrame:(NSRect)frameRect
7 {
8     if ( (self = [super initWithFrame:frameRect]) ) {
9         _path = [[NSBezierPath bezierPath] retain];
10     }
11     
12     return self;
13 }
14
15 - (void)drawRect:(NSRect)theRect
16 {
17     float vh = NSHeight(theRect);
18     float vw = NSWidth(theRect);
19
20     [_path autorelease];
21     _path = [[NSBezierPath bezierPath] retain];
22
23     [_path moveToPoint:NSMakePoint( 0.0, (vh - 24.0) )];          //  first point
24     [_path curveToPoint:NSMakePoint( 24.0, vh )
25          controlPoint1:NSMakePoint( 0.0, (vh - 11.0) )
26          controlPoint2:NSMakePoint( 11.0, vh )];                  //  top-left curve
27     [_path lineToPoint:NSMakePoint( (vw - 24.0), vh )];    //  top line
28     [_path curveToPoint:NSMakePoint( vw, (vh - 24.0) )
29          controlPoint1:NSMakePoint( (vw - 11.0), vh )
30          controlPoint2:NSMakePoint( vw, (vh - 11.0) )];   //  top-right curve
31     [_path lineToPoint:NSMakePoint( vw, 24.0 )];           //  right line
32     [_path curveToPoint:NSMakePoint( (vw - 24.0), 0.0 )
33          controlPoint1:NSMakePoint( vw, 11.0 )
34          controlPoint2:NSMakePoint( (vw - 11.0), 0.0 )];  //  bottom-right curve
35     [_path lineToPoint:NSMakePoint( 24.0, 0.0 )];          //  bottom line
36     [_path curveToPoint:NSMakePoint( 0.0, 24.0 )
37          controlPoint1:NSMakePoint( 11.0, 0.0 )
38          controlPoint2:NSMakePoint( 0.0, 11.0 )];         //  bottom-left curve
39     [_path closePath];                                                                    //  left line
40
41     [[NSColor colorWithCalibratedWhite:0.0 alpha:0.15] set];
42     [_path fill];
43 }
44
45 - (BOOL)isOpaque
46 {
47     return NO;
48 }
49
50 @end