Methods


tableView:deleteRows:
Support for user-initiated row deletion.
tableView:createNewRowAtIndex:
Support for user-initiated row creation.
tableView:readRowsFromPasteboard:row:dropOperation:pasteboardSourceType:
Consolidated method for handling reading rows from a pasteboard.
tableView:validRequestorForSendType:returnType:
Support for pasteboard validation.
tableViewDraggingExited:
Data source method for notifying when sender is no longer tracking a drop.
tableView:draggingSourceOperationMaskForLocal:
Data source method for altering the drag source operation mask.
tableView:draggedImage:beganAt:
Data source method for notification of drag source activity.
tableView:draggedImage:endedAt:operation:
Data source method for notification of drag source activity.
tableView:draggedImage:movedTo:
Data source method for notification of drag source activity.
tableViewIgnoreModifierKeysWhileDragging:
Data source method for controlling whether modifiers are ignored.

tableView:createNewRowAtIndex:

Support for user-initiated row creation.
- ( BOOL ) tableView:
        (id ) sender createNewRowAtIndex:
        (int ) rowIndex;

This method is sent by the -createNewRow: action method to ask the dataSource to create a new row at a given index in the table. If the dataSource is able to successfully create the row it should return YES, if it cannot create the row for any reason it should return NO.

Parameter Descriptions
sender
The sending MOExtendedTableView.
rowIndex
The index of the row where the new item should be inserted.
method result
YES if the row is successfully created, NO if not.

tableView:deleteRows:

Support for user-initiated row deletion.
- ( BOOL ) tableView:
        (id ) sender deleteRows:
        (NSArray *) rows;

This method is sent by the -delete: and -cut: action methods to ask the dataSource to delete one or more rows. The rows array contains NSNumbers whose -intValues are the indices of the rows to be deleted. The array is guaranteed to be sorted in ascending row index order. If the dataSource is able to successfully delete the rows it should return YES, if it cannot delete the rows for any reason it should return NO. If this method does not alter the selection, then the table will deselect all rows after a successful deletion.

Parameter Descriptions
sender
The sending MOExtendedTableView.
rows
The array of row indices (an array of ascending order NSNumbers).
method result
YES if the rows are successfully deleted, NO if not.

tableView:draggedImage:beganAt:

Data source method for notification of drag source activity.
- ( void ) tableView:
        (id ) sender draggedImage:
        (NSImage *) image beganAt:
        (NSPoint ) screenPoint;

Data source method for notification of drag source activity. This method is invoked from MOExtendedTableView's -draggedImage:beganAt: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.
image
The drag image.
screenPoint
The screen point where the drag began.

tableView:draggedImage:endedAt:operation:

Data source method for notification of drag source activity.
- ( void ) tableView:
        (id ) sender draggedImage:
        (NSImage *) image endedAt:
        (NSPoint ) screenPoint operation:
        (NSDragOperation ) operation;

Data source method for notification of drag source activity. This method is invoked from MOExtendedTableView's -draggedImage:endedAt:operation: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.
image
The drag image.
screenPoint
The screen point where the drag ended.
operation
The operation that was performed (or NSDragOperationNone if the drag was not successful).

tableView:draggedImage:movedTo:

Data source method for notification of drag source activity.
- ( void ) tableView:
        (id ) sender draggedImage:
        (NSImage *) image movedTo:
        (NSPoint ) screenPoint;

Data source method for notification of drag source activity. This method is invoked from MOExtendedTableView's -draggedImage:movedTo: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.
image
The drag image.
screenPoint
The screen point where the drag is currently.

tableView:draggingSourceOperationMaskForLocal:

Data source method for altering the drag source operation mask.
- ( NSDragOperation ) tableView:
        (id ) sender draggingSourceOperationMaskForLocal:
        (BOOL ) localFlag;

Data source method for altering the drag source operation mask. This method is invoked from MOExtendedTableView's draggingSourceOperationMaskForLocal: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.
localFlag
Whether the drag destination is in the current application or a different one.
method result
sender if the send and return types can be handled, nil if not.

