diff --git a/MacPass/MPPopupImageView.m b/MacPass/MPPopupImageView.m index 315f5033..0f1855cf 100644 --- a/MacPass/MPPopupImageView.m +++ b/MacPass/MPPopupImageView.m @@ -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 {