X-Git-Url: http://git.ithinksw.org/ITKit.git/blobdiff_plain/dd15c67f704000bdbf3e793cf0a174b6108ad1f6..01db0767091e20e5515fae009a07a6fd8535bcdf:/ITTSWBackgroundView.m diff --git a/ITTSWBackgroundView.m b/ITTSWBackgroundView.m index baa0cba..94731aa 100755 --- a/ITTSWBackgroundView.m +++ b/ITTSWBackgroundView.m @@ -3,31 +3,43 @@ @implementation ITGrayRoundedView +- (id)initWithFrame:(NSRect)frameRect +{ + if ( (self = [super initWithFrame:frameRect]) ) { + _path = [[NSBezierPath bezierPath] retain]; + } + + return self; +} + - (void)drawRect:(NSRect)theRect { - NSBezierPath *path = [NSBezierPath bezierPath]; float vh = NSHeight(theRect); float vw = NSWidth(theRect); - [path moveToPoint:NSMakePoint( 0.0, (vh - 24.0) )]; // first point - [path curveToPoint:NSMakePoint( 24.0, vh ) + + [_path autorelease]; + _path = [[NSBezierPath bezierPath] retain]; + + [_path moveToPoint:NSMakePoint( 0.0, (vh - 24.0) )]; // first point + [_path curveToPoint:NSMakePoint( 24.0, vh ) controlPoint1:NSMakePoint( 0.0, (vh - 11.0) ) controlPoint2:NSMakePoint( 11.0, vh )]; // top-left curve - [path lineToPoint:NSMakePoint( (vw - 24.0), vh )]; // top line - [path curveToPoint:NSMakePoint( vw, (vh - 24.0) ) + [_path lineToPoint:NSMakePoint( (vw - 24.0), vh )]; // top line + [_path curveToPoint:NSMakePoint( vw, (vh - 24.0) ) controlPoint1:NSMakePoint( (vw - 11.0), vh ) controlPoint2:NSMakePoint( vw, (vh - 11.0) )]; // top-right curve - [path lineToPoint:NSMakePoint( vw, 24.0 )]; // right line - [path curveToPoint:NSMakePoint( (vw - 24.0), 0.0 ) + [_path lineToPoint:NSMakePoint( vw, 24.0 )]; // right line + [_path curveToPoint:NSMakePoint( (vw - 24.0), 0.0 ) controlPoint1:NSMakePoint( vw, 11.0 ) controlPoint2:NSMakePoint( (vw - 11.0), 0.0 )]; // bottom-right curve - [path lineToPoint:NSMakePoint( 24.0, 0.0 )]; // bottom line - [path curveToPoint:NSMakePoint( 0.0, 24.0 ) + [_path lineToPoint:NSMakePoint( 24.0, 0.0 )]; // bottom line + [_path curveToPoint:NSMakePoint( 0.0, 24.0 ) controlPoint1:NSMakePoint( 11.0, 0.0 ) controlPoint2:NSMakePoint( 0.0, 11.0 )]; // bottom-left curve - [path closePath]; // left line + [_path closePath]; // left line [[NSColor colorWithCalibratedWhite:0.0 alpha:0.15] set]; - [path fill]; + [_path fill]; } - (BOOL)isOpaque