Update copyWithZone: method, provide simple implementation of addSelectionIndexPaths:

This commit is contained in:
Gregory John Casamento 2024-06-28 08:39:39 -04:00
parent 0f4e1711d0
commit 647076cb8a

View file

@ -3,10 +3,10 @@
The tree controller class. The tree controller class.
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012, 2024 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com> Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2012 Date: 2012, 2024
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -98,8 +98,14 @@
- (BOOL) addSelectionIndexPaths: (NSArray *)indexPaths - (BOOL) addSelectionIndexPaths: (NSArray *)indexPaths
{ {
// FIXME BOOL f = [self commitEditing];
return NO;
if (YES == f)
{
[_selection_index_paths addObjectsFromArray: indexPaths];
}
return f;
} }
- (BOOL) alwaysUsesMultipleValuesMarker - (BOOL) alwaysUsesMultipleValuesMarker
@ -520,9 +526,20 @@
- (id) copyWithZone: (NSZone*)zone - (id) copyWithZone: (NSZone*)zone
{ {
NSData *data = [NSArchiver archivedDataWithRootObject: self]; id copy = [[NSTreeController allocWithZone: zone] initWithContent: [self content]];
id result = [NSUnarchiver unarchiveObjectWithData: data];
return result; if (copy != nil)
{
[copy setChildrenKeyPath: [self childrenKeyPath]];
[copy setCountKeyPath: [self countKeyPath]];
[copy setLeafKeyPath: [self leafKeyPath]];
[copy setAvoidsEmptySelection: [self avoidsEmptySelection]];
[copy setPreservesSelection: [self preservesSelection]];
[copy setSelectsInsertedObjects: [self selectsInsertedObjects]];
}
return copy;
} }
@end @end