1 #import "ITTSWBackgroundView.h"
4 @implementation ITTSWBackgroundView
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);
20 NSPoint pointA = NSMakePoint( 24.0 , 0.0 );
21 // NSPoint pointB = NSMakePoint( 0.0 , 24.0 ); reference
22 NSPoint pointC = NSMakePoint( 0.0 , (vh - 24.0) );
23 // NSPoint pointD = NSMakePoint( 24.0 , vh ); reference
24 NSPoint pointE = NSMakePoint( (vw - 24.0) , vh );
25 // NSPoint pointF = NSMakePoint( vw , (vh - 24.0) ); reference
26 NSPoint pointG = NSMakePoint( vw , 24.0 );
27 // NSPoint pointH = NSMakePoint( (vw - 24.0) , 0.0 ); reference
29 NSPoint ctrAB = NSMakePoint( 24.0 , 24.0 );
30 NSPoint ctrCD = NSMakePoint( 24.0 , (vh - 24.0) );
31 NSPoint ctrEF = NSMakePoint( (vw - 24.0) , (vh - 24.0) );
32 NSPoint ctrGH = NSMakePoint( (vw - 24.0) , 24.0 );
36 * +------------------------+
37 * C | * ctrCD ctrEF * | F
39 * B | * ctrAB ctrGH * | G
40 * +------------------------+
45 _path = [[NSBezierPath bezierPath] retain];
47 [_path moveToPoint:pointA]; // first point
48 [_path appendBezierPathWithArcWithCenter:ctrAB // bottom-left curve
52 [_path lineToPoint:pointC]; // left line
53 [_path appendBezierPathWithArcWithCenter:ctrCD // top-left curve
57 [_path lineToPoint:pointE]; // top line
58 [_path appendBezierPathWithArcWithCenter:ctrEF // top-right curve
62 [_path lineToPoint:pointG]; // right line
63 [_path appendBezierPathWithArcWithCenter:ctrGH // bottom-right curve
67 [_path lineToPoint:pointA]; // right line
69 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.15] set];