MOTabView


Abstract

MOTabView extends NSTabView to add drag & drop support.

Discussion

MOTabView extends NSTabView to add drag & drop support. The tab view's delegate can implement various new methods to support dragging of tabs and accepting drops. As a drag source, MOTabView allows tabs to be dragged. As a drag destination MOTabView supports drops either "onto" a tab or "between" tabs. In both cases, it is left to the delegate to deal with the actual pasteboard content.



Methods

dragImageForItem:event:dragImageOffset:
Returns the image to use for dragging a tab.
setDropItemIndex:dropOperation:
Method to allow delegate to reposition a drop.

dragImageForItem:event:dragImageOffset:

Returns the image to use for dragging a tab.
- ( NSImage *) dragImageForItem:
        (NSTabViewItem *) dragItem event:
        (NSEvent *) dragEvent dragImageOffset:
        (NSPointPointer ) dragImageOffsetPtr;

Returns the image to use for dragging a tab. MOTabView will create a default image, but subclasses can override if they need to do something different. This method will be called with dragImageOffset set to NSZeroPoint, but it can be modified to re-position the returned image. A dragImageOffset of NSZeroPoint will cause the image to be centered under the mouse.

Parameter Descriptions
dragItem
The NSTabViewItem that will be dragged.
dragEvent
The event that started the drag.
dragImageOffsetPtr
A pointer to a point that can be filled in to provide an image offset.
method result
The image to use for the drag.

setDropItemIndex:dropOperation:

Method to allow delegate to reposition a drop.
- ( void ) setDropItemIndex:
        (int ) itemIndex dropOperation:
        (MOTabViewDropOperation ) op;

Method to allow delegate to reposition a drop. To be used from tabView:validateDrop:proposedItemIndex:proposedDropOperation: if you wish to "re-target" the proposed drop. To specify a drop on the second item, one would specify itemIndex=1, and op=MOTabViewDropOnItem. To specify a drop after the last item, one would specify row=[[tabView tabViewItems] count], and op=MOTabViewDropBeforeItem.

Parameter Descriptions
itemIndex
The item index.
op
The drop operation.

(Last Updated 3/20/2005)