mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 19:21:00 +00:00
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:
parent
d3b8f3ae90
commit
9f1f9be84e
1 changed files with 18 additions and 4 deletions
|
@ -1032,14 +1032,23 @@ static NSString *placeholderItem = nil;
|
||||||
int index = [self _indexAtPoint:location];
|
int index = [self _indexAtPoint:location];
|
||||||
index = (index > [_items count] - 1) ? [_items count] - 1 : index;
|
index = (index > [_items count] - 1) ? [_items count] - 1 : index;
|
||||||
_draggingOnIndex = 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
|
result = [delegate collectionView:self
|
||||||
validateDrop:sender
|
validateDrop:sender
|
||||||
proposedIndex:proposedIndex
|
proposedIndex:proposedIndex
|
||||||
dropOperation:NSCollectionViewDropOn];
|
dropOperation:dropOperation];
|
||||||
|
|
||||||
|
if (result == NSDragOperationNone)
|
||||||
|
{
|
||||||
|
_draggingOnIndex = NSNotFound;
|
||||||
|
}
|
||||||
|
[self setNeedsDisplayInRect:[self _frameForRowsAroundItemAtIndex:index]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1072,12 +1081,17 @@ static NSString *placeholderItem = nil;
|
||||||
|
|
||||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
- (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;
|
BOOL result = NO;
|
||||||
if ([delegate respondsToSelector:@selector(collectionView:acceptDrop:index:dropOperation:)])
|
if ([delegate respondsToSelector:@selector(collectionView:acceptDrop:index:dropOperation:)])
|
||||||
{
|
{
|
||||||
|
// TODO: dropOperation should be retrieved from the validateDrop delegate method.
|
||||||
result = [delegate collectionView:self
|
result = [delegate collectionView:self
|
||||||
acceptDrop:sender
|
acceptDrop:sender
|
||||||
index:0 //FIXME
|
index:index
|
||||||
dropOperation:NSCollectionViewDropOn];
|
dropOperation:NSCollectionViewDropOn];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue