1
votes

I have subclassed NSWindow so I can make some tweaks and have a custom window. One of them is to make bottom corners rounded but haven't succeed yet.

I have tried this but my window does not have the standard status bar it didn't work. I hope this is possible ;)

Thanks in advance

2
Why do you want to make your window non standard? The main effect of this is to annoy users of your application and make them hate you. The user Interface Guidelines are there for a reason. Use them.JeremyP
Right, but even Apple does non-standard windows: iTunes and AppStore's toolbar, some of the windows in Safari's WebInspector and Xcode and thousands of hundreds of games with customized windows, etc are non-standard examples and not all of them annoy the users. I think it depends on how well they are designed ;)nacho4d
Yes, Apple is a bad offender in terms of breaking its own UI guidelines. That doesn't mean everybody should do it though.JeremyP

2 Answers

5
votes

Since my window has style: NSBorderlessWindowMask I have solved this by subclassing containerView of the window and overriding drawRect:

- (void) drawRect:(NSRect)dirtyRect{
    [[NSColor windowBackgroundColor] set];

    [NSGraphicsContext saveGraphicsState];
    NSBezierPath *path; 
    path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:5 yRadius:5];

    ... // do more fancy stuff here ;)

    [NSGraphicsContext restoreGraphicsState];
}
4
votes

Use this in the delegate of the window:

- (void)awakeFromNib
{
    [window setContentBorderThickness:32.0 forEdge:NSMinYEdge];
}

Alternately you can set this behavior in Xcode 4 on a window in the size inspector at ContentBorder. This will make the window look like this:

NSWindow with set content border