Drawing outside NSWindow

I understand how to draw inside the NSWindow frame. But I donโ€™t understand how to achieve something like this, for example:

Taken from a time tracking app called Eon

If I knew what it was called, I could investigate the matter further, but since I did not know what to look for, this is impossible.

I appreciate any hint.

Many thanks.

+4
source share
1 answer

The application in the screenshot looks like a custom NSDrawer . Drawers slide out of the window and can display any content.

Take a look at the documentation to find out what you want: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Drawers/Drawers.html#//apple_ref/doc/uid/10000001-BABFIBIA

Boxes are easily customizable. However, although you have full control over the contents inside the box, you do not have much control over how the border looks without using private APIs (for example, ragged edges in the screenshot). If you want more control, you can use a borderless child window.

Here is a tutorial that makes a limitless, fully customizable window: http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html

Then you can โ€œattachโ€ your custom window to the parent window using -[NSWindow addChildWindow:ordered:] . This will allow the child window to follow the parent window as it moves. You still have to react to changes in the size of the parent window and, possibly, some other properties.

+6
source

All Articles