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];
55 [super drawWithFrame:rect inView:controlView];
59 - (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView
61 NSBezierPath *path = [NSBezierPath bezierPath];
62 float ch = rect.size.height;
63 float cw = rect.size.width;
64 float radius = ( ch / 2 );
65 NSPoint pointA = NSMakePoint( (ch / 2) , 0.0 );
66 NSPoint pointB = NSMakePoint( (cw - (ch / 2)) , 0.0 );
67 // NSPoint pointC = NSMakePoint( (cw - (ch / 2)) , ch );
68 NSPoint pointD = NSMakePoint( (ch / 2) , ch );
69 NSPoint lCtr = NSMakePoint( (ch / 2) , (ch / 2) );
70 NSPoint rCtr = NSMakePoint( (cw - (ch / 2)) , (ch / 2) );
73 [path moveToPoint:pointA];
74 [path lineToPoint:pointB];
75 [path appendBezierPathWithArcWithCenter:rCtr
79 [path lineToPoint:pointD];
80 [path appendBezierPathWithArcWithCenter:lCtr
85 if ( [self isHighlighted] ) {
89 [[NSColor colorWithCalibratedWhite:0.0 alpha:alpha] set];