CPObjectCPResponder
CPView
CPCollectionView
@implementation CPCollectionView : CPView
This class presents an array of content as a grid of views.
Method Summary | |
---|---|
-(id) | initWithFrame:(CGRect)aFrame Initializes the receiver for usage with the specified bounding rectangle. |
-(BOOL) | acceptsFirstResponder Returns YES by default. |
-(BOOL) | allowsMultipleSelection Returns YES if the user can select multiple items, NO otherwise. |
-(CPArray) | content Returns the collection view content array. |
-(id) | delegate Returns the collection view's delegate. |
-(BOOL) | isFirstResponder Returns whether the receiver is currently the first responder. |
-(BOOL) | isSelected Returns YES if the collection view is
selected, and NO otherwise. |
-(CPCollectionViewItem) | itemPrototype Returns the current item prototype. |
-(CPArray) | items Returns the collection view items. |
-(CGSize) | maxItemSize Returns the current maximum item size. |
-(unsigned) | maxNumberOfColumns Returns the maximum number of columns. |
-(unsigned) | maxNumberOfRows Returns the maximum number of rows. |
-(CGSize) | minItemSize Returns the current minimum item size. |
-(void) | mouseDown:(CPEvent)anEvent Notifies the receiver that the user has clicked the mouse down in its area. |
-(void) | mouseDragged:(CPEvent)anEvent Notifies the receiver that the user has initiated a drag over it. |
-(void) | mouseUp:(CPEvent)anEvent Notifies the receiver that the user has released the left mouse button. |
-(CPCollectionViewItem) | newItemForRepresentedObject:(id)anObject Returns a collection view item for anObject . |
-(void) | pasteboard:(CPPasteboard)aPasteboard provideDataForType:(CPString)aType Places the selected items on the specified pasteboard. |
-(void) | resizeSubviewsWithOldSize:(CGSize)aSize Initiates superviewSizeChanged: messages to subviews. |
-(CPIndexSet) | selectionIndexes Returns a set of the selected indices. |
-(void) | setAllowsMultipleSelection:(BOOL)shouldAllowMultipleSelection Sets whether the user can select multiple items. |
-(void) | setContent:(CPArray)anArray Sets the content of the collection view to the content in anArray . |
-(void) | setDelegate:(id)aDelegate Sets the collection view's delegate. |
-(void) | setItemPrototype:(CPCollectionViewItem)anItem Sets the item prototype to anItem . |
-(void) | setMaxItemSize:(CGSize)aSize Sets the maximum item size. |
-(void) | setMaxNumberOfColumns:(unsigned)aMaxNumberOfColumns Sets the maximum number of columns. |
-(void) | setMaxNumberOfRows:(unsigned)aMaxNumberOfRows Sets the maximum number of rows. |
-(void) | setMinItemSize:(CGSize)aSize Sets the minimum size for an item. |
-(void) | setSelectable:(BOOL)isSelectable Sets whether the user is allowed to select items. |
-(void) | setSelectionIndexes:(CPIndexSet)anIndexSet Sets the selected items based on the provided indices. |
-(void) | setVerticalMargin:(float)aVerticalMargin |
Delegate Method Summary | |
---|---|
-(void) | collectionViewDidChangeSelection:(CPCollectionView)collectionView Called when the selection in the collection view has changed. |
-(void) | collectionView:(CPCollectionView)collectionView didDoubleClickOnItemAtIndex:(int)index Called when the user double-clicks on an item in the collection view. |
-(CPData) | collectionView:(CPCollectionView)collectionView dataForItemsAtIndexes:(CPIndexSet)indices forType:(CPString)aType Invoked to obtain data for a set of indices. |
-(CPArray) | collectionView:(CPCollectionView)collectionView dragTypesForItemsAtIndexes:(CPIndexSet)indices Invoked to obtain the data types supported by the specified indices for placement on the pasteboard. |
Method Detail |
---|
-(id)initWithFrame:(CGRect)aFrame
aFrame
-(BOOL)acceptsFirstResponder
YES
by default.-(BOOL)allowsMultipleSelection
YES
if the user can select multiple items, NO
otherwise.-(CPArray)content
-(id)delegate
-(BOOL)isFirstResponder
-(BOOL)isSelected
YES
if the collection view is
selected, and NO
otherwise.-(CPCollectionViewItem)itemPrototype
-(CPArray)items
-(CGSize)maxItemSize
-(unsigned)maxNumberOfColumns
-(unsigned)maxNumberOfRows
-(CGSize)minItemSize
-(void)mouseDown:(CPEvent)anEvent
anEvent
- contains information about the click-(void)mouseDragged:(CPEvent)anEvent
anEvent
- contains information about the drag-(void)mouseUp:(CPEvent)anEvent
anEvent
- contains information about the release-(CPCollectionViewItem)newItemForRepresentedObject:(id)anObject
anObject
.anObject
- the object to be represented.-(void)pasteboard:(CPPasteboard)aPasteboard provideDataForType:(CPString)aType
aPasteboard
- the pasteboard to put the items onaType
- the format the pasteboard data-(void)resizeSubviewsWithOldSize:(CGSize)aSize
superviewSizeChanged:
messages to subviews.aSize
- the size for the subviews-(CPIndexSet)selectionIndexes
-(void)setAllowsMultipleSelection:(BOOL)shouldAllowMultipleSelection
shouldAllowMultipleSelection
- YES
allows the user to select multiple items-(void)setContent:(CPArray)anArray
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-(void)setDelegate:(id)aDelegate
aDelegate
- the new delegate-(void)setItemPrototype:(CPCollectionViewItem)anItem
anItem
anItem
- the new item prototype-(void)setMaxItemSize:(CGSize)aSize
aSize
- the new maximum item size-(void)setMaxNumberOfColumns:(unsigned)aMaxNumberOfColumns
aMaxNumberOfColumns
- the new maximum number of columns-(void)setMaxNumberOfRows:(unsigned)aMaxNumberOfRows
aMaxNumberOfRows
- the new maximum number of rows-(void)setMinItemSize:(CGSize)aSize
aSize
- the new minimum item size-(void)setSelectable:(BOOL)isSelectable
isSelectable
- YES
allows the user to select items.-(void)setSelectionIndexes:(CPIndexSet)anIndexSet
anIndexSet
- the set of items to be selected-(void)setVerticalMargin:(float)aVerticalMargin
aVerticalMargin
Delegate Method Detail |
---|
-(void)collectionViewDidChangeSelection:(CPCollectionView)collectionView
collectionView
- the collection view who's selection changed-(void)collectionView:(CPCollectionView)collectionView didDoubleClickOnItemAtIndex:(int)index
collectionView
- the collection view that received the double-clickindex
- the index of the item that received the double-click-(CPData)collectionView:(CPCollectionView)collectionView dataForItemsAtIndexes:(CPIndexSet)indices forType:(CPString)aType
collectionView
- the collection view to obtain data forindices
- the indices to return data foraType
- the data type-(CPArray)collectionView:(CPCollectionView)collectionView dragTypesForItemsAtIndexes:(CPIndexSet)indices
collectionView
- the collection view the items reside inindices
- the indices to obtain drag typesCPString
)
Created on Sat Sep 13 14:15:43 PDT 2008