// // DKThemeFrame.m // DarkKit // // Created by Chad Weider on 9/8/06. // Copyright 2006 Chad Weider. All rights reserved. // #import "DKThemeFrame.h" #import "NSThemeFrame.h" #import "NSBezierPath+PXRoundedRectangleAdditions.h" #import "CTGradient.h" @implementation DKThemeFrame - (id)contentFill { return [NSColor colorWithCalibratedWhite:.13 alpha:1]; } - (id)frameColor { return [NSColor greenColor]; } - (void)_drawTitleBar:(NSRect)rect { NSRect titleRect = [self titlebarRect]; if([self _isUtility]) { CTGradient *titleGradient = [CTGradient gradientWithBeginningColor: [NSColor colorWithDeviceWhite:.50 alpha:1] endingColor:[NSColor colorWithDeviceWhite:.25 alpha:1]]; [titleGradient fillRect:titleRect angle:90]; } else { float radius = 4; NSBezierPath *borderPath = [NSBezierPath bezierPathWithRoundedRect:titleRect cornerRadius:radius inCorners:(OSTopLeftCorner | OSTopRightCorner)]; NSBezierPath *titlebarPath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(titleRect, 1, 1) cornerRadius:radius-1 inCorners:(OSTopLeftCorner | OSTopRightCorner)]; CTGradient *titleGradient = [CTGradient gradientWithBeginningColor:[NSColor colorWithDeviceWhite:.40 alpha:1] endingColor:[NSColor colorWithDeviceWhite:.25 alpha:1]]; CTGradient *borderGradient = [CTGradient gradientWithBeginningColor:[NSColor colorWithDeviceWhite:.40 alpha:1] endingColor:[NSColor colorWithDeviceWhite:.15 alpha:1]]; borderGradient = [borderGradient addColorStop:[titleGradient colorAtPosition:(1-4./NSHeight(titleRect))] atPosition:(1-4./NSHeight(titleRect))]; borderGradient = [borderGradient addColorStop:[NSColor colorWithDeviceWhite:.25 alpha:1] atPosition:(1-4./NSHeight(titleRect))]; [[NSColor clearColor] set]; NSRectFill(titleRect); if([[self window] isKeyWindow]) { [borderGradient fillBezierPath:borderPath angle:90]; [titleGradient fillBezierPath:titlebarPath angle:90]; } else { [[NSColor colorWithDeviceWhite:.13 alpha:1] set]; [borderPath fill]; } } NSRect divider; NSDivideRect([self titlebarRect], ÷r, &titleRect, 1, NSMinYEdge); if([[self window] isKeyWindow]) [[NSColor colorWithDeviceWhite:.50 alpha:1] set]; else [[NSColor colorWithDeviceWhite:.18 alpha:1] set]; NSRectFill(divider); [self _drawTitleStringIn:[self _titlebarTitleRect] withColor:[NSColor colorWithDeviceWhite:.75 alpha:1]]; } - (NSPoint)_closeButtonOrigin { NSPoint point = [super _closeButtonOrigin]; point.y += 1; return point; } @end