Fixed call to delegate method collectionView:validateDrop:proposedIndex:dropOperation where we were passing integers instead of their reference.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@36339 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Frank Le Grand 2013-03-11 16:25:00 +00:00
parent d3b8f3ae90
commit 9f1f9be84e

View file

@ -1032,14 +1032,23 @@ static NSString *placeholderItem = nil;
int index = [self _indexAtPoint:location];
index = (index > [_items count] - 1) ? [_items count] - 1 : index;
_draggingOnIndex = index;
[self setNeedsDisplayInRect:[self _frameForRowsAroundItemAtIndex:index]];
NSInteger *proposedIndex = (NSInteger *)index;
NSInteger *proposedIndex = &index;
int dropOperationInt = NSCollectionViewDropOn;
NSCollectionViewDropOperation *dropOperation = &dropOperationInt;
// TODO: We currently don't do anything with the proposedIndex & dropOperation that
// may get altered by the delegate.
result = [delegate collectionView:self
validateDrop:sender
proposedIndex:proposedIndex
dropOperation:NSCollectionViewDropOn];
dropOperation:dropOperation];
if (result == NSDragOperationNone)
{
_draggingOnIndex = NSNotFound;
}
[self setNeedsDisplayInRect:[self _frameForRowsAroundItemAtIndex:index]];
}
return result;
@ -1072,12 +1081,17 @@ static NSString *placeholderItem = nil;
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
{
NSPoint location = [self convertPoint: [sender draggingLocation] fromView: nil];
int index = [self _indexAtPoint:location];
index = (index > [_items count] - 1) ? [_items count] - 1 : index;
BOOL result = NO;
if ([delegate respondsToSelector:@selector(collectionView:acceptDrop:index:dropOperation:)])
{
// TODO: dropOperation should be retrieved from the validateDrop delegate method.
result = [delegate collectionView:self
acceptDrop:sender
index:0 //FIXME
index:index
dropOperation:NSCollectionViewDropOn];
}
return result;