![]() |
API 0.9.5
|
#import <CPCollectionView.h>
This class displays an array as a grid of objects, where each object is represented by a view. The view is controlled by creating a CPCollectionViewItem and specifying its view, then setting that item as the collection view prototype.
-(void)collectionViewDidChangeSelection:(CPCollectionView)collectionView; Called when the selection in the collection view has changed.
collectionView | the collection view who's selection changed |
-(void)collectionView:(CPCollectionView)collectionView didDoubleClickOnItemAtIndex:(int)index; Called when the user double-clicks on an item in the collection view.
collectionView | the collection view that received the double-click |
index | the index of the item that received the double-click |
-(CPData)collectionView:(CPCollectionView)collectionView dataForItemsAtIndexes:(CPIndexSet)indices forType:(CPString)aType; Invoked to obtain data for a set of indices.
collectionView | the collection view to obtain data for |
indices | the indices to return data for |
aType | the data type |
-(CPArray)collectionView:(CPCollectionView)collectionView dragTypesForItemsAtIndexes:(CPIndexSet)indices; Invoked to obtain the data types supported by the specified indices for placement on the pasteboard.
collectionView | the collection view the items reside in |
indices | the indices to obtain drag types |
Definition at line 2 of file CPCollectionView.h.
- (BOOL) acceptsFirstResponder |
Returns YES
by default.
Reimplemented from CPResponder.
Definition at line 220 of file CPCollectionView.j.
- (BOOL) allowsEmptySelection |
Returns YES
if the user can select no items, NO
otherwise.
Definition at line 308 of file CPCollectionView.j.
- (BOOL) allowsMultipleSelection |
Returns YES
if the user can select multiple items, NO
otherwise.
Definition at line 325 of file CPCollectionView.j.
- (void) awakeFromCib |
Reimplemented from CPObject.
Definition at line 957 of file CPCollectionView.j.
- (CPArray) backgroundColors |
Definition at line 612 of file CPCollectionView.j.
- (CPArray) content |
Returns the collection view content array
Definition at line 253 of file CPCollectionView.j.
- (id) delegate |
Returns the collection view's delegate
Definition at line 759 of file CPCollectionView.j.
- (void) deleteBackward: | (id) | sender |
Definition at line 903 of file CPCollectionView.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Archives the view to a coder.
aCoder | the object into which the view's data will be archived. |
Reimplemented from CPView.
Definition at line 1008 of file CPCollectionView.j.
- (CGRect) frameForItemAtIndex: | (unsigned) | anIndex |
Definition at line 791 of file CPCollectionView.j.
- (CGRect) frameForItemsAtIndexes: | (CPIndexSet) | anIndexSet |
Definition at line 796 of file CPCollectionView.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Initializes the view from an archive.
aCoder | the coder from which to initialize |
Reimplemented from CPView.
Definition at line 972 of file CPCollectionView.j.
- (id) initWithFrame: | (CGRect) | aFrame |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPView.
Definition at line 97 of file CPCollectionView.j.
- (BOOL) isFirstResponder |
Returns whether the receiver is currently the first responder.
Definition at line 228 of file CPCollectionView.j.
- (BOOL) isSelectable |
Returns YES
if the collection view is selectable, and NO
otherwise.
Definition at line 291 of file CPCollectionView.j.
- (CPCollectionViewItem) itemAtIndex: | (unsigned) | anIndex |
Definition at line 786 of file CPCollectionView.j.
- (CPCollectionViewItem) itemPrototype |
Returns the current item prototype
Definition at line 185 of file CPCollectionView.j.
- (CPArray) items |
Returns the collection view items.
Definition at line 261 of file CPCollectionView.j.
- (void) keyDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has pressed a key.
anEvent | information about the key press |
Reimplemented from CPResponder.
Definition at line 918 of file CPCollectionView.j.
- (CGSize) maxItemSize |
Returns the current maximum item size.
Definition at line 588 of file CPCollectionView.j.
- (unsigned) maxNumberOfColumns |
Returns the maximum number of columns
Definition at line 527 of file CPCollectionView.j.
- (unsigned) maxNumberOfRows |
Returns the maximum number of rows.
Definition at line 505 of file CPCollectionView.j.
Reimplemented from CPView.
Definition at line 767 of file CPCollectionView.j.
- (CGSize) minItemSize |
Returns the current minimum item size
Definition at line 566 of file CPCollectionView.j.
- (void) mouseDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has clicked the mouse down in its area.
anEvent | contains information about the click |
Reimplemented from CPView.
Definition at line 623 of file CPCollectionView.j.
- (void) mouseDragged: | (CPEvent) | anEvent |
Notifies the receiver that the user has initiated a drag over it. A drag is a mouse movement while the left button is down.
anEvent | contains information about the drag |
Reimplemented from CPResponder.
Definition at line 666 of file CPCollectionView.j.
- (void) mouseUp: | (CPEvent) | anEvent |
Notifies the receiver that the user has released the left mouse button.
anEvent | contains information about the release |
Reimplemented from CPResponder.
Definition at line 617 of file CPCollectionView.j.
- (void) moveDown: | (id) | sender |
Definition at line 875 of file CPCollectionView.j.
- (void) moveDownAndModifySelection: | (id) | sender |
Definition at line 880 of file CPCollectionView.j.
- (void) moveLeft: | (id) | sender |
Definition at line 847 of file CPCollectionView.j.
- (void) moveLeftAndModifySelection: | (id) | sender |
Definition at line 856 of file CPCollectionView.j.
- (void) moveRight: | (id) | sender |
Definition at line 865 of file CPCollectionView.j.
- (void) moveRightAndModifySelection: | (id) | sender |
Definition at line 870 of file CPCollectionView.j.
- (void) moveUp: | (id) | sender |
Definition at line 885 of file CPCollectionView.j.
- (void) moveUpAndModifySelection: | (id) | sender |
Definition at line 894 of file CPCollectionView.j.
- (CPCollectionViewItem) newItemForRepresentedObject: | (id) | anObject |
Returns a collection view item for anObject
.
anObject | the object to be represented. |
Definition at line 194 of file CPCollectionView.j.
- (unsigned) numberOfColumns |
Returns the current number of columns
Definition at line 544 of file CPCollectionView.j.
- (unsigned) numberOfRows |
Returns the current number of rows
Definition at line 535 of file CPCollectionView.j.
- (void) pasteboard: | (CPPasteboard) | aPasteboard | |
provideDataForType: | (CPString) | aType | |
Places the selected items on the specified pasteboard. The items are requested from the collection's delegate.
aPasteboard | the pasteboard to put the items on |
aType | the format the pasteboard data |
Definition at line 716 of file CPCollectionView.j.
- (CGRect) rectForItemAtIndex: | (int) | anIndex |
Definition at line 927 of file CPCollectionView.j.
- (CGRect) rectForItemsAtIndexes: | (CPIndexSet) | anIndexSet |
Definition at line 936 of file CPCollectionView.j.
- (void) reloadContent |
Definition at line 367 of file CPCollectionView.j.
- (void) resizeSubviewsWithOldSize: | (CGSize) | aSize |
Initiates -superviewSizeChanged
: messages to subviews.
aSize | the size for the subviews |
Reimplemented from CPView.
Definition at line 482 of file CPCollectionView.j.
- (CPIndexSet) selectionIndexes |
Returns a set of the selected indices.
Definition at line 361 of file CPCollectionView.j.
- (void) setAllowsEmptySelection: | (BOOL) | shouldAllowEmptySelection |
Sets whether the user may have no items selected. If YES, mouse clicks not on any item will empty the current selection. The first item will also start off as selected.
shouldAllowMultipleSelection | YES allows the user to select multiple items |
Definition at line 300 of file CPCollectionView.j.
- (void) setAllowsMultipleSelection: | (BOOL) | shouldAllowMultipleSelection |
Sets whether the user can select multiple items.
shouldAllowMultipleSelection | YES allows the user to select multiple items |
Definition at line 317 of file CPCollectionView.j.
- (void) setBackgroundColors: | (CPArray) | backgroundColors |
Definition at line 593 of file CPCollectionView.j.
- (void) setContent: | (CPArray) | anArray |
Sets the content of the collection view to the content in anArray
. This array can be of any type, and each element will be passed to the -setRepresentedObject
: method. It's the responsibility of your custom collection view item to interpret the object.
anArray | the content array |
Definition at line 240 of file CPCollectionView.j.
- (void) setDelegate: | (id) | aDelegate |
Sets the collection view's delegate
aDelegate | the new delegate |
Definition at line 751 of file CPCollectionView.j.
- (void) setItemPrototype: | (CPCollectionViewItem) | anItem |
Sets the item prototype to anItem
The item prototype should implement the CPCoding protocol because the item is copied by archiving and unarchiving the prototypal view.
Example:
MyCustomView : CPCollectionViewItem { CPArray items; }
This will allow the collection view to create multiple 'clean' copies of the item prototype which will maintain the original values for item and all of the properties archived by the super class.
anItem | the new item prototype |
Definition at line 172 of file CPCollectionView.j.
- (void) setMaxItemSize: | (CGSize) | aSize |
Sets the maximum item size.
aSize | the new maximum item size |
Definition at line 575 of file CPCollectionView.j.
- (void) setMaxNumberOfColumns: | (unsigned) | aMaxNumberOfColumns |
Sets the maximum number of columns.
aMaxNumberOfColumns | the new maximum number of columns |
Definition at line 514 of file CPCollectionView.j.
- (void) setMaxNumberOfRows: | (unsigned) | aMaxNumberOfRows |
Sets the maximum number of rows.
aMaxNumberOfRows | the new maximum number of rows |
Definition at line 492 of file CPCollectionView.j.
- (void) setMinItemSize: | (CGSize) | aSize |
Sets the minimum size for an item
aSize | the new minimum item size |
Definition at line 553 of file CPCollectionView.j.
- (void) setSelectable: | (BOOL) | isSelectable |
Sets whether the user is allowed to select items
isSelectable | YES allows the user to select items. |
Definition at line 271 of file CPCollectionView.j.
- (void) setSelectionIndexes: | (CPIndexSet) | anIndexSet |
Sets the selected items based on the provided indices.
anIndexSet | the set of items to be selected |
Definition at line 334 of file CPCollectionView.j.
- (void) setVerticalMargin: | (float) | aVerticalMargin |
Sets the collection view's vertical spacing between elements.
aVerticalMargin | the number of pixels to place between elements |
Definition at line 728 of file CPCollectionView.j.
- (void) tile |
Definition at line 404 of file CPCollectionView.j.
- (float) verticalMargin |
Gets the collection view's current vertical spacing between elements.
Definition at line 742 of file CPCollectionView.j.