Question

Most Cocoa applications, provided they call NSWindow's -setRepresentedFilename:, will display a nice little proxy icon at the top-centre of their NSWindows.

Here's an example of the Preview app with a PDF document:

proxy icon for a PDF file

Xcode, somehow, manages to display 2 proxy icons - one for the project file and the other for the current document in the source display.

xcode has 2 proxy icons for two documents

Does anyone know how they do that? window:shouldPopUpDocumentPathMenu: in NSWindowDelegate seems very close - you could probably position your custom path menus with this. But there doesn't seem to be anything that would allow you to actually display the two proxy icons themselves.

Any ideas?

Was it helpful?

Solution

Unfortunately Apple has access to APIs the rest of us don’t. Messing with the title bar is really hard.

The best I can suggest is making your window NOT have a standard title bar, and then placing the buttons yourself by calling [self standardWindowButton:X] for each of the close, resize, and miniaturize buttons you want. Then place your own document icon and title textField.

You’ll likely have to track when the window loses or gains key or main status and modify the buttons accordingly (Cocoa fetches new buttons each time this happens, not sure why). Whee! Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top