removed obsolte code. Using properties

This commit is contained in:
michael starke
2017-04-25 20:04:59 +02:00
parent a136243bf6
commit c9c3998b7a

View File

@@ -41,61 +41,44 @@
- (void)drawRect:(NSRect)dirtyRect
{
if(self.showOverlay && [self isEnabled]) {
if(self.showOverlay && self.enabled) {
[[NSGraphicsContext currentContext] saveGraphicsState];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:4 yRadius:4];
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowBlurRadius:6];
[shadow setShadowOffset:NSMakeSize(0, 0)];
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.2 alpha:1]];
shadow.shadowBlurRadius = 6;
shadow.shadowOffset = NSMakeSize(0, 0);
shadow.shadowColor = [NSColor colorWithCalibratedWhite:0.2 alpha:1];
[shadow set];
[path addClip];
[[NSColor colorWithCalibratedWhite:1 alpha:0.2] setFill];
[path fill];
NSBezierPath *strokePath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], -3, -3) xRadius:4 yRadius:4];
[strokePath setLineWidth:6];
strokePath.lineWidth = 6;
[strokePath stroke];
// [shadow setShadowBlurRadius:2];
// [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0 alpha:0.5]];
// [shadow setShadowOffset:NSMakeSize(0, -1)];
// [shadow set];
//
// NSBezierPath *triangle = [NSBezierPath bezierPath];
// NSPoint left = NSMakePoint([self bounds].size.width - MPTRIANGLE_OFFSET - MPTRIANGLE_WIDTH, MPTRIANGLE_OFFSET + MPTRIANGLE_HEIGHT);
// NSPoint right = NSMakePoint(left.x + MPTRIANGLE_WIDTH, left.y);
// NSPoint bottom = NSMakePoint(left.x + 0.5 * MPTRIANGLE_WIDTH, MPTRIANGLE_OFFSET);
//
// [triangle moveToPoint:left];
// [triangle lineToPoint:right];
// [triangle lineToPoint:bottom];
// [triangle closePath];
//
// [[NSColor whiteColor] set];
// [triangle fill];
[[NSGraphicsContext currentContext] restoreGraphicsState];
[NSGraphicsContext.currentContext restoreGraphicsState];
}
[super drawRect:dirtyRect];
/* Draw Overlay */
}
- (void)mouseEntered:(NSEvent *)theEvent {
self.showOverlay = YES;
[self setNeedsDisplay:YES];
self.needsDisplay = YES;
[super mouseEntered:theEvent];
}
- (void)mouseExited:(NSEvent *)theEvent {
self.showOverlay = NO;
[self setNeedsDisplay:YES];
self.needsDisplay = YES;
[super mouseExited:theEvent];
}
- (void)mouseDown:(NSEvent *)theEvent {
[self sendAction:[self action] to:[self target]];
if(self.enabled) {
[self sendAction:self.action to:self.target];
}
}
- (void)_setupView {