mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-30 10:30:41 +00:00
Update header and add non-keyed encoding to the class
This commit is contained in:
parent
21e8018d7d
commit
bbce009d7e
2 changed files with 67 additions and 28 deletions
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
NSTreeController.h
|
||||
|
||||
The tree controller class.
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: 2012
|
||||
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
|
@ -22,10 +22,10 @@
|
|||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSTreeController
|
||||
#define _GNUstep_H_NSTreeController
|
||||
|
@ -48,22 +48,23 @@ APPKIT_EXPORT_CLASS
|
|||
NSString *_leafKeyPath;
|
||||
NSArray *_sort_descriptors;
|
||||
NSArray *_arranged_objects;
|
||||
|
||||
BOOL _alwaysUsesMultipleValuesMarker;
|
||||
BOOL _avoidsEmptySelection;
|
||||
BOOL _preservesSelection;
|
||||
BOOL _selectsInsertedObjects;
|
||||
}
|
||||
|
||||
- (BOOL) addSelectionIndexPaths: (NSArray*)indexPaths;
|
||||
- (BOOL) addSelectionIndexPaths: (NSArray *)indexPaths;
|
||||
- (BOOL) alwaysUsesMultipleValuesMarker;
|
||||
- (BOOL) avoidsEmptySelection;
|
||||
- (BOOL) canAddChild;
|
||||
- (BOOL) canInsert;
|
||||
- (BOOL) canInsertChild;
|
||||
- (BOOL) preservesSelection;
|
||||
- (BOOL) preservesSelection;
|
||||
- (BOOL) selectsInsertedObjects;
|
||||
- (BOOL) setSelectionIndexPath: (NSIndexPath*)indexPath;
|
||||
- (BOOL) setSelectionIndexPaths: (NSArray*)indexPaths;
|
||||
- (BOOL) setSelectionIndexPath: (NSIndexPath *)indexPath;
|
||||
- (BOOL) setSelectionIndexPaths: (NSArray *)indexPaths;
|
||||
- (id) arrangedObjects;
|
||||
- (NSArray*) selectedObjects;
|
||||
- (NSIndexPath*) selectionIndexPath;
|
||||
|
@ -75,29 +76,29 @@ APPKIT_EXPORT_CLASS
|
|||
- (void) addChild: (id)sender;
|
||||
- (void) add: (id)sender;
|
||||
- (void) insertChild: (id)sender;
|
||||
- (void) insertObject: (id)object atArrangedObjectIndexPath: (NSIndexPath*)indexPath;
|
||||
- (void) insertObjects: (NSArray*)objects atArrangedObjectIndexPaths: (NSArray*)indexPaths;
|
||||
- (void) insertObject: (id)object atArrangedObjectIndexPath: (NSIndexPath *)indexPath;
|
||||
- (void) insertObjects: (NSArray *)objects atArrangedObjectIndexPaths: (NSArray *)indexPaths;
|
||||
- (void) insert: (id)sender;
|
||||
- (void) rearrangeObjects;
|
||||
- (void) removeObjectAtArrangedObjectIndexPath: (NSIndexPath*)indexPath;
|
||||
- (void) removeObjectsAtArrangedObjectIndexPaths: (NSArray*)indexPaths;
|
||||
- (void) removeSelectionIndexPaths: (NSArray*)indexPaths;
|
||||
- (void) removeObjectAtArrangedObjectIndexPath: (NSIndexPath *)indexPath;
|
||||
- (void) removeObjectsAtArrangedObjectIndexPaths: (NSArray *)indexPaths;
|
||||
- (void) removeSelectionIndexPaths: (NSArray *)indexPaths;
|
||||
- (void) remove: (id)sender;
|
||||
- (void) setAlwaysUsesMultipleValuesMarker: (BOOL)flag;
|
||||
- (void) setAvoidsEmptySelection: (BOOL)flag;
|
||||
- (void) setChildrenKeyPath: (NSString*)path;
|
||||
- (void) setCountKeyPath: (NSString*)path;
|
||||
- (void) setLeafKeyPath: (NSString*)key;
|
||||
- (void) setChildrenKeyPath: (NSString *)path;
|
||||
- (void) setCountKeyPath: (NSString *)path;
|
||||
- (void) setLeafKeyPath: (NSString *)key;
|
||||
- (void) setPreservesSelection: (BOOL)flag;
|
||||
- (void) setSelectsInsertedObjects: (BOOL)flag;
|
||||
- (void) setSortDescriptors: (NSArray*)descriptors;
|
||||
- (void) setSortDescriptors: (NSArray *)descriptors;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (NSString*) childrenKeyPathForNode: (NSTreeNode*)node;
|
||||
- (NSString*) countKeyPathForNode: (NSTreeNode*)node;
|
||||
- (NSString*) leafKeyPathForNode: (NSTreeNode*)node;
|
||||
- (void) moveNode: (NSTreeNode*)node toIndexPath: (NSIndexPath*)indexPath;
|
||||
- (void) moveNodes: (NSArray*)nodes toIndexPath: (NSIndexPath*)startingIndexPath;
|
||||
- (NSString*) childrenKeyPathForNode: (NSTreeNode *)node;
|
||||
- (NSString*) countKeyPathForNode: (NSTreeNode *)node;
|
||||
- (NSString*) leafKeyPathForNode: (NSTreeNode *)node;
|
||||
- (void) moveNode: (NSTreeNode *)node toIndexPath: (NSIndexPath *)indexPath;
|
||||
- (void) moveNodes: (NSArray *)nodes toIndexPath: (NSIndexPath *)startingIndexPath;
|
||||
- (NSArray*) selectedNodes;
|
||||
#endif
|
||||
@end
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
|
||||
- (NSArray*) arrangeObjects: (NSArray*)obj
|
||||
{
|
||||
NSArray *temp = obj;
|
||||
NSArray *temp = obj;
|
||||
return [temp sortedArrayUsingDescriptors: _sort_descriptors];
|
||||
}
|
||||
|
||||
|
@ -219,8 +219,8 @@
|
|||
GSKeyValueBinding *theBinding;
|
||||
|
||||
[self setContent: obj];
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentObjectBinding
|
||||
forObject: self];
|
||||
theBinding = [GSKeyValueBinding getBinding: NSContentObjectBinding
|
||||
forObject: self];
|
||||
if (theBinding != nil)
|
||||
[theBinding reverseSetValueFor: @"content"];
|
||||
}
|
||||
|
@ -405,7 +405,7 @@
|
|||
[self setChildrenKeyPath:
|
||||
[coder decodeObjectForKey: @"NSTreeContentLeafKey"]];
|
||||
}
|
||||
|
||||
|
||||
// Since we don't inherit from NSArrayController these are decoded here
|
||||
// as well.
|
||||
if ([coder containsValueForKey: @"NSAvoidsEmptySelection"])
|
||||
|
@ -427,6 +427,25 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
id obj = nil;
|
||||
BOOL f = NO;
|
||||
|
||||
obj = [coder decodeObject];
|
||||
[self setChildrenKeyPath: obj];
|
||||
obj = [coder decodeObject];
|
||||
[self setCountKeyPath: obj];
|
||||
obj = [coder decodeObject];
|
||||
[self setLeafKeyPath: obj];
|
||||
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
[self setAvoidsEmptySelection: f];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
[self setPreservesSelection: f];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
[self setSelectsInsertedObjects: f];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -435,7 +454,7 @@
|
|||
- (void) encodeWithCoder: (NSCoder*)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
|
||||
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: _childrenKeyPath
|
||||
|
@ -455,6 +474,25 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
id obj = nil;
|
||||
BOOL f = NO;
|
||||
|
||||
obj = [self childrenKeyPath];
|
||||
[coder encodeObject: obj];
|
||||
obj = [self countKeyPath];
|
||||
[coder encodeObject: obj];
|
||||
obj = [self leafKeyPath];
|
||||
[coder encodeObject: obj];
|
||||
|
||||
f = [self avoidsEmptySelection];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
f = [self preservesSelection];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
f = [self selectsInsertedObjects];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &f];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue