UKDistributedView

What is it?

UKDistributedView is an NSTableView-like class that displays a list of items in a Finder-style "icon view" as icons that can be freely moved around. Note that the model for this view's behaviour was mostly the MacOS 9 Finder, and not the slightly broken implementation of MacOS X 10.2.

Like an NSTableColumn, UKDistributedView uses an NSCell subclass to perform the actual display of the data. You can specify what kind of cell is to be used.

How do I use it?

I've tried to model UKDistributedView close to NSTableView. There is a delegate, a data source, and a numberOfItemsInDistributedView: method. To provide the data for your items, implement
	distributedView:positionForCell:atItemIndex:
and assign the desired values to the NSCell (which you can change using setPrototype: - a Finder-icon-like cell class is included).

The header and implementation files are pretty decently commented and should give you all the clues you need after reading through the example application's source code. Familiarity with NSTableView and co. is definitely helpful.

What License is this under?

UKDistributedView is free for use in Freeware and in-house applications, as long as you put a notice somewhere visible (about screen is OK) in the application that states that you're using UKDistributedView (c) 2003 by M. Uli Kusterer. You must also make any changes you do to the source code available to me so I can consider them for inclusion in the official distribution.

Use in a Shareware product is 10 € (EUR), which gives you a valid license for all releases up to the next major revision (i.e. if you buy 1.1, you'll get 1.5 for free, but you'll have to pay again for 2.0 - Note that 0.x releases count as 1.x in this regard). For commercial software, the price is 25 € (EUR). 

You may distribute the source code as long as no more than the cost price of the actual transfer medium (online fees or media cost) are charged, and the code is unchanged, and this readme file is included. If you want to distribute this code otherwise, contact me to get a license.

Revisions:
	0.1 -	Sample app slightly buggy due to a misnomer in MyDataSource.m
	0.2 -	Fixed sample app, added selection rect ("rubber band") and double click delegate method. Added some more flags for behavioral control. Added reloadData and noteNumberOfItemsChanged to make this more like NSTableView. Changed dragging to take into account snapToGrid. Made it possible to adjust grid size. Command key toggle grid during drag.
	0.3 -	Now can draw the grid, auto-enables and checkmarks menu items it can handle, draws "snap guide" boxes that tell you where an item will end up in the grid, selection rect is drawn on full pixels instead of in between, items don't crowd when dragged over the 0,0 coordinate anymore, sends notification on selection change.
	0.3.1 -	Fixed a typo that caused failure to send the double-click-message to the delegate. Thanks to Rand Arnold for spotting that one.
	0.4 -	Severe performance improvements through the use of caches for visible and potentially visible items for drawing and click tracking. Also made view only draw what is actually visible. This should make lists of several thousand items significantly more manageable. Also added multiPositioningMode to allow positioning several items added to a view more quickly and with less redundancy.
	0.5 -	Adds in-line editing for cells (both to UKDistView and UKFinderIconCell) and, keyboard navigation using the arrow keys. UKFinderIconCell will now also work in flipped views like NSTableView and NSMatrix classes. Incorporated miscellaneous bug fixes by David Sinclair, who also donated code for in-line editing in UKDistView.

Contact Information:
You can find the newest version of UKDistributedView at
	http://www.zathras.de/programming/cocoa_stuff.php

E-Mail:	witness.of.teachtext@gmx.net

M. Uli Kusterer, Heidelberg, 2004-01-22