mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 21:42:32 +00:00
removed obsolte code. Using properties
This commit is contained in:
@@ -41,61 +41,44 @@
|
|||||||
- (void)drawRect:(NSRect)dirtyRect
|
- (void)drawRect:(NSRect)dirtyRect
|
||||||
{
|
{
|
||||||
|
|
||||||
if(self.showOverlay && [self isEnabled]) {
|
if(self.showOverlay && self.enabled) {
|
||||||
[[NSGraphicsContext currentContext] saveGraphicsState];
|
[[NSGraphicsContext currentContext] saveGraphicsState];
|
||||||
|
|
||||||
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:4 yRadius:4];
|
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:4 yRadius:4];
|
||||||
|
|
||||||
NSShadow *shadow = [[NSShadow alloc] init];
|
NSShadow *shadow = [[NSShadow alloc] init];
|
||||||
[shadow setShadowBlurRadius:6];
|
shadow.shadowBlurRadius = 6;
|
||||||
[shadow setShadowOffset:NSMakeSize(0, 0)];
|
shadow.shadowOffset = NSMakeSize(0, 0);
|
||||||
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.2 alpha:1]];
|
shadow.shadowColor = [NSColor colorWithCalibratedWhite:0.2 alpha:1];
|
||||||
[shadow set];
|
[shadow set];
|
||||||
|
|
||||||
[path addClip];
|
[path addClip];
|
||||||
[[NSColor colorWithCalibratedWhite:1 alpha:0.2] setFill];
|
[[NSColor colorWithCalibratedWhite:1 alpha:0.2] setFill];
|
||||||
[path fill];
|
[path fill];
|
||||||
NSBezierPath *strokePath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], -3, -3) xRadius:4 yRadius:4];
|
NSBezierPath *strokePath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], -3, -3) xRadius:4 yRadius:4];
|
||||||
[strokePath setLineWidth:6];
|
strokePath.lineWidth = 6;
|
||||||
[strokePath stroke];
|
[strokePath stroke];
|
||||||
// [shadow setShadowBlurRadius:2];
|
[NSGraphicsContext.currentContext restoreGraphicsState];
|
||||||
// [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];
|
|
||||||
}
|
}
|
||||||
[super drawRect:dirtyRect];
|
[super drawRect:dirtyRect];
|
||||||
/* Draw Overlay */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseEntered:(NSEvent *)theEvent {
|
- (void)mouseEntered:(NSEvent *)theEvent {
|
||||||
self.showOverlay = YES;
|
self.showOverlay = YES;
|
||||||
[self setNeedsDisplay:YES];
|
self.needsDisplay = YES;
|
||||||
[super mouseEntered:theEvent];
|
[super mouseEntered:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseExited:(NSEvent *)theEvent {
|
- (void)mouseExited:(NSEvent *)theEvent {
|
||||||
self.showOverlay = NO;
|
self.showOverlay = NO;
|
||||||
[self setNeedsDisplay:YES];
|
self.needsDisplay = YES;
|
||||||
[super mouseExited:theEvent];
|
[super mouseExited:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)theEvent {
|
- (void)mouseDown:(NSEvent *)theEvent {
|
||||||
[self sendAction:[self action] to:[self target]];
|
if(self.enabled) {
|
||||||
|
[self sendAction:self.action to:self.target];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_setupView {
|
- (void)_setupView {
|
||||||
|
|||||||
Reference in New Issue
Block a user