Here's the code:
// Created by Sean Patrick O'Brien on 4/1/08.
// Copyright 2008 MolokoCacao. All rights reserved.
- (void)fillWithInnerShadow:(NSShadow *)shadow {
[NSGraphicsContext saveGraphicsState];
NSShadow *shadowCopy = [shadow copy];
NSSize offset = shadowCopy.shadowOffset;
CGFloat radius = shadowCopy.shadowBlurRadius;
NSRect bounds = NSInsetRect(self.bounds, -(ABS(offset.width) +
radius), -(ABS(offset.height) + radius));
offset.height += bounds.size.height;
shadowCopy.shadowOffset = offset;
NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:0 yBy:([[NSGraphicsContext currentContext]
isFlipped] ? 1 : -1) * bounds.size.height];
NSBezierPath *drawingPath = [NSBezierPath bezierPathWithRect:bounds];
[drawingPath setWindingRule:NSEvenOddWindingRule];
[drawingPath appendBezierPath:self];
[drawingPath transformUsingAffineTransform:transform];
[self addClip];
[shadowCopy set];
[[NSColor blackColor] set];
[drawingPath fill];
[shadowCopy release];
[NSGraphicsContext restoreGraphicsState];
}
Keith Duncan
[EMAIL PROTECTED], 33software.com
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]