mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Use ...ForNode: methods so that the path is dependent on the kind of node
This commit is contained in:
parent
ebf6bdb8d2
commit
7aee7f6667
2 changed files with 18 additions and 5 deletions
|
@ -458,15 +458,15 @@ static NSImage *unexpandable = nil;
|
|||
BOOL leaf = YES;
|
||||
id observedObject = [theBinding observedObject];
|
||||
NSTreeController *tc = (NSTreeController *)observedObject;
|
||||
NSString *leafKeyPath = [tc leafKeyPath];
|
||||
NSString *leafKeyPath = [tc leafKeyPathForNode: item];
|
||||
|
||||
if (leafKeyPath == nil)
|
||||
{
|
||||
NSString *countKeyPath = [tc countKeyPath];
|
||||
NSString *countKeyPath = [tc countKeyPathForNode: item];
|
||||
|
||||
if (countKeyPath == nil)
|
||||
{
|
||||
NSString *childrenKeyPath = [tc childrenKeyPath];
|
||||
NSString *childrenKeyPath = [tc childrenKeyPathForNode: item];
|
||||
|
||||
if (childrenKeyPath == nil)
|
||||
{
|
||||
|
@ -2077,11 +2077,11 @@ Also returns the child index relative to this parent. */
|
|||
if ([self isExpandable: startitem] // leaf == NO
|
||||
&& [self isItemExpanded: startitem])
|
||||
{
|
||||
NSString *childrenKeyPath = [tc childrenKeyPath];
|
||||
NSString *childrenKeyPath = [tc childrenKeyPathForNode: startitem];
|
||||
|
||||
if (childrenKeyPath != nil)
|
||||
{
|
||||
NSString *countKeyPath = [tc countKeyPath];
|
||||
NSString *countKeyPath = [tc countKeyPathForNode: startitem];
|
||||
|
||||
children = [sitem valueForKeyPath: childrenKeyPath];
|
||||
if (countKeyPath == nil)
|
||||
|
|
|
@ -263,6 +263,19 @@
|
|||
if ([self canAddChild]
|
||||
&& [self countKeyPath] == nil)
|
||||
{
|
||||
id newObject = [self newObject];
|
||||
|
||||
if (newObject != nil)
|
||||
{
|
||||
NSMutableArray *newContent = [NSMutableArray arrayWithArray: [self content]];
|
||||
GSControllerTreeProxy *node = [[GSControllerTreeProxy alloc]
|
||||
initWithRepresentedObject: newObject
|
||||
withController: self];
|
||||
|
||||
[newContent addObject: node];
|
||||
[self setContent: newContent];
|
||||
RELEASE(newObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue