1 #import "ITGrayRoundedView.h"
4 @implementation ITGrayRoundedView
6 - (id)initWithFrame:(NSRect)frameRect
8 if ( (self = [super initWithFrame:frameRect]) ) {
9 _path = [[NSBezierPath bezierPath] retain];
15 - (void)drawRect:(NSRect)theRect
17 float vh = NSHeight(theRect);
18 float vw = NSWidth(theRect);
21 _path = [[NSBezierPath bezierPath] retain];
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
41 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.15] set];