tableView:readRowsFromPasteboard:row:dropOperation:pasteboardSourceType:

Consolidated method for handling reading rows from a pasteboard.
- ( BOOL ) tableView:
        (id ) sender readRowsFromPasteboard:
        (NSPasteboard *) pboard row:
        (int ) row dropOperation:
        (NSTableViewDropOperation ) op pasteboardSourceType:
        (MOPasteboardSourceType ) sourceType;

This method provides a single funnel point for reading rows from the pasteboard for drag&frop, copy/paste, and Services. It is sent by the tables' -paste: and -readSelectionFromPasteboard: methods. It is also sent from MOKit's delfault NSObject implementation of the standard NSTableView drag&drop dataSource method -tableView:acceptDrop:row:dropOperation:. An implementation should read the data from the pasteboard and insert new rows (usually).

In case the exact semantics for handling the different kinds of operations is required, an enumeration constant is passed in that identifies why the method is being called (ie whether it is for copy/paste or drag&drop or Services.) For drag&drop the constant also tells you whether the source of the new rows is the same table that is receiving them or some other source.

For copy/paste and Services, the row index will be after the last selected row and the drop operation will be NSTableViewDropAbove. In some circumstances for copy/paste or for Services, especially, you may want to ignore the row and op parameters and work directly from the selection. For instance, if a Service took row data as input from the selected rows, you may want to replace the selected rows with the output data. Note that for Services to be enabled, someone must call NSApplication's -registerServicesMenuSendTypes:returnTypes: with arrays of the supported send and return types to make the application globally aware that these types are supported.

For drag&drop, you can use the information about whether the source was the same table to decide whether to move or copy the rows by default. Note also that to accept drops, someone must register the table for the drop types it supports by sending the table a -registerForDraggedTypes: message.

Parameter Descriptions
sender
The sending MOExtendedTableView.
pboard
The pasteboard to read the data from.
row
The row index of where to insert the new rows.
op
The drop operation. For copy/paste and Services, this is always NSTableViewDropAbove. For drag&drop it may also be NSTableViewDropOn.
sourceType
Where the pasteboard came from (ie what sort of operation is happening).
method result
YES if the operation is successful, NO if not.

tableView:validRequestorForSendType:returnType:

Support for pasteboard validation.
- ( id ) tableView:
        (id ) sender validRequestorForSendType:
        (NSString *) sendType returnType:
        (NSString *) returnType;

This method is sent by -validRequestorForSendType:returnType: to validate Service menu items, and it is also sent by -validateUserInterfaceItem: to validate the Paste command. Implementors should return sender if the send and return types are able to be handled and nil otherwise. When this is sent to validate the Paste command, the sendType is nil and the returnType is one of the types currently on the pasteboard. Note that for Services to be enabled, someone must call NSApplication's -registerServicesMenuSendTypes:returnTypes: with arrays of the supported send and return types to make the application globally aware that these types are supported.

Parameter Descriptions
sender
The sending MOExtendedTableView.
sendType
The type of data that will be requested as input for a Service.
returnType
The type of data that will be provided as output for a Service or that is on the pasteboard for Paste.
method result
sender if the send and return types can be handled, nil if not.

tableViewDraggingExited:

Data source method for notifying when sender is no longer tracking a drop.
- ( void ) tableViewDraggingExited:
        (id ) sender;

This method is invoked from MOExtendedTableView's draggingExited: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.

tableViewIgnoreModifierKeysWhileDragging:

Data source method for controlling whether modifiers are ignored.
- ( BOOL ) tableViewIgnoreModifierKeysWhileDragging:
        (id ) sender;

Data source method for controlling whether modifiers are ignored. This method is invoked from MOExtendedTableView's -ignoreModifierKeysWhileDragging implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedTableView.
method result
Whether the dragging session should ignore modifier keys.

(Last Updated 3/20/2005)