Methods


outlineView:deleteItems:
Support for user-initiated item deletion.
outlineView:createNewItemAtChildIndex:ofItem:
Support for user-initiated item creation.
outlineView:readItemsFromPasteboard:item:childIndex:pasteboardSourceType:
Consolidated method for handling reading rows from a pasteboard.
outlineView:validRequestorForSendType:returnType:
Support for pasteboard validation.
outlineViewDraggingExited:
Data source method for notifying when sender is no longer tracking a drop.
outlineView:draggingSourceOperationMaskForLocal:
Data source method for altering the drag source operation mask.
outlineView:draggedImage:beganAt:
Data source method for notification of drag source activity.
outlineView:draggedImage:endedAt:operation:
Data source method for notification of drag source activity.
outlineView:draggedImage:movedTo:
Data source method for notification of drag source activity.
outlineViewIgnoreModifierKeysWhileDragging:
Data source method for controlling whether modifiers are ignored.

outlineView:createNewItemAtChildIndex:ofItem:

Support for user-initiated item creation.
- ( BOOL ) outlineView:
        (id ) sender createNewItemAtChildIndex:
        (int ) childIndex ofItem:
        (id ) item;

This method is sent by the -createNewItem: action method to ask the dataSource to create a new item at a given childIndex of a given parent item in the outline. If the dataSource is able to successfully create the item it should return YES, if it cannot create the item for any reason it should return NO.

Parameter Descriptions
sender
The sending MOExtendedOutlineView.
childIndex
The child index where the new item should be inserted within the given parent.
item
The parent item that the new item should be inserted into.
method result
YES if the row is successfully created, NO if not.

outlineView:deleteItems:

Support for user-initiated item deletion.
- ( BOOL ) outlineView:
        (id ) sender deleteItems:
        (NSArray *) items;

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

Parameter Descriptions
sender
The sending MOExtendedOutlineView.
items
The array of items.
method result
YES if the rows are successfully deleted, NO if not.

outlineView:draggedImage:beganAt:

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

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

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

outlineView:draggedImage:endedAt:operation:

Data source method for notification of drag source activity.
- ( void ) outlineView:
        (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 MOExtendedOutlineView's -draggedImage:endedAt:operation: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedOutlineView.
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).

outlineView:draggedImage:movedTo:

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

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

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

outlineView:draggingSourceOperationMaskForLocal:

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

This method is invoked from MOExtendedOutlineView's draggingSourceOperationMaskForLocal: implementation if the dataSource responds.

Parameter Descriptions
sender
The sending MOExtendedOutlineView.
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.

outlineView:readItemsFromPasteboard:item:childIndex:pasteboardSourceType:

Consolidated method for handling reading rows from a pasteboard.
- ( BOOL ) outlineView:
        (id ) sender readItemsFromPasteboard:
        (NSPasteboard *) pboard item:
        (id ) item childIndex:
        (int ) childIndex pasteboardSourceType:
        (MOPasteboardSourceType ) sourceType;

This method provides a single funnel point for reading items from the pasteboard for drag&frop, copy/paste, and Services. It is sent by the outlines' -paste: and -readSelectionFromPasteboard: methods. It is also sent from MOKit's delfault NSObject implementation of the standard NSOutlineView drag&drop dataSource method -outlineView:acceptDrop:item:childIndex:. An implementation should read the data from the pasteboard and insert new items (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 outline that is receiving them or some other source.

For copy/paste and Services, the child index and item will be computed so that the new rows will be inserted as siblings after the last selected item. In some circumstances for copy/paste or for Services, especially, you may want to ignore the childIndex and item 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 outline to decide whether to move or copy the rows by default. Note also that to accept drops, someone must register the outline for the drop types it supports by sending the outline a -registerForDraggedTypes: message.

Parameter Descriptions
sender
The sending MOExtendedOutlineView.
pboard
The pasteboard to read the data from.
childIndex
The child index of where to insert the new items within the given parent item. May be NSOutlineViewDropOnItemIndex if the drop is "onto" an item instead of between two items.
item
The parent item into which the new items should be inserted. May be nil if the items should be inserted as top-level objects.
sourceType
Where the pasteboard came from (ie what sort of operation is happening).
method result
YES if the operation is successful, NO if not.

outlineView:validRequestorForSendType:returnType:

Support for pasteboard validation.
- ( id ) outlineView:
        (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 MOExtendedOutlineView.
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.

outlineViewDraggingExited:

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

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

Parameter Descriptions
sender
The sending MOExtendedOutlineView.

outlineViewIgnoreModifierKeysWhileDragging:

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

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

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

(Last Updated 3/20/2005)