1 #import "ITButtonCell.h"
2 #import "ITTextFieldCell.h"
5 #define GRAY_EXTRA_PAD_H 60.0
8 @interface ITButtonCell (Private)
9 - (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView;
13 @implementation ITButtonCell
17 if ( ( self = [super init] ) ) {
26 /*************************************************************************/
28 #pragma mark INSTANCE METHODS
29 /*************************************************************************/
31 - (void)setBezelStyle:(NSBezelStyle)bezelStyle
33 if ( bezelStyle == ITGrayRoundedBezelStyle ) {
34 _subStyle = bezelStyle;
35 bezelStyle = NSRegularSquareBezelStyle;
40 [super setBezelStyle:bezelStyle];
44 /*************************************************************************/
46 #pragma mark DRAWING METHODS
47 /*************************************************************************/
49 - (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
51 if ( _subStyle == ITGrayRoundedBezelStyle ) {
52 [self drawGrayRoundedBezelWithFrame:rect inView:controlView];
53 [super drawInteriorWithFrame:rect inView:controlView];
54 [[controlView superview] setNeedsDisplay:YES];
56 [super drawWithFrame:rect inView:controlView];
60 - (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView
62 NSBezierPath *path = [NSBezierPath bezierPath];
63 float ch = rect.size.height;
64 float cw = rect.size.width;
65 float radius = ( ch / 2 );
66 NSPoint pointA = NSMakePoint( (ch / 2) , 0.0 );
67 NSPoint pointB = NSMakePoint( (cw - (ch / 2)) , 0.0 );
68 // NSPoint pointC = NSMakePoint( (cw - (ch / 2)) , ch );
69 NSPoint pointD = NSMakePoint( (ch / 2) , ch );
70 NSPoint lCtr = NSMakePoint( (ch / 2) , (ch / 2) );
71 NSPoint rCtr = NSMakePoint( (cw - (ch / 2)) , (ch / 2) );
74 [path moveToPoint:pointA];
75 [path lineToPoint:pointB];
76 [path appendBezierPathWithArcWithCenter:rCtr
80 [path lineToPoint:pointD];
81 [path appendBezierPathWithArcWithCenter:lCtr
86 if ( [self isHighlighted] ) {
90 [[NSColor colorWithCalibratedWhite:0.15 alpha:alpha] set];