From 02f8b9c21aae7f81f4b8c68040228ae82154406c Mon Sep 17 00:00:00 2001 From: fredkiefer Date: Wed, 30 Mar 2011 08:17:00 +0000 Subject: [PATCH] Correct declaration of data source methods and the implementation in NSOutlineView. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32746 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 +++++++++- Headers/AppKit/NSOutlineView.h | 14 ++++++++++++-- Headers/AppKit/NSTableView.h | 12 ++++++++++-- Source/NSOutlineView.m | 14 ++++++++++++-- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a86a0944..ae1084125 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,17 @@ +2011-03-30 Fred Kiefer + + * Headers/AppKit/NSTableView.h, + * Headers/AppKit/NSOutlineView.h, + * Source/NSOutlineView.m + (-namesOfPromisedFilesDroppedAtDestination:): Correct declaration + of data source methods and the implementation in NSOutlineView. + 2011-03-29 Riccardo Mottola * Source/NSParagraphStyle.m * Source/NSMatrix.m Added missing import. - + 2011-03-29 German Arias * Source/NSApplication.m (-hide:): Minimize all windows if diff --git a/Headers/AppKit/NSOutlineView.h b/Headers/AppKit/NSOutlineView.h index 7a593f741..bb7fe0c4b 100644 --- a/Headers/AppKit/NSOutlineView.h +++ b/Headers/AppKit/NSOutlineView.h @@ -36,6 +36,7 @@ @class NSMapTable; @class NSMutableArray; @class NSString; +@class NSURL; @interface NSOutlineView : NSTableView { @@ -161,6 +162,17 @@ - (BOOL) outlineView: (NSOutlineView *)outlineView writeItems: (NSArray*)items toPasteboard: (NSPasteboard*)pboard; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) +- (void) outlineView: (NSOutlineView *)outlineView + sortDescriptorsDidChange: (NSArray *)oldSortDescriptors; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +- (NSArray *) outlineView: (NSOutlineView *)outlineView +namesOfPromisedFilesDroppedAtDestination: (NSURL *)dropDestination + forDraggedItems: (NSArray *)items; +#endif @end /* @@ -271,8 +283,6 @@ willDisplayOutlineCell: (id)cell - (BOOL) selectionShouldChangeInOutlineView: (NSOutlineView *)outlineView; #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) -- (void) outlineView: (NSOutlineView *)outlineView - sortDescriptorsDidChange: (NSArray *)oldSortDescriptors; - (void) outlineView: (NSOutlineView *)outlineView didClickTableColumn: (NSTableColumn *)aTableColumn; #endif diff --git a/Headers/AppKit/NSTableView.h b/Headers/AppKit/NSTableView.h index 3990a20c1..19ff0d018 100644 --- a/Headers/AppKit/NSTableView.h +++ b/Headers/AppKit/NSTableView.h @@ -41,6 +41,7 @@ @class NSTableHeaderView; @class NSText; @class NSImage; +@class NSURL; typedef enum _NSTableViewDropOperation { NSTableViewDropOn, @@ -362,10 +363,19 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn - (BOOL) tableView: (NSTableView*)tableView writeRows: (NSArray*)rows toPasteboard: (NSPasteboard*)pboard; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) +- (void) tableView: (NSTableView*)tableView + sortDescriptorsDidChange: (NSArray *)oldSortDescriptors; +#endif + #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) - (BOOL) tableView: (NSTableView*)tableView writeRowsWithIndexes: (NSIndexSet*)rows toPasteboard: (NSPasteboard*)pboard; +- (NSArray *) tableView: (NSTableView *)aTableView +namesOfPromisedFilesDroppedAtDestination: (NSURL *)dropDestination +forDraggedRowsWithIndexes: (NSIndexSet *)indexSet; #endif @end @@ -382,8 +392,6 @@ APPKIT_EXPORT NSString *NSTableViewSelectionIsChangingNotification; - (BOOL) selectionShouldChangeInTableView: (NSTableView *)aTableView; #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) -- (void) tableView: (NSTableView*)tableView - sortDescriptorsDidChange: (NSArray *)oldSortDescriptors; - (void) tableView: (NSTableView*)tableView didClickTableColumn: (NSTableColumn *)tableColumn; - (void) tableView: (NSTableView*)tableView diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 87756b1aa..a742d2e3c 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -1448,11 +1448,21 @@ Also returns the child index relative to this parent. */ - (NSArray*) namesOfPromisedFilesDroppedAtDestination: (NSURL *)dropDestination { if ([_dataSource respondsToSelector: - @selector(outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:)]) + @selector(outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:)]) { + int count = [_selectedRows count]; + NSMutableArray *itemArray = [NSMutableArray arrayWithCapacity: count]; + unsigned int index = [_selectedRows firstIndex]; + + while (index != NSNotFound) + { + [itemArray addObject: [self itemAtRow: index]]; + index = [_selectedRows indexGreaterThanIndex: index]; + } + return [_dataSource outlineView: self namesOfPromisedFilesDroppedAtDestination: dropDestination - forDraggedRowsWithIndexes: _selectedRows]; + forDraggedItems: itemArray]; } else {