Dockyard > Objective-C Classes > typesArray
Availability Since 10.3
Class Description
Simple subclass of NSArrayController that supports drag-and-drop. Connect the dataSource outlet of your table view to this class, and ignore the "improper data source" warning that comes up occasionally. Modified by Belkadan Software.
By
Methods
- moveObjectsInArrangedObjectsFromIndexes:toIndex:
- tableView:acceptDrop:row:dropOperation:
- tableView:validateDrop:proposedRow:proposedDropOperation:
- tableView:writeRows:toPasteboard:
- tableView:writeRowsWithIndexes:toPasteboard:
Method Detail
- (void)awakeFromNib
Registers this table's drag type. Don't forget to call [super awakeFromNib] when subclassing.
moveObjectsInArrangedObjectsFromIndexes:toIndex:
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned int)insertIndex
Uses NSArrayController methods to move the rows at the indexes in indexSet to insertIndex. So far there is not an efficient way to do this, so the method basically loops through the objects, removes them, and adds them one by one.
- (int)rowsAboveRow:(int)row inIndexSet:(NSIndexSet *)indexSet
Basically, counts the number of indexes in indexSet that are numerically before row.
tableView:acceptDrop:row:dropOperation:
- (BOOL)tableView:(NSTableView *)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)op
Accepts the drag/drop only if it came from this table. Moves the rows that were saved earlier, then selects them.
tableView:validateDrop:proposedRow:proposedDropOperation:
- (NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op
Makes sure that the dragged row is dropped between rows, instead of on top of one. Returns the default drag operation, NSDragOperationMove. Override if you want to support other drag operations.
tableView:writeRows:toPasteboard:
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray *)rows toPasteboard:(NSPasteboard *)pboard
Begins a drag by saving the NSNumbers in rows as the index set of dragged rows.
Availability
Deprecated in Mac OS 10.4
tableView:writeRowsWithIndexes:toPasteboard:
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
Begins a drag by saving rowIndexes as the index set of dragged rows.
Availability
Since Mac OS 10.4
This page was generated with DocYouMeant, a program created by Belkadan Software