API  0.9.7
 All Classes Files Functions Variables Macros Groups Pages
CPCollectionView Class Reference

#import <CPCollectionView.h>

+ Inheritance diagram for CPCollectionView:

Instance Methods

(BOOL) - acceptsFirstResponder
 
(BOOL) - allowsEmptySelection
 
(BOOL) - allowsMultipleSelection
 
(CPArray) - backgroundColors
 
(CPArray) - content
 
(id) - delegate
 
(void) - deleteBackward:
 
(void) - displayItems:frameSize:itemSize:columns:rows:count:
 
(void) - draggingEnded:
 
(CPDragOperation) - draggingEntered:
 
(void) - draggingExited:
 
(CPDragOperation) - draggingUpdated:
 
(CPView- draggingViewForItemsAtIndexes:withEvent:offset:
 
(void) - encodeWithCoder:
 
(CGRect) - frameForItemAtIndex:
 
(CGRect) - frameForItemsAtIndexes:
 
(id) - initWithCoder:
 
(id) - initWithFrame:
 
(BOOL) - isFirstResponder
 
(BOOL) - isSelectable
 
(CPCollectionViewItem- itemAtIndex:
 
(CPCollectionViewItem- itemPrototype
 
(CPArray) - items
 
(void) - keyDown:
 
(CGSize) - maxItemSize
 
(unsigned) - maxNumberOfColumns
 
(unsigned) - maxNumberOfRows
 
(CPMenu- menuForEvent:
 
(CGSize) - minItemSize
 
(void) - mouseDown:
 
(void) - mouseDragged:
 
(void) - mouseUp:
 
(void) - moveDown:
 
(void) - moveDownAndModifySelection:
 
(void) - moveLeft:
 
(void) - moveLeftAndModifySelection:
 
(void) - moveRight:
 
(void) - moveRightAndModifySelection:
 
(void) - moveUp:
 
(void) - moveUpAndModifySelection:
 
(CPCollectionViewItem- newItemForRepresentedObject:
 
(unsigned) - numberOfColumns
 
(unsigned) - numberOfRows
 
(void) - pasteboard:provideDataForType:
 
(BOOL) - performDragOperation:
 
(CGRect) - rectForItemAtIndex:
 
(CGRect) - rectForItemsAtIndexes:
 
(void) - reloadContent
 
(void) - resizeSubviewsWithOldSize:
 
(void) - resizeWithOldSuperviewSize:
 
(CPIndexSet- selectionIndexes
 
(void) - setAllowsEmptySelection:
 
(void) - setAllowsMultipleSelection:
 
(void) - setAutoresizingMask:
 
(void) - setBackgroundColors:
 
(void) - setContent:
 
(void) - setDelegate:
 
(void) - setItemPrototype:
 
(void) - setMaxItemSize:
 
(void) - setMaxNumberOfColumns:
 
(void) - setMaxNumberOfRows:
 
(void) - setMinItemSize:
 
(void) - setSelectable:
 
(void) - setSelectionIndexes:
 
(void) - setUniformSubviewsResizing:
 
(void) - setVerticalMargin:
 
(void) - tile
 
(void) - tileIfNeeded:
 
(BOOL) - uniformSubviewsResizing
 
(float) - verticalMargin
 

Detailed Description

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.

Delegate Methods

- (void)collectionViewDidChangeSelection:(CPCollectionView)collectionView; DEPRECATED: Please do not use.

Parameters
collectionViewthe 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.

Parameters
collectionViewthe collection view that received the double-click
indexthe 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.

Parameters
collectionViewthe collection view to obtain data for
indicesthe indices to return data for
aTypethe data type
Returns
a data object containing the index items

- (CPArray)collectionView:(CPCollectionView)collectionView dragTypesForItemsAtIndexes:(CPIndexSet)indices; Invoked to obtain the data types supported by the specified indices for placement on the pasteboard.

Parameters
collectionViewthe collection view the items reside in
indicesthe indices to obtain drag types
Returns
an array of drag types (CPString)

Definition at line 2 of file CPCollectionView.h.

Method Documentation

- (BOOL) acceptsFirstResponder
implementation

Returns YES by default.

Definition at line 247 of file CPCollectionView.j.

- (BOOL) allowsEmptySelection
implementation

Returns YES if the user can select no items, NO otherwise.

Definition at line 339 of file CPCollectionView.j.

- (BOOL) allowsMultipleSelection
implementation

Returns YES if the user can select multiple items, NO otherwise.

Definition at line 356 of file CPCollectionView.j.

- (CPArray) backgroundColors
implementation

Definition at line 741 of file CPCollectionView.j.

- (CPArray) content
implementation

Returns the collection view content array

Definition at line 282 of file CPCollectionView.j.

- (id) delegate
implementation

Returns the collection view's delegate

Definition at line 851 of file CPCollectionView.j.

- (void) deleteBackward: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1295 of file CPCollectionView.j.

- (void) displayItems: (CPArray)  displayItems
frameSize: (CGSize)  aFrameSize
itemSize: (CGSize)  anItemSize
columns: (CPInteger)  numberOfColumns
rows: (CPInteger)  numberOfRows
count: (CPInteger)  displayCount 
implementation

Definition at line 550 of file CPCollectionView.j.

- (void) draggingEnded: (id)  draggingInfo
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 1076 of file CPCollectionView.j.

- (CPDragOperation) draggingEntered: (id)  draggingInfo
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 1017 of file CPCollectionView.j.

- (void) draggingExited: (id)  draggingInfo
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 1071 of file CPCollectionView.j.

- (CPDragOperation) draggingUpdated: (id)  draggingInfo
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 1032 of file CPCollectionView.j.

- (CPView) draggingViewForItemsAtIndexes: (CPIndexSet indexes
withEvent: (CPEvent event
offset: (CGPoint)  dragImageOffset 
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 997 of file CPCollectionView.j.

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Provided by category CPCollectionView(CPCoding).

Definition at line 1379 of file CPCollectionView.j.

- (CGRect) frameForItemAtIndex: (CPUInteger)  anIndex
implementation

Definition at line 890 of file CPCollectionView.j.

- (CGRect) frameForItemsAtIndexes: (CPIndexSet anIndexSet
implementation

Definition at line 895 of file CPCollectionView.j.

- (id) initWithCoder: (CPCoder aCoder
implementation

Provided by category CPCollectionView(CPCoding).

Definition at line 1354 of file CPCollectionView.j.

- (id) initWithFrame: (CGRect)  aFrame
implementation

Definition at line 109 of file CPCollectionView.j.

- (BOOL) isFirstResponder
implementation

Returns whether the receiver is currently the first responder.

Definition at line 255 of file CPCollectionView.j.

- (BOOL) isSelectable
implementation

Returns YES if the collection view is selectable, and NO otherwise.

Definition at line 322 of file CPCollectionView.j.

- (CPCollectionViewItem) itemAtIndex: (CPUInteger)  anIndex
implementation

Definition at line 885 of file CPCollectionView.j.

- (CPCollectionViewItem) itemPrototype
implementation

Returns the current item prototype

Definition at line 218 of file CPCollectionView.j.

- (CPArray) items
implementation

Returns the collection view items.

Definition at line 290 of file CPCollectionView.j.

- (void) keyDown: (CPEvent anEvent
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1310 of file CPCollectionView.j.

- (CGSize) maxItemSize
implementation

Returns the current maximum item size.

Definition at line 717 of file CPCollectionView.j.

- (unsigned) maxNumberOfColumns
implementation

Returns the maximum number of columns

Definition at line 647 of file CPCollectionView.j.

- (unsigned) maxNumberOfRows
implementation

Returns the maximum number of rows.

Definition at line 625 of file CPCollectionView.j.

- (CPMenu) menuForEvent: (CPEvent theEvent
implementation

Definition at line 859 of file CPCollectionView.j.

- (CGSize) minItemSize
implementation

Returns the current minimum item size

Definition at line 692 of file CPCollectionView.j.

- (void) mouseDown: (CPEvent anEvent
implementation

Definition at line 752 of file CPCollectionView.j.

- (void) mouseDragged: (CPEvent anEvent
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 939 of file CPCollectionView.j.

- (void) mouseUp: (CPEvent anEvent
implementation

Definition at line 746 of file CPCollectionView.j.

- (void) moveDown: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1267 of file CPCollectionView.j.

- (void) moveDownAndModifySelection: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1272 of file CPCollectionView.j.

- (void) moveLeft: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1239 of file CPCollectionView.j.

- (void) moveLeftAndModifySelection: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1248 of file CPCollectionView.j.

- (void) moveRight: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1257 of file CPCollectionView.j.

- (void) moveRightAndModifySelection: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1262 of file CPCollectionView.j.

- (void) moveUp: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1277 of file CPCollectionView.j.

- (void) moveUpAndModifySelection: (id)  sender
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1286 of file CPCollectionView.j.

- (CPCollectionViewItem) newItemForRepresentedObject: (id)  anObject
implementation

Returns a collection view item for anObject.

Parameters
anObjectthe object to be represented.

Definition at line 227 of file CPCollectionView.j.

- (unsigned) numberOfColumns
implementation

Returns the current number of columns

Definition at line 664 of file CPCollectionView.j.

- (unsigned) numberOfRows
implementation

Returns the current number of rows

Definition at line 655 of file CPCollectionView.j.

- (void) pasteboard: (CPPasteboard aPasteboard
provideDataForType: (CPString aType 
implementation

Places the selected items on the specified pasteboard. The items are requested from the collection's delegate.

Parameters
aPasteboardthe pasteboard to put the items on
aTypethe format the pasteboard data

Provided by category CPCollectionView(DragAndDrop).

Definition at line 923 of file CPCollectionView.j.

- (BOOL) performDragOperation: (id)  draggingInfo
implementation

Provided by category CPCollectionView(DragAndDrop).

Definition at line 1092 of file CPCollectionView.j.

- (CGRect) rectForItemAtIndex: (int)  anIndex
implementation

Provided by category CPCollectionView(Deprecated).

Definition at line 1324 of file CPCollectionView.j.

- (CGRect) rectForItemsAtIndexes: (CPIndexSet anIndexSet
implementation

Provided by category CPCollectionView(Deprecated).

Definition at line 1333 of file CPCollectionView.j.

- (void) reloadContent
implementation

Definition at line 404 of file CPCollectionView.j.

- (void) resizeSubviewsWithOldSize: (CGSize)  oldBoundsSize
implementation

Definition at line 448 of file CPCollectionView.j.

- (void) resizeWithOldSuperviewSize: (CGSize)  oldBoundsSize
implementation

Definition at line 453 of file CPCollectionView.j.

- (CPIndexSet) selectionIndexes
implementation

Returns a set of the selected indices.

Definition at line 399 of file CPCollectionView.j.

- (void) setAllowsEmptySelection: (BOOL)  shouldAllowEmptySelection
implementation

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.

Parameters
shouldAllowMultipleSelectionYES allows the user to select multiple items

Definition at line 331 of file CPCollectionView.j.

- (void) setAllowsMultipleSelection: (BOOL)  shouldAllowMultipleSelection
implementation

Sets whether the user can select multiple items.

Parameters
shouldAllowMultipleSelectionYES allows the user to select multiple items

Definition at line 348 of file CPCollectionView.j.

- (void) setAutoresizingMask: (unsigned)  aMask
implementation

Provided by category CPCollectionView(KeyboardInteraction).

Definition at line 1315 of file CPCollectionView.j.

- (void) setBackgroundColors: (CPArray)  backgroundColors
implementation

Definition at line 722 of file CPCollectionView.j.

- (void) setContent: (CPArray)  anArray
implementation

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.

If the new content array is smaller than the previous one, note that [receiver selectionIndexes] may refer to out of range indices. selectionIndexes is not changed as a result of calling the setContent: method.

Parameters
anArraya content array

Definition at line 272 of file CPCollectionView.j.

- (void) setDelegate: (id)  aDelegate
implementation

Sets the collection view's delegate

Parameters
aDelegatethe new delegate

Definition at line 843 of file CPCollectionView.j.

- (void) setItemPrototype: (CPCollectionViewItem anItem
implementation
Sets the item prototype to \c anItem
Parameters
anItemthe new item prototype.
Note
  • If anItem is located in an external cib file, representedObject, outlets, and bindings will be automatically restored when an item is created.
  • If anItem and its view belong to the same cib as the collection view, the item prototype should implement the CPCoding protocol because the item is copied by archiving and unarchiving the prototypal view.
Bindings won't be restored through archiving, instead you need to subclass the -representedObject: method and update the view there.
Example:
@implementation MyCustomPrototypeItem: CPCollectionViewItem
{
@outlet CPTextField textField;
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
textField = [aCoder decodeObjectForKey:@"TextField"];
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeConditionalObject:textField forKey:@"TextField"];
}
- (void)setRepresentedObject:(id)anObject
{
[super setRepresentedObject:anObject];
[textField setStringValue:[anObject objectForKey:@"value"]];
[[self view] setColor:[anObject objectForKey:@"color"]];
}
@end

Definition at line 205 of file CPCollectionView.j.

- (void) setMaxItemSize: (CGSize)  aSize
implementation

Sets the maximum item size.

Parameters
aSizethe new maximum item size

Definition at line 701 of file CPCollectionView.j.

- (void) setMaxNumberOfColumns: (unsigned)  aMaxNumberOfColumns
implementation

Sets the maximum number of columns.

Parameters
aMaxNumberOfColumnsthe new maximum number of columns

Definition at line 634 of file CPCollectionView.j.

- (void) setMaxNumberOfRows: (unsigned)  aMaxNumberOfRows
implementation

Sets the maximum number of rows.

Parameters
aMaxNumberOfRowsthe new maximum number of rows

Definition at line 612 of file CPCollectionView.j.

- (void) setMinItemSize: (CGSize)  aSize
implementation

Sets the minimum size for an item

Parameters
aSizethe new minimum item size

Definition at line 673 of file CPCollectionView.j.

- (void) setSelectable: (BOOL)  isSelectable
implementation

Sets whether the user is allowed to select items

Parameters
isSelectableYES allows the user to select items.

Definition at line 300 of file CPCollectionView.j.

- (void) setSelectionIndexes: (CPIndexSet anIndexSet
implementation

Sets the selected items based on the provided indices.

Parameters
anIndexSetthe set of items to be selected

Definition at line 365 of file CPCollectionView.j.

- (void) setUniformSubviewsResizing: (BOOL)  flag
implementation

Synthesized accessor method.

Provided by category CPCollectionView(CPSynthesizedAccessors).

Definition at line 823 of file CPCollectionView.j.

- (void) setVerticalMargin: (float)  aVerticalMargin
implementation

Sets the collection view's vertical spacing between elements.

Parameters
aVerticalMarginthe number of pixels to place between elements

Definition at line 813 of file CPCollectionView.j.

- (void) tile
implementation

Definition at line 465 of file CPCollectionView.j.

- (void) tileIfNeeded: (BOOL)  lazyFlag
implementation

Definition at line 470 of file CPCollectionView.j.

- (BOOL) uniformSubviewsResizing
implementation

Synthesized accessor method.

Provided by category CPCollectionView(CPSynthesizedAccessors).

Definition at line 1407 of file CPCollectionView.j.

- (float) verticalMargin
implementation

Gets the collection view's current vertical spacing between elements.

Definition at line 834 of file CPCollectionView.j.


The documentation for this class was generated from the following files: