View Full Version : Creating an inspector window
Jan 30, 2006, 04:04 AM
I'm thinking of creating an inspector window in one of my apps. I'd like it to act like the inspector windows in MS Word, omnioutliner et al - i.e. to have collapsable sections. To me, this looks like it should be a custom NSOutlineView subclass with custom NSViews for the 'children'.
Does anyone have any other ideas or know of any example source code for this?
Jan 31, 2006, 02:28 AM
I don't think you want to use NSOutlineView as your starting point. It is basically an NSTableView and as such it does not contain subviews. Each coloum/row is an NSCell. You are going to have to do a ton of work to get it to allow you to use NSViews instead.
I would define an NSView subclass that displayed the title/show hide disclosure triangle. Give it some behaviour so as the triangle works as expected (either remove the subview or hide it depending on which OSs you want to support). The view could also automatically resize it's containing NSWindow by the correct amount.
Then tart it up with animation of the window resize (really easy) and fading of the hiding view in out (easy on 10.4, a bit more difficult on 10.3).
Jan 31, 2006, 07:37 PM
You might consider checking out MOKit (http://mokit.sourceforge.net/ReleaseNotes.html), specifically the MOViewController and MOViewListView.