From 7ac1d3dd1c35a463cf31629c55e1ceb2551232b0 Mon Sep 17 00:00:00 2001 From: Frank Le Grand Date: Thu, 25 Apr 2013 20:43:58 +0000 Subject: [PATCH] When adding subviews (items) to a NSCollectionView we need to set them in a non-visible area first so they don't get drawn in front of a view when the collection view is behind the latter. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@36583 72102866-910b-0410-8b05-ffd578937521 --- Source/NSCollectionView.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/NSCollectionView.m b/Source/NSCollectionView.m index 97326004b..11fd19182 100644 --- a/Source/NSCollectionView.m +++ b/Source/NSCollectionView.m @@ -198,8 +198,9 @@ static NSString *placeholderItem = nil; // if it hasn't been done already. NSCollectionViewItem *collectionItem = [self itemAtIndex:index]; NSView *view = [collectionItem view]; - [view setFrame:[self frameForItemAtIndex:index]]; - } + NSRect itemFrame = [self frameForItemAtIndex:index]; + [view setFrame:itemFrame]; + } } - (void) dealloc @@ -503,6 +504,14 @@ static NSString *placeholderItem = nil; { [item setSelected:YES]; } + + // Frank LeGrand 4/25/13: + // We set this initial rect as a workaround for a weird display + // issue in our app where the item view would get drawn in front + // of another view (a transparent NSBox) whereas it should stay + // behind. + NSRect initRect = NSMakeRect (-10000,-10000,100,100); + [[item view] setFrame:initRect]; [self addSubview:[item view]]; } return item;