API 0.9.5
CPTableView Class Reference

#import <CPTableView.h>

Inheritance diagram for CPTableView:

List of all members.

Instance Methods

(BOOL) - acceptsFirstResponder
(void) - addTableColumn:
(BOOL) - allowsColumnReordering
(BOOL) - allowsColumnResizing
(BOOL) - allowsColumnSelection
(BOOL) - allowsEmptySelection
(BOOL) - allowsMultipleSelection
(CPArray- alternatingRowBackgroundColors
(CPString- autosaveName
(BOOL) - autosaveTableColumns
(BOOL) - becomeFirstResponder
(BOOL) - canDragRowsWithIndexes:atPoint:
(CPInteger) - clickedRow
(CPInteger) - columnAtPoint:
(unsigned) - columnAutoresizingStyle
(CPIndexSet- columnIndexesInRect:
(CPInteger) - columnWithIdentifier:
(void) - concludeDragOperation:
(BOOL) - continueTracking:at:
(void) - controlTextDidBlur:
(CPView- cornerView
(id) - dataSource
(id) - delegate
(void) - deselectAll
(void) - deselectColumn:
(void) - deselectRow:
(BOOL) - disableAutomaticResizing
(SEL) - doubleAction
(void) - draggedImage:endedAt:operation:
(void) - draggedView:endedAt:operation:
(CPTableViewDraggingDestinationFeedbackStyle) - draggingDestinationFeedbackStyle
(void) - draggingEnded:
(CPDragOperation) - draggingEntered:
(void) - draggingExited:
(CPDragOperation) - draggingUpdated:
(CPImage- dragImageForRowsWithIndexes:tableColumns:event:offset:
(CPView- dragViewForRowsWithIndexes:tableColumns:event:offset:
(void) - drawBackgroundInClipRect:
(void) - drawGridInClipRect:
(void) - drawRow:clipRect:
(void) - editColumn:row:withEvent:select:
(CPInteger) - editedColumn
(CPInteger) - editedRow
(void) - encodeWithCoder:
(CGRect) - exposedRect
(CGRect) - frameOfDataViewAtColumn:row:
(CPColor- gridColor
(unsigned) - gridStyleMask
(CPView- headerView
(CPTableColumn- highlightedTableColumn
(void) - highlightSelectionInClipRect:
(id) - initWithCoder:
(id) - initWithFrame:
(CGSize) - intercellSpacing
(BOOL) - isColumnSelected:
(BOOL) - isRowSelected:
(void) - keyDown:
(void) - layoutSubviews
(void) - load
(CPMenu- menuForEvent:
(void) - moveColumn:toColumn:
(void) - noteHeightOfRowsWithIndexesChanged:
(void) - noteNumberOfRowsChanged
(int) - numberOfColumns
(int) - numberOfRows
(CPInteger) - numberOfSelectedColumns
(CPInteger) - numberOfSelectedRows
(BOOL) - performDragOperation:
(BOOL) - prepareForDragOperation:
(CGRect) - rectOfColumn:
(CGRect) - rectOfRow:
(void) - reloadData
(void) - reloadDataForRowIndexes:columnIndexes:
(void) - removeTableColumn:
(void) - resizeWithOldSuperviewSize:
(CPInteger) - rowAtPoint:
(unsigned) - rowHeight
(CPRange) - rowsInRect:
(void) - scrollColumnToVisible:
(void) - scrollRowToVisible:
(void) - selectColumnIndexes:byExtendingSelection:
(int) - selectedColumn
(CPIndexSet- selectedColumnIndexes
(int) - selectedRow
(CPIndexSet- selectedRowIndexes
(CPDictionary- selectionGradientColors
(CPColor- selectionHighlightColor
(unsigned) - selectionHighlightStyle
(void) - selectRowIndexes:byExtendingSelection:
(void) - setAllowsColumnReordering:
(void) - setAllowsColumnResizing:
(void) - setAllowsColumnSelection:
(void) - setAllowsEmptySelection:
(void) - setAllowsMultipleSelection:
(void) - setAlternatingRowBackgroundColors:
(void) - setAutosaveName:
(void) - setAutosaveTableColumns:
(void) - setBoundsOrigin:
(void) - setBoundsSize:
(void) - setColumnAutoresizingStyle:
(void) - setContent:
(void) - setCornerView:
(void) - setDataSource:
(void) - setDelegate:
(void) - setDisableAutomaticResizing:
(void) - setDoubleAction:
(void) - setDraggingDestinationFeedbackStyle:
(void) - setDraggingSourceOperationMask:forLocal:
(void) - setDropRow:dropOperation:
(void) - setFrameOrigin:
(void) - setFrameSize:
(void) - setGridColor:
(void) - setGridStyleMask:
(void) - setHeaderView:
(void) - setHighlightedTableColumn:
(void) - setIndicatorImage:inTableColumn:
(void) - setIntercellSpacing:
(void) - setNeedsDisplay:
(void) - setRowHeight:
(void) - setSelectionGradientColors:
(void) - setSelectionHighlightColor:
(void) - setSelectionHighlightStyle:
(void) - setSortDescriptors:
(void) - setUsesAlternatingRowBackgroundColors:
(void) - setVerticalMotionCanBeginDrag:
(void) - sizeLastColumnToFit
(CPArray- sortDescriptors
(BOOL) - startTrackingAt:
(void) - stopTracking:at:mouseIsUp:
(void) - superviewBoundsChanged:
(void) - superviewFrameChanged:
(CPArray- tableColumns
(CPTableColumn- tableColumnWithIdentifier:
(void) - tile
(void) - trackMouse:
(BOOL) - tracksMouseOutsideOfFrame
(BOOL) - usesAlternatingRowBackgroundColors
(BOOL) - verticalMotionCanBeginDrag
(void) - viewWillMoveToSuperview:
(BOOL) - wantsPeriodicDraggingUpdates

Class Methods

(CPString+ defaultThemeClass
(id) + themeAttributes

Detailed Description

CPTableView object displays record-oriented data in a table and allows the user to edit values and resize and rearrange columns. A CPTableView requires you to either set a data source which implements numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:, or alternatively to provide data through Key Value Bindings.

To use a table view with Key Value Bindings, bind each column's CPValueBinding to an array.field path - typically this would be to a path in an array controller like arrangedObjects.X, where X is the name of a field. Optionally also bind the table's selectionIndexes and sortDescriptors to the array controller.

All delegate and data source methods are documented in the setDataSource: and setDelegate: methods.

If you want to display something other than just text in the table you should call setDataView: on a CPTableColumn object. More documentation in that class including theme states.

Note:
CPTableView does not contain its own scrollview. You should be sure you place the tableview in a CPScrollView on your own.

Definition at line 2 of file CPTableView.h.


Method Documentation

- (BOOL) acceptsFirstResponder

Reimplemented from CPResponder.

Definition at line 4539 of file CPTableView.j.

- (void) addTableColumn: (CPTableColumn aTableColumn

Adds a given column as the last column of the receiver.

Parameters:
aColumnThe column to add to the receiver.

Reimplemented in CPOutlineView.

Definition at line 876 of file CPTableView.j.

- (BOOL) allowsColumnReordering

Returns YES if the user is allowed to reorder the columns, otherwise NO.

Definition at line 562 of file CPTableView.j.

- (BOOL) allowsColumnResizing

Returns YES if the user is allowed to manually resize the columns, otherwise NO.

Definition at line 579 of file CPTableView.j.

- (BOOL) allowsColumnSelection

Returns YES if the user is allowed to select a column by clicking it, otherwise NO.

Definition at line 634 of file CPTableView.j.

- (BOOL) allowsEmptySelection

Returns YES if the tableview is allowed to have an unselected row or column, otherwise NO.

Definition at line 615 of file CPTableView.j.

- (BOOL) allowsMultipleSelection

Returns YES if the tableview is allowed to have multiple selections, otherwise NO.

Returns:
BOOL - YES if the tableview is allowed to have multiple selections otherwise NO.

Definition at line 598 of file CPTableView.j.

- (CPArray) alternatingRowBackgroundColors

Returns an array of the alternating background colors

Definition at line 730 of file CPTableView.j.

- (CPString) autosaveName

Returns the autosave name of the tableview.

Definition at line 2210 of file CPTableView.j.

- (BOOL) autosaveTableColumns

Returns YES the table columns should autosave, otherwise NO.

Definition at line 2229 of file CPTableView.j.

- (BOOL) becomeFirstResponder

Reimplemented from CPResponder.

Definition at line 4531 of file CPTableView.j.

- (BOOL) canDragRowsWithIndexes: (CPIndexSet rowIndexes
atPoint: (CGPoint)  mouseDownPoint 

Returns whether the receiver allows dragging the rows at rowIndexes with a drag initiated at mousedDownPoint.

Parameters:
rowIndexesan index set of rows to be dragged
aPointthe point at which the mouse was clicked.

Definition at line 2769 of file CPTableView.j.

- (CPInteger) clickedRow

Returns the index of the the row the user clicked to trigger an action, or -1 if no row was clicked.

Definition at line 544 of file CPTableView.j.

- (CPInteger) columnAtPoint: (CGPoint)  aPoint

Returns the index of a column at a given point. If no column is there CPNotFound is returned.

Parameters:
aPointa CGPoint

Definition at line 1738 of file CPTableView.j.

- (unsigned) columnAutoresizingStyle

Returns the column auto resizing style of the receiver.

Definition at line 2014 of file CPTableView.j.

- (CPIndexSet) columnIndexesInRect: (CGRect)  aRect

Returns the indexes of the receiver's columns that intersect the specified rectangle.

Parameters:
aRecta rectangle in the coordinate system of the receiver.

Definition at line 1704 of file CPTableView.j.

- (CPInteger) columnWithIdentifier: (CPString anIdentifier

Returns the index of the column with the specified identifier

Parameters:
anIdentifierthe string value of the tablecolumn identifier
Returns:
the index of the column

Definition at line 1024 of file CPTableView.j.

- (void) concludeDragOperation: (id)  sender

Definition at line 4396 of file CPTableView.j.

- (BOOL) continueTracking: (CGPoint)  lastPoint
at: (CGPoint)  aPoint 

Reimplemented from CPControl.

Definition at line 4036 of file CPTableView.j.

- (void) controlTextDidBlur: (CPNotification theNotification

Blur notification handler for editing textfields. This will always be called when a textfield loses focus. This method is responsible for restoring the dataview to its non editable state.

Definition at line 3399 of file CPTableView.j.

- (CPView) cornerView

Returns the cornerview for the scrollview

Definition at line 1449 of file CPTableView.j.

- (id) dataSource

Returns the object that provides the data displayed by the receiver.

Reimplemented in CPOutlineView.

Definition at line 474 of file CPTableView.j.

+ (CPString) defaultThemeClass

Reimplemented from CPView.

Definition at line 243 of file CPTableView.j.

- (id) delegate

Returns the delegate object for the table view.

Reimplemented in CPOutlineView.

Definition at line 2569 of file CPTableView.j.

- (void) deselectAll

Deselects all rows

Definition at line 1354 of file CPTableView.j.

- (void) deselectColumn: (CPInteger)  anIndex

Deselects the column at a given index

Parameters:
anIndexthe index of the column to deselect

Definition at line 1291 of file CPTableView.j.

- (void) deselectRow: (CPInteger)  aRow

Deselects a row at a given index

Parameters:
aRowthe row to deselect

Definition at line 1304 of file CPTableView.j.

- (BOOL) disableAutomaticResizing

Synthesized accessor method.

Definition at line 5000 of file CPTableView.j.

- (SEL) doubleAction

Returns the double click action selector.

Definition at line 532 of file CPTableView.j.

- (void) draggedImage: (CPImage anImage
endedAt: (CGPoint)  aLocation
operation: (CPDragOperation)  anOperation 

Definition at line 4404 of file CPTableView.j.

- (void) draggedView: (CPImage aView
endedAt: (CGPoint)  aLocation
operation: (CPDragOperation)  anOperation 

Definition at line 4414 of file CPTableView.j.

- (CPTableViewDraggingDestinationFeedbackStyle) draggingDestinationFeedbackStyle

Returns the tableview dragging destination feedback style.

Can be:

        CPTableViewDraggingDestinationFeedbackStyleNone
        CPTableViewDraggingDestinationFeedbackStyleRegular
        CPTableViewDraggingDestinationFeedbackStyleSourceList

Definition at line 2947 of file CPTableView.j.

- (void) draggingEnded: (id)  sender

Definition at line 4218 of file CPTableView.j.

- (CPDragOperation) draggingEntered: (id)  sender

Definition at line 4185 of file CPTableView.j.

- (void) draggingExited: (id)  sender

Definition at line 4210 of file CPTableView.j.

- (CPDragOperation) draggingUpdated: (id)  sender

Definition at line 4326 of file CPTableView.j.

- (CPImage) dragImageForRowsWithIndexes: (CPIndexSet dragRows
tableColumns: (CPArray theTableColumns
event: (CPEvent dragEvent
offset: (CGPoint)  dragImageOffset 

Computes and returns an image to use for dragging. This method is invoked ONLY IF dragViewForRowsWithIndexes:tableColumns:event:offset: returns nil.

Parameters:
dragRowsan index set with the dragged row indexes
theTableColumnsan array of the table columns which are being dragged
dragEventthe event which initiated the drag
offseta point at which to set the drag image to be offset from the cursor
Returns:
CPImage an image to use for the drag feedback

Definition at line 2784 of file CPTableView.j.

- (CPView) dragViewForRowsWithIndexes: (CPIndexSet theDraggedRows
tableColumns: (CPArray theTableColumns
event: (CPEvent theDragEvent
offset: (CGPoint)  dragViewOffset 

Computes and returns a view to use for dragging. By default this is a slightly transparent copy of the dataviews which are being dragged. You can override this in a subclass to show different dragging feedback. Additionally you can return nil from this method and implement:

  • (CPImage)dragImageForRowsWithIndexes:tableColumns:event:offset: - if you want to return a simple image.
Parameters:
dragRowsan index set with the dragged row indexes
theTableColumnsan array of the table columns which are being dragged
dragEventthe event which initiated the drag
offseta point at which to set the drag image to be offset from the cursor
Returns:
CPView a view used as the dragging feedback

Definition at line 2801 of file CPTableView.j.

- (void) drawBackgroundInClipRect: (CGRect)  aRect

Draws the background in a given clip rect. This method should only be overridden if you want something other than a solid color or alternating row colors.

Note:
this method should not be called directly, instead use setNeedsDisplay:

Definition at line 3523 of file CPTableView.j.

- (void) drawGridInClipRect: (CGRect)  aRect

Draws the grid for the tableview based on the set grid mask in a given clip rect.

Note:
this method should not be called directly, instead use setNeedsDisplay:

Definition at line 3577 of file CPTableView.j.

- (void) drawRow: (CPInteger)  row
clipRect: (CGRect)  rect 

While this method doesn't do anything in Cappuccino, subclasses can override it to customize the appearance of a row.

Note:
tableView:willDisplayView:forTableColumn:row is sent to the delegate before drawing

Definition at line 3883 of file CPTableView.j.

- (void) editColumn: (CPInteger)  columnIndex
row: (CPInteger)  rowIndex
withEvent: (CPEvent theEvent
select: (BOOL)  flag 

Edits the dataview at a given row and column. This method is usually invoked automatically and should rarely be invoked directly The row at supplied rowIndex must be selected otherwise an exception is thrown.

Parameters:
columnIndexthe index of the column to edit
rowIndexthe index of the row to edit
theEventthe mouse event which triggers the edit, you can pass nil
flagYES if the dataview text should be selected, otherwise NO. (NOT YET IMPLEMENTED)

Definition at line 1406 of file CPTableView.j.

- (CPInteger) editedColumn

Returns the column of the currently edited cell, or CPNotFound if none.

Definition at line 1429 of file CPTableView.j.

- (CPInteger) editedRow

Returns the row of the currently edited cell, or CPNotFound if none.

Definition at line 1439 of file CPTableView.j.

- (void) encodeWithCoder: (CPCoder aCoder

Archives the view to a coder.

Parameters:
aCoderthe object into which the view's data will be archived.

Reimplemented from CPControl.

Reimplemented in CPOutlineView.

Definition at line 4792 of file CPTableView.j.

- (CGRect) exposedRect

Returns a CGRect of the exposed area of the tableview.

Definition at line 3083 of file CPTableView.j.

- (CGRect) frameOfDataViewAtColumn: (CPInteger)  aColumn
row: (CPInteger)  aRow 

Returns a rect for the dataview / cell at the column and row given. If the column or row index is greater than the number of columns or rows a CGZeroRect is returned

Parameters:
aColumnindex of the column
aRowindex of the row

Reimplemented in CPOutlineView.

Definition at line 1824 of file CPTableView.j.

- (CPColor) gridColor

Returns a CPColor object of set grid color

Definition at line 842 of file CPTableView.j.

- (unsigned) gridStyleMask

Returns a grid mask

Definition at line 865 of file CPTableView.j.

- (CPView) headerView

Returns the headerview for the receiver. The headerview contains column headerviews for each table column.

Definition at line 1473 of file CPTableView.j.

- (CPTableColumn) highlightedTableColumn

Returns the CPTableColumn object of the highlighted table column.

Definition at line 2738 of file CPTableView.j.

- (void) highlightSelectionInClipRect: (CGRect)  aRect

Draws the selection with the set selection highlight style in a given clip rect. You can change the highlight style to a source list style gradient in setSelectionHighlightStyle:

Note:
this method should not be called directly, instead use setNeedsDisplay:

Definition at line 3653 of file CPTableView.j.

- (id) initWithCoder: (CPCoder aCoder

Initializes the view from an archive.

Parameters:
aCoderthe coder from which to initialize
Returns:
the initialized view

Reimplemented from CPControl.

Reimplemented in CPOutlineView.

Definition at line 4742 of file CPTableView.j.

- (id) initWithFrame: (CGRect)  aFrame

Initializes the receiver for usage with the specified bounding rectangle

Returns:
the initialized view

Reimplemented from CPControl.

Reimplemented in CPOutlineView.

Definition at line 257 of file CPTableView.j.

- (CGSize) intercellSpacing

Returns the intercell spacing in a CGSize object.

Definition at line 666 of file CPTableView.j.

- (BOOL) isColumnSelected: (CPInteger)  anIndex

Returns YES if the column at a given index is selected, otherwise NO.

Parameters:
anIndexthe index of a column
Returns:
YES if the column is selected, otherwise NO.

Definition at line 1334 of file CPTableView.j.

- (BOOL) isRowSelected: (CPInteger)  aRow

Returns YES if the row at a given index is selected, otherwise NO.

Parameters:
aRowthe index of a row
Returns:
YES if the row is selected, otherwise NO.

Definition at line 1345 of file CPTableView.j.

- (void) keyDown: (CPEvent anEvent

Reimplemented from CPResponder.

Reimplemented in CPOutlineView.

Definition at line 4547 of file CPTableView.j.

- (void) layoutSubviews

Reimplemented from CPView.

Definition at line 3892 of file CPTableView.j.

- (void) load

Loads all the data and dataviews for the receiver.

Definition at line 3104 of file CPTableView.j.

- (CPMenu) menuForEvent: (CPEvent theEvent

Reimplemented from CPView.

Definition at line 4005 of file CPTableView.j.

- (void) moveColumn: (int)  theColumnIndex
toColumn: (int)  theToIndex 

Moves the column and heading at a given index to a new given index.

Parameters:
theColumnIndexThe current index of the column to move.
theToIndexThe new index for the moved column.

Definition at line 984 of file CPTableView.j.

- (void) noteHeightOfRowsWithIndexesChanged: (CPIndexSet anIndexSet

Informs the receiver that the rows specified in indexSet have changed height.

Parameters:
anIndexSetan index set containing the indexes of the rows which changed height

Definition at line 2093 of file CPTableView.j.

- (void) noteNumberOfRowsChanged

Informs the receiver that the number of records in the datasource has changed.

Definition at line 2055 of file CPTableView.j.

- (int) numberOfColumns

Returns the number of columns in the table

Definition at line 1363 of file CPTableView.j.

- (int) numberOfRows

Returns the number of rows in the receiver.

Definition at line 1371 of file CPTableView.j.

- (CPInteger) numberOfSelectedColumns

Returns the number of selected columns

Definition at line 1315 of file CPTableView.j.

- (CPInteger) numberOfSelectedRows

Returns the number of selected columns

Definition at line 1323 of file CPTableView.j.

- (BOOL) performDragOperation: (id)  sender

Definition at line 4381 of file CPTableView.j.

- (BOOL) prepareForDragOperation: (id)  sender

Definition at line 4369 of file CPTableView.j.

- (CGRect) rectOfColumn: (CPInteger)  aColumnIndex

Returns a CGRect with the location and size of the column If aColumnIndex lies outside the range of the table columns a CGZeroRect is returned

Parameters:
aColumnIndexthe index of the column to return the rect of

Definition at line 1560 of file CPTableView.j.

- (CGRect) rectOfRow: (CPInteger)  aRowIndex

Returns a CGRect with the location and size of the row. CGRectZero is returned if aRowIndex doesn't exist.

Parameters:
aRowIndexthe index of the row you want the rect of

Definition at line 1633 of file CPTableView.j.

- (void) reloadData

Reloads the data for all rows and columns.

Reimplemented in CPOutlineView.

Definition at line 496 of file CPTableView.j.

- (void) reloadDataForRowIndexes: (CPIndexSet rowIndexes
columnIndexes: (CPIndexSet columnIndexes 

Reloads the data for only the specified rows and columns.

Parameters:
rowIndexesThe indexes of the rows to update.
columnIndexesThe indexes of the columns to update.

Definition at line 486 of file CPTableView.j.

- (void) removeTableColumn: (CPTableColumn aTableColumn

Removes a given column from the receiver.

Parameters:
aTableColumnThe column to remove from the receiver.

Reimplemented in CPOutlineView.

Definition at line 905 of file CPTableView.j.

- (void) resizeWithOldSuperviewSize: (CGSize)  aSize

Reimplemented from CPView.

Definition at line 1842 of file CPTableView.j.

- (CPInteger) rowAtPoint: (CGPoint)  aPoint

Returns the index of a row at a particular point. If no row exists CPNotFound is returned.

Parameters:
aPointa CGPoint

Definition at line 1787 of file CPTableView.j.

- (unsigned) rowHeight

Returns the height of each row.

Definition at line 692 of file CPTableView.j.

- (CPRange) rowsInRect: (CGRect)  aRect

Returns a range of indices for the rows that lie wholly or partially within the vertical boundaries of a given rectangle.

Parameters:
aRectA rectangle in the coordinate system of the receiver.

Definition at line 1645 of file CPTableView.j.

- (void) scrollColumnToVisible: (int)  columnIndex

Scrolls the receiver and header view horizontally in an enclosing CPClipView so the column specified by columnIndex is visible.

Parameters:
aColumnIndexthe index of the column to scroll to.

Definition at line 2178 of file CPTableView.j.

- (void) scrollRowToVisible: (int)  rowIndex

Scrolls the receiver vertically in an enclosing CPClipView so the row specified by rowIndex is visible.

Parameters:
aRowIndexthe index of the row to scroll to.

Definition at line 2162 of file CPTableView.j.

- (void) selectColumnIndexes: (CPIndexSet columns
byExtendingSelection: (BOOL)  shouldExtendSelection 

Sets the column selection using indexes.

Parameters:
columnsa CPIndexSet of columns to select
aFlagshould extend the selection thereby retaining the previous selection

Definition at line 1068 of file CPTableView.j.

- (int) selectedColumn

Returns the index of the last selected column.

Definition at line 1257 of file CPTableView.j.

- (CPIndexSet) selectedColumnIndexes

Returns an index set of all the selected columns.

Definition at line 1265 of file CPTableView.j.

- (int) selectedRow

Returns the index of the last selected row.

Definition at line 1273 of file CPTableView.j.

- (CPIndexSet) selectedRowIndexes

Returns an index set with the indexes of all the selected rows.

Definition at line 1281 of file CPTableView.j.

- (CPDictionary) selectionGradientColors

Returns a dictionary of containing the keys:

    CPSourceListGradient
    CPSourceListTopLineColor
    CPSourceListBottomLineColor

Definition at line 823 of file CPTableView.j.

- (CPColor) selectionHighlightColor

Returns the highlight color for a row or column selection.

Definition at line 792 of file CPTableView.j.

- (unsigned) selectionHighlightStyle

Returns an enumerated value for the selection highlight style.

Valid values are:

        CPTableViewSelectionHighlightStyleNone
        CPTableViewSelectionHighlightStyleRegular
        CPTableViewSelectionHighlightStyleSourceList

Definition at line 746 of file CPTableView.j.

- (void) selectRowIndexes: (CPIndexSet rows
byExtendingSelection: (BOOL)  shouldExtendSelection 

Sets the row selection using indexes.

Parameters:
rowsa CPIndexSet of rows to select
aFlagshould extend the selection thereby retaining the previous selection

Definition at line 1126 of file CPTableView.j.

- (void) setAllowsColumnReordering: (BOOL)  shouldAllowColumnReordering

If you want to allow the user to reorder the columns pass YES, otherwise NO.

Definition at line 554 of file CPTableView.j.

- (void) setAllowsColumnResizing: (BOOL)  shouldAllowColumnResizing

Passing YES will allow the user to resize columns. Passing NO will keep the table columns unmovable by the user.

Note:
The this does not affect autoresizing behavior.

Definition at line 571 of file CPTableView.j.

- (void) setAllowsColumnSelection: (BOOL)  shouldAllowColumnSelection

Controls whether the user can select an entire column by clicking its header.

Parameters:
aFlagYES to allow the user to select columns, otherwise NO.

Definition at line 625 of file CPTableView.j.

- (void) setAllowsEmptySelection: (BOOL)  shouldAllowEmptySelection

Controls whether the receiver allows zero rows or columns to be selected.

Parameters:
aFlagYES if an empty selection is allowed, otherwise NO.

Definition at line 607 of file CPTableView.j.

- (void) setAllowsMultipleSelection: (BOOL)  shouldAllowMultipleSelection

Controls whether the user can select more than one row or column at a time.

Parameters:
aFlagYES to allow the user to select multiple rows or columns, otherwise NO.

Definition at line 588 of file CPTableView.j.

- (void) setAlternatingRowBackgroundColors: (CPArray alternatingRowBackgroundColors

Sets the colors for the rows as they alternate. The number of colors can be arbitrary. By default these colors are white and light blue.

Parameters:
anArrayan array of CPColors

Definition at line 720 of file CPTableView.j.

- (void) setAutosaveName: (CPString theAutosaveName

Set the name under which the table information is automatically saved to theAutosaveName. The table information is saved separately for each user and for each application that user uses.

Note:
Even though a table view has an autosave name, it may not be saving table information automatically. To set whether table information is being saved automatically, use setAutosaveTableColumns:

Definition at line 2196 of file CPTableView.j.

- (void) setAutosaveTableColumns: (BOOL)  shouldAutosave

Sets whether the order and width of this table view's columns are automatically saved.

The table information is saved separately for each user and for each application that user uses.

Note:
that if autosaveName returns nil, this setting is ignored and table information isn't saved.

Definition at line 2221 of file CPTableView.j.

- (void) setBoundsOrigin: (CGPoint)  aPoint

Reimplemented from CPView.

Definition at line 3474 of file CPTableView.j.

- (void) setBoundsSize: (CGSize)  aSize

Reimplemented from CPView.

Definition at line 3484 of file CPTableView.j.

- (void) setColumnAutoresizingStyle: (unsigned)  style

Sets the column autoresizing style of the receiver to a given style.

Parameters:
aStylethe column autoresizing style for the receiver. Valid values are:
        CPTableViewNoColumnAutoresizing
        CPTableViewUniformColumnAutoresizingStyle
        CPTableViewLastColumnOnlyAutoresizingStyle
        CPTableViewFirstColumnOnlyAutoresizingStyle

Definition at line 2005 of file CPTableView.j.

- (void) setContent: (CPArray content

Definition at line 4712 of file CPTableView.j.

- (void) setCornerView: (CPView aView

Sets the cornerview for the scrollview

Definition at line 1457 of file CPTableView.j.

- (void) setDataSource: (id)  aDataSource

Sets the receiver's data source to a given object. The data source implements various methods for handling the tableview's data when bindings are not used.

Parameters:
anObjectThe data source for the receiver. This object must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:

These methods are outlined below.

Overview

CPTableView generally requires a datasource to run. This data source can be thought of just like a delegate, but specifically for the tableview data. Methods include:

You must implement these data source methods:

Returns the number of rows in the tableview

- (int)numberOfRowsInTableView:(CPTableView)aTableView;

Returns the object value for each dataview. Each dataview will be sent a setObjectValue: method which will contain the object you return from this datasource method.

- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRowIndex;

Editing:

Sets the data object for an item in a given row and column. This needs to be implemented if you want inline editing support

- (void)tableView:(CPTableView)aTableView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;

Sorting:

The tableview will call this method if you click the tableheader. You should sort the datasource based off of the new sort descriptors and reload the data

- (void)tableView:(CPTableView)aTableView sortDescriptorsDidChange:(CPArray)oldDescriptors;

Drag and Drop:

Note:
In order for the tableview to receive drops don't forget to first register the tableview for drag types like you do with every other view.

Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview The data source can retarget a drop if you want by calling

-(void)setDropRow:(int)aRow dropOperation:(CPTableViewDropOperation)anOperation;
- (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(CPDraggingInfo)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation;

Returns YES if the drop operation is allowed otherwise NO. This method is invoked by the tableview after a drag should begin, but before it is started. If you don't want the drag to being return NO. If you want the drag to begin you should return YES and place the drag data on the pboard.

- (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard;

Return YES if the operation was successful otherwise return NO. The data source should incorporate the data from the dragging pasteboard in this method implementation. To get this data use the draggingPasteboard method on the CPDraggingInfo object.

- (BOOL)tableView:(CPTableView)aTableView acceptDrop:(CPDraggingInfo)info row:(int)row dropOperation:(CPTableViewDropOperation)operation;

NOT YET IMPLEMENTED

- (CPArray)tableView:(CPTableView)aTableView namesOfPromisedFilesDroppedAtDestination:(CPURL)dropDestination forDraggedRowsWithIndexes:(CPIndexSet)indexSet;

Reimplemented in CPOutlineView.

Definition at line 431 of file CPTableView.j.

- (void) setDelegate: (id)  aDelegate

Sets the delegate of the receiver.

Parameters:
aDelegatethe delegate object for the tableview.

The delegate can provide easy notification for user interaction, display behaviour, contextual menus, and more.

Displaying Cells:

Called when the tableview is about to display a dataview

- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;

Group rows are a way to separate a groups of data in a tableview. Return YES if the given row is a group row, otherwise NO.

- (BOOL)tableView:(CPTableView)tableView isGroupRow:(int)row;

Editing Cells:

Return YES if the dataview at a given index and column should be edited, otherwise NO.

- (BOOL)tableView:(CPTableView)aTableView shouldEditTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex;

Setting Row and Column Size:

Return the height of the row at a given index. Only implement this if you want variable row heights. Otherwise use setRowHeight: on the tableview.

- (float)tableView:(CPTableView)tableView heightOfRow:(int)row;

Selection:

Note:
These methods are only called when the user does something.

Return YES if the selection of the tableview should change, otherwise NO to keep the current selection.

- (BOOL)selectionShouldChangeInTableView:(CPTableView)aTableView;

Return YES if the row at a given index should be selected, other NO to deny the selection.

- (BOOL)tableView:(CPTableView)aTableView shouldSelectRow:(int)rowIndex;

Return YES if the table column given should be selected, otherwise NO to deny the selection.

- (BOOL)tableView:(CPTableView)aTableView shouldSelectTableColumn:(CPTableColumn)aTableColumn;

Inform the delegate that the tableview is in the process of chaining the selection. This usually happens when the user is dragging their mouse across rows.

- (void)tableViewSelectionIsChanging:(CPNotification)aNotification

Informs the delegate that the tableview selection has changed.

- (void)tableViewSelectionDidChange:(CPNotification)aNotification;

Moving and Resizing Columns:

Return YES if the column at a given index should move to a new column index, otherwise NO.

- (BOOL)tableView:(CPTableView)tableView shouldReorderColumn:(int)columnIndex toColumn:(int)newColumnIndex;

Notifies the delegate that the tableview drag occurred. This is send on mouse up.

- (void)tableView:(CPTableView)tableView didDragTableColumn:(CPTableColumn)tableColumn;

Notifies the delegate that a tablecolumn was moved by the user.

- (void)tableViewColumnDidMove:(CPNotification)aNotification;

Notifies the delegate that the user resized the table column

- (void)tableViewColumnDidResize:(CPNotification)aNotification;

Responding to Mouse Events:

Sent when the user clicks a table column but doesn't drag.

- (void)tableView:(CPTableView)tableView didClickTableColumn:(CPTableColumn)tableColumn;

Notify the delegate that the user click the table header of a column.

- (void)tableView:(CPTableView)tableView mouseDownInHeaderOfTableColumn:(CPTableColumn)tableColumn;

Contextual Menus:

Called when the user right clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column Return a CPMenu that should be displayed if the user right clicks. If you do not implement this the tableview will just call super on menuForEvent

- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow;

Delete Key

Called when the user presses the delete key. Many times you will want to delete data (or prompt for deletion) when the user hids the delete key. Your delegate can implement this method to avoid subclassing the tableview to add this behaviour.

- (void)tableViewDeleteKeyPressed:(CPTableView)aTableView;

Reimplemented in CPOutlineView.

Definition at line 2443 of file CPTableView.j.

- (void) setDisableAutomaticResizing: (BOOL)  aValue

Synthesized accessor method.

Definition at line 5008 of file CPTableView.j.

- (void) setDoubleAction: (SEL)  anAction

Sets the message sent to the target when the user double-clicks an uneditable cell or a column header to a given selector.

Parameters:
aSelectorThe message the receiver sends to its target when the user double-clicks an uneditable cell or a column header.

Definition at line 524 of file CPTableView.j.

- (void) setDraggingDestinationFeedbackStyle: (CPTableViewDraggingDestinationFeedbackStyle)  aStyle

Sets the feedback style for when the table is the destination of a drag operation. This style is used to determine how the tableview looks when it is the receiver of a drag and drop operation.

Can be:

        CPTableViewDraggingDestinationFeedbackStyleNone
        CPTableViewDraggingDestinationFeedbackStyleRegular
        CPTableViewDraggingDestinationFeedbackStyleSourceList

Definition at line 2931 of file CPTableView.j.

- (void) setDraggingSourceOperationMask: (CPDragOperation)  mask
forLocal: (BOOL)  isLocal 

Sets the default operation mask for the drag behavior of the table view.

Note:
isLocal is not implemented.

Definition at line 2893 of file CPTableView.j.

- (void) setDropRow: (CPInteger)  row
dropOperation: (CPTableViewDropOperation)  operation 

This should be called inside tableView:validateDrop:... method either CPTableViewDropOn or CPTableViewDropAbove, Specify the row as -1 to select the whole table for drop on.

Definition at line 2904 of file CPTableView.j.

- (void) setFrameOrigin: (CGPoint)  aPoint

Reimplemented from CPView.

Definition at line 3464 of file CPTableView.j.

- (void) setFrameSize: (CGSize)  aSize

we override here because we have to adjust the header

Reimplemented from CPView.

Definition at line 3451 of file CPTableView.j.

- (void) setGridColor: (CPColor aColor

Sets the grid color in the non highlighted state.

Parameters:
aColora CPColor

Definition at line 832 of file CPTableView.j.

- (void) setGridStyleMask: (unsigned)  aGrideStyleMask

Sets the grid style mask to specify if no grid lines, vertical grid lines, or horizontal grid lines should be displayed.

Parameters:
gridTypeThe grid style mask. CPTableViewGridNone, CPTableViewSolidVerticalGridLineMask, CPTableViewSolidHorizontalGridLineMask

Definition at line 852 of file CPTableView.j.

- (void) setHeaderView: (CPView aHeaderView

Sets the headerview for the tableview. This is the container view for the table column header views. This view also handles events for resizing and dragging.

If you don't want your tableview to have a headerview you should pass nil. (also see setCornerView:) If you're looking to customize the header text of a column see CPTableColumn's -(CPView)headerView; method.

Definition at line 1486 of file CPTableView.j.

- (void) setHighlightedTableColumn: (CPTableColumn aTableColumn

Sets the table column for which the header should be highlighted.

Definition at line 2746 of file CPTableView.j.

- (void) setIndicatorImage: (CPImage anImage
inTableColumn: (CPTableColumn aTableColumn 

Sets the indicator image of aTableColumn to anImage. The tableview will set the sort indicator images automatically; if you want a different image you can supply it here.

Parameters:
anImagethe image for the column
aTableColumnthe table column object for which to set the image

Definition at line 2709 of file CPTableView.j.

- (void) setIntercellSpacing: (CGSize)  aSize

Sets the width and height between dataviews. This value is (3.0, 2.0) by default.

Parameters:
aSizea CGSize object that defines the space between the cells

Definition at line 646 of file CPTableView.j.

- (void) setNeedsDisplay: (BOOL)  aFlag

Reimplemented from CPView.

Definition at line 3494 of file CPTableView.j.

- (void) setRowHeight: (unsigned)  aRowHeight

Sets the height of each row.

Note:
This may still used even if variable row height is being used.
Parameters:
aRowHeightthe height of each row

Definition at line 677 of file CPTableView.j.

- (void) setSelectionGradientColors: (CPDictionary aDictionary

Sets the highlight gradient for a row or column selection This is specific to the

Parameters:
aDictionarya CPDictionary expects three keys to be set:
        CPSourceListGradient which is a CGGradient
        CPSourceListTopLineColor which is a CPColor
        CPSourceListBottomLineColor which is a CPColor

Definition at line 808 of file CPTableView.j.

- (void) setSelectionHighlightColor: (CPColor aColor

Sets the highlight color for a row or column selection.

Parameters:
aColora CPColor

Definition at line 782 of file CPTableView.j.

- (void) setSelectionHighlightStyle: (unsigned)  aSelectionHighlightStyle

Sets the selection highlight style to an enumerated value. This value can also affect the way the tableview draws feedback when the user is dragging.

Valid values are:

        CPTableViewSelectionHighlightStyleNone
        CPTableViewSelectionHighlightStyleRegular
        CPTableViewSelectionHighlightStyleSourceList

Definition at line 762 of file CPTableView.j.

- (void) setSortDescriptors: (CPArray sortDescriptors

Sets the table view's CPSortDescriptors objects in an array.

Parameters:
sortDescriptorsan array of sort descriptors.

Definition at line 2997 of file CPTableView.j.

- (void) setUsesAlternatingRowBackgroundColors: (BOOL)  shouldUseAlternatingRowBackgroundColors

Sets whether the receiver uses the standard alternating row colors for its background.

Parameters:
aFlagYES to specify standard alternating row colors for the background, NO to specify a solid color.

Definition at line 702 of file CPTableView.j.

- (void) setVerticalMotionCanBeginDrag: (BOOL)  aFlag

Sets whether vertical motion is treated as a drag or selection change to flag.

Parameters:
aFlagif flag is NO then vertical motion will not start a drag. The default is YES.

Definition at line 2957 of file CPTableView.j.

- (void) sizeLastColumnToFit

Resizes the last column if there's room so the receiver fits exactly within its enclosing clip view.

Definition at line 2022 of file CPTableView.j.

- (CPArray) sortDescriptors

Returns an array of the current sort descriptors currently used by the table.

Definition at line 3040 of file CPTableView.j.

- (BOOL) startTrackingAt: (CGPoint)  aPoint

Reimplemented from CPControl.

Definition at line 3969 of file CPTableView.j.

- (void) stopTracking: (CGPoint)  lastPoint
at: (CGPoint)  aPoint
mouseIsUp: (BOOL)  mouseIsUp 

Reimplemented from CPControl.

Definition at line 4119 of file CPTableView.j.

- (void) superviewBoundsChanged: (CPNotification aNotification

Definition at line 3940 of file CPTableView.j.

- (void) superviewFrameChanged: (CPNotification aNotification

Definition at line 3951 of file CPTableView.j.

- (CPArray) tableColumns

Returns an array of CPTableColumns of all the receiver's columns.

Definition at line 1013 of file CPTableView.j.

- (CPTableColumn) tableColumnWithIdentifier: (CPString anIdentifier

Returns the CPTableColumn object with the given identifier string.

Parameters:
anIdentifierthe string value of the identifier
Returns:
a CPTableColumn object with the given identifier

Definition at line 1042 of file CPTableView.j.

+ (id) themeAttributes

Reimplemented from CPControl.

Definition at line 251 of file CPTableView.j.

- (void) tile

Lays out the dataviews and resizes the tableview so that everything fits.

Definition at line 2119 of file CPTableView.j.

- (void) trackMouse: (CPEvent anEvent

Reimplemented from CPControl.

Definition at line 4021 of file CPTableView.j.

- (BOOL) tracksMouseOutsideOfFrame

Returns YES if the receiver tracks the mouse outside the frame, otherwise NO.

Reimplemented from CPControl.

Definition at line 3961 of file CPTableView.j.

- (BOOL) usesAlternatingRowBackgroundColors

Returns YES if the tableview uses alternating row background colors, otherwise NO.

Definition at line 710 of file CPTableView.j.

- (BOOL) verticalMotionCanBeginDrag

Returns YES if vertical motion can begin a drag of the tableview, otherwise NO.

Definition at line 2965 of file CPTableView.j.

- (void) viewWillMoveToSuperview: (CPView aView

Reimplemented from CPView.

Definition at line 3900 of file CPTableView.j.

- (BOOL) wantsPeriodicDraggingUpdates

Definition at line 4237 of file CPTableView.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines