It's best explained by these two pictures. The first picture shows an nsbutton that has not yet been hovered, the second shows the same nsbutton when I have hovered over it.
As you can see, the NSView outer bezier path seems to be drawn on the button as well, for whatever reason. The button is a normal NSButton instance, no subclass.
Here's my custom NSView :
#import "MyView.h"
@implementation MyView
- (void)drawRect:(NSRect)rect
{
NSBezierPath *path;
path = [NSBezierPath bezierPathWithRect:rect];
[[NSColor redColor] set];
[path fill];
rect.size.width -= 10;
rect.size.height -= 10;
rect.origin.x += 5;
rect.origin.y += 5;
path = [NSBezierPath bezierPathWithRect:rect];
[[NSColor whiteColor] set];
[path fill];
}
- (void)awakeFromNib
{
NSButton *commandButton = [[NSButton alloc] initWithFrame:NSMakeRect(90, 50, 100, 18)];
[commandButton setButtonType:NSMomentaryPushInButton];
[commandButton setBordered:YES];
[commandButton setTitle:@"Test!"];
[commandButton setFont:[NSFont fontWithName:@"LucidaGrande" size:14.0]];
[commandButton setBezelStyle:NSInlineBezelStyle];
[self addSubview:commandButton];
}
@end