Created
September 8, 2011 19:27
-
-
Save Nub/1204432 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)drawRect:(NSRect)dirtyRect | |
| { | |
| NSBezierPath *path = [self _popoverBezierPathWithRect:[self bounds]]; | |
| CGContextRef ref = [[NSGraphicsContext currentContext] graphicsPort]; | |
| //Fix blurred edges by offsetting by half a pixel | |
| CGContextTranslateCTM(ref, 0.5, 0.5); | |
| [self.color set]; | |
| //Gradient and extra stroke for HUD mimic | |
| if(self.appearance == NSPopoverAppearanceHUD){ | |
| NSGradient *borderGradient = | |
| [[[NSGradient alloc] | |
| initWithColorsAndLocations: | |
| [NSColor colorWithCalibratedWhite:0.65 alpha:0.85],0.0, | |
| [NSColor colorWithCalibratedWhite:0.15 alpha:0.85],0.08, nil] | |
| autorelease]; | |
| [borderGradient drawInBezierPath:path angle:-90]; | |
| [path setLineWidth:1]; | |
| [self.hudStroke set]; | |
| [path strokeInside]; | |
| }else | |
| [path fill];//Default fill | |
| [path setLineWidth:_borderWidth]; | |
| [self.borderColor set]; | |
| [path stroke]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment