You can get an idea of ββviewing Windows content and add a custom look to it. Just make sure you position your eyes correctly. Here is a sample code:
NSView *frameView = [[window contentView] superview]; NSRect frame = [frameView frame]; NSRect otherFrame = [otherView frame]; otherFrame.origin.x = NSMaxX( frame ) - NSWidth( otherFrame ); otherFrame.origin.y = NSMaxY( frame ) - NSHeight( otherFrame ); [otherView setFrame: otherFrame]; [frameView addSubview: otherView];
Here otherView is the view you want to put in your title bar. This code will not work if there is a button on the toolbar - they will overlap. Fortunately, there is an API to get the toolbar button so you can calculate the position:
NSButton *toolbarButton = [window standardWindowButton: NSWindowToolbarButton]; otherFrame.origin.x = NSMinX( [toolbarButton frame] ) - NSWidth( otherFrame );
You should also make sure that the auto-image masks for your view are configured so that they remain in the upper right corner of the window:
[otherView setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]
Sven
source share