views:

150

answers:

3

How can I make a window with same basic structure as the Finder window (a menu/source list to the left with icons that can be organized, and the content in a larger view on the right)?

A: 

I think you might be confusing 'left' and 'right'. But I digress.

To create a window with a similar structure you would use, for the icons portion, an NSOutlineView, if memory serves. You might also be able to use an NSTableView.

Unless of course I'm misunderstanding your question; in which case you would use for the right part an NSCollectionView, I suppose. You would still use one of the two mentioned above for the source list on the left side.

Williham Totland
When i use NSOutlineView i get those annnoying scrollbars. How can i get it as simple as the Finder Window?
Mikkel
The Finder's sidebar has scroll bars, too. If you're getting scroll bars, it's because your content is too big for where you put it. If you don't want them, either make the view (including its columns) smaller or make its container bigger.
Peter Hosey
Okay, how can i change the background color on the OutlineView?
Mikkel
Turn off "Show vertical scroller" for the enclosing scroll view in IB or programmatically. Select "Source List" as Highlight for the outline view.
Costique
How can i remove the header: http://mm-hotel.dk/screens/300201e4de9915a4aca40fb3fa36a7a2.png ?
Mikkel
Mikkel: Turn it off in IB. It's a checkbox on the Attributes (⌘1) Inspector for the outline view.
Peter Hosey
A: 

To replicate the content view of the Finder, use:

  1. Icon view: NSCollectionView
  2. List view: NSOutlineView
  3. Column view: NSBrowser
  4. CoverFlow: Custom on top, NSOutlineView (list view) below

You can probably find a third-party open-source implementation of CoverFlow for the Mac with a bit of Googling.

As Williham Totland already mentioned, the way to make a source list (sidebar) is NSOutlineView. There are a few questions here on Stack Overflow about getting it to look more like that.

A toolbar is, of course, NSToolbar.

Peter Hosey
+1  A: 

Apple provides sample code to do exactly what you are trying to achieve:

http://developer.apple.com/mac/library/samplecode/SourceView/

As others have pointed out, it uses an NSOutlineView for the source list and an NSCollectionView for the content.

Rob Keniger