diff --git a/Headers/AppKit/NSTreeController.h b/Headers/AppKit/NSTreeController.h index fcbb972d4..d6d1c439f 100644 --- a/Headers/AppKit/NSTreeController.h +++ b/Headers/AppKit/NSTreeController.h @@ -310,7 +310,6 @@ APPKIT_EXPORT_CLASS */ - (void) setSortDescriptors: (NSArray *)descriptors; -#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) /** * children key path for the given NSTreeNode. */ @@ -340,8 +339,9 @@ APPKIT_EXPORT_CLASS * Array containing all selected nodes */ - (NSArray*) selectedNodes; -#endif +#endif // 10_5 + @end -#endif +#endif // if OS_API_VERSION... #endif /* _GNUstep_H_NSTreeController */ diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 1a0690b50..172ce9904 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -108,7 +108,7 @@ static NSDate *lastDragChange = nil; NSOutlineView *_outlineView; } -- (instancetype) initWithParent: (NSOutlineView *)ov; +- (instancetype) initWithOutlineView: (NSOutlineView *)ov; @end @@ -251,7 +251,7 @@ static NSImage *unexpandable = nil; forObject: self]; if (theBinding != nil) { - _bindingDataSource = [[GSOutlineViewBindingDataSource alloc] initWithParent: self]; + _bindingDataSource = [[GSOutlineViewBindingDataSource alloc] initWithOutlineView: self]; NSLog(@"A binding data source was created %@", _bindingDataSource); } @@ -2284,7 +2284,7 @@ Also returns the child index relative to this parent. */ @implementation GSOutlineViewBindingDataSource -- (instancetype) initWithParent: (NSOutlineView *)ov +- (instancetype) initWithOutlineView: (NSOutlineView *)ov { self = [super init]; @@ -2376,6 +2376,16 @@ Also returns the child index relative to this parent. */ item: (id)item childIndex: (NSInteger)index { + // If there is a [outlineView dataSource] set, then we return that methods + // result if it responds to it. + if ([[outlineView dataSource] respondsToSelector: _cmd]) + { + return [[outlineView dataSource] outlineView: outlineView + acceptDrop: info + item: item + childIndex: index]; + } + return NO; } @@ -2383,6 +2393,15 @@ Also returns the child index relative to this parent. */ child: (NSInteger)index ofItem: (id)item { + // If there is a [outlineView dataSource] set, then we return that methods + // result if it responds to it. + if ([[outlineView dataSource] respondsToSelector: _cmd]) + { + return [[outlineView dataSource] outlineView: outlineView + child: index + ofItem: item]; + } + // id item = [contentArray objectAtIndex: i]; id v = nil; // [(NSArray *)[b destinationValue] objectAtIndex: i]; @@ -2392,6 +2411,14 @@ Also returns the child index relative to this parent. */ - (BOOL) outlineView: (NSOutlineView *)outlineView isItemExpandable: (id)i { + // If there is a [outlineView dataSource] set, then we return that methods + // result if it responds to it. + if ([[outlineView dataSource] respondsToSelector: _cmd]) + { + return [[outlineView dataSource] outlineView: outlineView + isItemExpandable: i]; + } + id item = [self _findItemValue: i startItem: nil]; BOOL f = [[item valueForKeyPath: _leafKeyPath] boolValue];