Try wrapping the material filling the NSShadow path and the bezier (e.g., from aPath = [[NSBezierPath bezierPath] retain];to [fillGradient release];) in [NSGraphicsContext saveGraphicsState]and [NSGraphicsContext restoreGraphicsState].
In addition, the shadow can be cut off by the borders of the view (I donβt remember whether this is true or not).
( , , , NSButtonCell, drawWithFrame:inView:/-drawInteriorWithFrame:inView: +cellClass ( IB -initWithCoder:). , , , .)