Using window close/max/min buttons as controls

I have created a container control that has a canvas across the top emulating a toolbar and a pdf view below. I’d like to add the using close/max/min buttons to the “toolbar” that would let the user perform the corresponding functions with the displayed pdf. Is there a programmatic way to add these with something like MacOSLib? Or do I simply draw the pictures myself in a canvas? I’ve looked at NSImage, but don’t find templates for these.

The container control will need to be on a window to be used anyway. Wouldn’t the containing window have those controls?

Yes, but they control the parent window, not the pdf view in the container control. What I want is for the user to be able to close/enlarge/minimize the container control (which displays pdfs in a pane in the parent window). I want to use the 3 buttons to do this – they would be immediately understandable to users. Of course I can use TIFFs or whatever of these and paint them in canvases, but if there is an API for accessing them (via NSImage, for example) I thought that would be preferable.

Jonathan, if you don’t mind me expressing an opinion here, I don’t think this is the way to go about this. This would go against the Mac Human Interface Guidelines and would be odd behavior. If I were you, I’d use custom close/minimize/maximize icons - using the default window ones for your container control, when the real window has them as well, would give a very confusing appearance.

But to answer your question, you are looking for the NSWindowButton enum on NSWindow, which you won’t be able to access for this, sorry.

Given that the PDF viewer is really a window in a window (a pane, if you will), I think it would be an obvious extension of the window metaphor. It would be impossible to confuse the functions of the window and the pane buttons (you haven’t seen the UI layout of course). Regardless, thanks for your answer to the question.

Why not intercept the RESIZED, RESIZING and CANCELCLOSE events and abort them under desired circumstances?
not optimal, but it could work

I’m really only asking about getting the images of these buttons via an API. They would be displayed in canvases, and how to handle clicks (to enlarge or diminish the size of the container control pane) is not a problem.

Gavin already answered this:

Is there a reason you can’t make make this a window since you need a tool bar and system buttons which you would get if you used a window instead of a container control?

Cheat… Take a screenshot and make PNG images from that.

I did that in one project using snaps from both OSX and Windows and then based on the platform created a “fake” window control using the correct images. End result was you could not tell the native from my fake (until of course Apple/Microsoft change something)

I know he did. I was repeating the original question for Dave.

Like many apps, mine has a single window that display multiple panes. I’m talking about one of those panes. So no, it can’t be a standalone window.

I’ve received the answer to my question, so I think this thread can end. Thanks to all who responded.

I second that. As an OS X for more than 10 years I’ve never seen that - it would feel odd. It sounds very MS-like - a no-go on OS X.

I think what you should be after is a window with a combined toolbar/tabbar for selecting the current panel (like Safari and now Finder).