Improvements in working with selection indexes in NSCollectionView.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@36266 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Frank Le Grand 2013-03-04 16:40:21 +00:00
parent d1bb44a910
commit b8cf0d6957

View file

@ -325,16 +325,17 @@ static NSString *placeholderItem = nil;
- (void)setSelectionIndexes:(NSIndexSet *)indexes
{
if (!_isSelectable || [_selectionIndexes isEqual:indexes])
if (!_isSelectable)
{
return;
}
// FIXME: Reset selectionIndexes in SetContent:
RELEASE(_selectionIndexes);
_selectionIndexes = indexes;
RETAIN(_selectionIndexes);
if (![_selectionIndexes isEqual:indexes])
{
RELEASE(_selectionIndexes);
_selectionIndexes = indexes;
RETAIN(_selectionIndexes);
}
NSUInteger index = 0;
@ -373,6 +374,11 @@ static NSString *placeholderItem = nil;
if (itemPrototype)
{
ASSIGN(collectionItem, [itemPrototype copy]);
// NSView *itemView = [collectionItem view];
// NSRect itemViewFrame = [itemView frame];
// NSRect frame = NSMakeRect (itemViewFrame.origin.x, itemViewFrame.origin.y, _itemSize.width, _itemSize.height);
// [itemView setFrame:frame];
// _itemSize = _minItemSize;
[collectionItem setRepresentedObject:object];
}
return collectionItem;
@ -427,7 +433,11 @@ static NSString *placeholderItem = nil;
}
// TODO: Restore item's selected state
//[self setSelectionIndexes:[_selectionIndexes copy]];
// Force recalculation of the frames of each item's view
_itemSize = _minItemSize;
_tileWidth = -1;
[self tile];
}