One of the great new features in Leopard is a standard way of supporting source lists — those blue outline views with a gradient highlight, like in iTunes, that provide an interface to some collections of objects.
These have become quite common in a lot of applications since their introduction in iTunes, and everybody does them slightly differently. Now, though, there's a simple way for applications running on Leopard to get the source list look and feel almost for free!
There's a new property added to NSTableView called selection highlight style. There are currently two possible values for the highlight style: Normal, the default, which gets you the regular look and feel and selection highlight behavior, and source list, which gets you not just source list-style selection highlighting, but also gets you the proper background color — whether you're in the foreground or the background — and for outline views, will also get you the proper indentation per level, the row height, and inter-cell spacing.
You can even set this property directly on your table or outline view in Interface Builder 3!
Of course, the obvious next question is "How do I get the small-caps look for section headers like in iTunes, Mail, and the Finder?" It's pretty simple! There are just a couple of methods you'll need to implement in your NSOutlineView delegate as described by Jim Puls in this message to the cocoa-dev list on October 26; conceptually, all you need to do is tell the outline view that your header items are group items — another new feature in Leopard — and then, when the cell containing them is displayed, adjust their string to be all-caps.
- New in Leopard: Source lists!