mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Implement makeItemWithIdentifier:atIndexPath:
This commit is contained in:
parent
8948aecae5
commit
04b0a15526
1 changed files with 22 additions and 17 deletions
|
@ -1256,6 +1256,25 @@ static NSString *placeholderItem = nil;
|
|||
|
||||
- (NSCollectionViewItem *) makeItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
NSCollectionViewItem *item =
|
||||
[_dataSource collectionView: self itemForRepresentedObjectAtIndexPath: indexPath];
|
||||
NSNib *nib = [self _nibForClass: [item class]];
|
||||
BOOL loaded = [nib instantiateWithOwner: item
|
||||
topLevelObjects: NULL];
|
||||
|
||||
if (loaded == NO)
|
||||
{
|
||||
item = nil;
|
||||
NSLog(@"Could not load model %@", nib);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
- (NSView *) makeSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
@ -1276,13 +1295,6 @@ static NSString *placeholderItem = nil;
|
|||
withIdentifier: identifier];
|
||||
}
|
||||
|
||||
- (NSView *) makeSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)elementKind
|
||||
withIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
forIndexPath: (NSIndexPath *)indexPath
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) registerClass: (Class)viewClass
|
||||
forSupplementaryViewOfKind: (NSCollectionViewSupplementaryElementKind)kind
|
||||
withIdentifier:(NSUserInterfaceItemIdentifier)identifier
|
||||
|
@ -1364,13 +1376,10 @@ static NSString *placeholderItem = nil;
|
|||
/* Reloading Content */
|
||||
- (void) _loadItemAtIndexPath: (NSIndexPath *)path
|
||||
{
|
||||
NSCollectionViewItem *item =
|
||||
[_dataSource collectionView: self itemForRepresentedObjectAtIndexPath: path];
|
||||
NSNib *nib = [self _nibForClass: [item class]];
|
||||
BOOL loaded = [nib instantiateWithOwner: item
|
||||
topLevelObjects: NULL];
|
||||
NSCollectionViewItem *item = [self makeItemWithIdentifier: nil
|
||||
forIndexPath: path];
|
||||
|
||||
if (loaded)
|
||||
if (item != nil)
|
||||
{
|
||||
NSView *v = [item view];
|
||||
if (_collectionViewLayout)
|
||||
|
@ -1396,10 +1405,6 @@ static NSString *placeholderItem = nil;
|
|||
NSLog(@"Layout view is not set");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Could not load model %@", nib);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _loadSectionAtIndex: (NSUInteger)cs
|
||||
|
|
Loading…
Reference in a new issue