//// BWUnanchoredButtonCell.m// BWToolkit//// Created by Brandon Walkin (www.brandonwalkin.com)// All code is provided under the New BSD license.//#import "BWUnanchoredButtonCell.h"#import "BWUnanchoredButton.h"#import "NSColor+BWAdditions.h"staticNSColor*fillStop1,*fillStop2,*fillStop3,*fillStop4;staticNSColor*borderColor,*topBorderColor,*bottomInsetColor,*topInsetColor,*pressedColor;staticNSGradient*fillGradient;@implementationBWUnanchoredButtonCell+(void)initialize;{fillStop1=[[NSColorcolorWithCalibratedWhite:(251.0f/255.0f)alpha:1]retain];fillStop2=[[NSColorcolorWithCalibratedWhite:(251.0f/255.0f)alpha:1]retain];fillStop3=[[NSColorcolorWithCalibratedWhite:(236.0f/255.0f)alpha:1]retain];fillStop4=[[NSColorcolorWithCalibratedWhite:(243.0f/255.0f)alpha:1]retain];fillGradient=[[NSGradientalloc]initWithColorsAndLocations:fillStop1,(CGFloat)0.0,fillStop2,(CGFloat)0.5,fillStop3,(CGFloat)0.5,fillStop4,(CGFloat)1.0,nil];topBorderColor=[[NSColorcolorWithCalibratedWhite:(126.0f/255.0f)alpha:1]retain];borderColor=[[NSColorcolorWithCalibratedWhite:(151.0f/255.0f)alpha:1]retain];topInsetColor=[[NSColorcolorWithCalibratedWhite:(0.0f/255.0f)alpha:0.08]retain];bottomInsetColor=[[NSColorcolorWithCalibratedWhite:(255.0f/255.0f)alpha:0.54]retain];pressedColor=[[NSColorcolorWithCalibratedWhite:(0.0f/255.0f)alpha:0.3]retain];}-(void)drawBezelWithFrame:(NSRect)cellFrameinView:(NSView*)controlView{[fillGradientdrawInRect:NSInsetRect(cellFrame,0,2)angle:90];[topInsetColorbwDrawPixelThickLineAtPosition:0withInset:0inRect:cellFrameinView:[selfcontrolView]horizontal:YESflip:NO];[topBorderColorbwDrawPixelThickLineAtPosition:1withInset:0inRect:cellFrameinView:[selfcontrolView]horizontal:YESflip:NO];[borderColorbwDrawPixelThickLineAtPosition:1withInset:0inRect:cellFrameinView:[selfcontrolView]horizontal:YESflip:YES];[bottomInsetColorbwDrawPixelThickLineAtPosition:0withInset:0inRect:cellFrameinView:[selfcontrolView]horizontal:YESflip:YES];[borderColorbwDrawPixelThickLineAtPosition:0withInset:2inRect:cellFrameinView:[selfcontrolView]horizontal:NOflip:YES];[borderColorbwDrawPixelThickLineAtPosition:0withInset:2inRect:cellFrameinView:[selfcontrolView]horizontal:NOflip:NO];}-(NSRect)highlightRectForBounds:(NSRect)bounds{returnNSInsetRect(bounds,0,1);}@end