Creating a custom title bar on a standard NSWindow

Viewed 5717

I've been trying to build a specific look for my menubar app.

enter image description here

I've been using a NSWindow with a NSBorderlessWindowMask style mask and setting [window setOpaque:NO] and [window setBackgroundColor:[NSColor clearColor]]. That gives me a blank canvas which works great for the title bar.

Now I'm having problems with the view-based NSTableView I'm using for the listing. How can I clip the NSTableCellViews to the window's rounded corners?

I started out just having a custom view wrapping the NSTableView, drawing the background with rounded corners. Using [view addClip:path] doesn't clip child views though.

I've also tried using a [view setWantsLayer:YES] with a mask. That worked great, but the table view cells would sporadically glitch out. It seems that having a NSScrollView be a child of a layer is a known problem:

http://i.stack.imgur.com/JmhjD.png

My current view structure looks something like:

NSWindow
- MyTitleBarView
- MyBackgroundView
  - NSScrollView
    - NSTableView
1 Answers
Related