// // from RoundedFloatingPanel // http://www.scotlandsoftware.com/products/source/ // Created by Matt Gemmell on Thu Jan 08 2004. // #import "FSRoundedView.h" @implementation FSRoundedView - (id)initWithFrame:(NSRect)frameRect { Q_DEBUG(@"iniWithFrame"); if ((self = [super initWithFrame:frameRect]) != nil) { // Add initialization code here } return self; } - (void)drawRect:(NSRect)rect { Q_DEBUG(@"drawRect"); NSColor *bgColor = SEMI_TRANSPARENT_COLOR; NSRect bgRect = rect; int minX = NSMinX(bgRect); int midX = NSMidX(bgRect); int maxX = NSMaxX(bgRect); int minY = NSMinY(bgRect); int midY = NSMidY(bgRect); int maxY = NSMaxY(bgRect); float radius = 25.0; // correct value to duplicate Panther's App Switcher NSBezierPath *bgPath = [NSBezierPath bezierPath]; // Bottom edge and bottom-right curve [bgPath moveToPoint:NSMakePoint(midX, minY)]; [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, minY) toPoint:NSMakePoint(maxX, midY) radius:radius]; // Right edge and top-right curve [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, maxY) toPoint:NSMakePoint(midX, maxY) radius:radius]; // Top edge and top-left curve [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(minX, maxY) toPoint:NSMakePoint(minX, midY) radius:radius]; // Left edge and bottom-left curve [bgPath appendBezierPathWithArcFromPoint:bgRect.origin toPoint:NSMakePoint(midX, minY) radius:radius]; [bgPath closePath]; [bgColor set]; [bgPath fill]; } @end