mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Move handling of dictionary creation into GSControllerTreeProxy class, per discussion with @fredkiefer
This commit is contained in:
parent
abfc782a6c
commit
6f2c542b46
3 changed files with 19 additions and 14 deletions
|
@ -40,8 +40,9 @@ extern "C" {
|
|||
|
||||
+ (NSMutableDictionary *) dictionaryWithChildren: (NSMutableArray *)children;
|
||||
|
||||
- (instancetype) initWithRepresentedObject: (id)representedObject
|
||||
withController: (id)controller;
|
||||
- (instancetype) initWithContent: (id)content
|
||||
withController: (id)controller;
|
||||
|
||||
- (NSUInteger) count;
|
||||
|
||||
- (NSMutableArray *) children;
|
||||
|
|
|
@ -35,19 +35,21 @@
|
|||
|
||||
+ (NSMutableDictionary *) dictionaryWithChildren: (NSMutableArray *)children
|
||||
{
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObject: children
|
||||
forKey: @"children"];
|
||||
return dictionary;
|
||||
return [NSMutableDictionary dictionaryWithObject: children
|
||||
forKey: @"children"];
|
||||
}
|
||||
|
||||
- (instancetype) initWithRepresentedObject: (id)representedObject
|
||||
withController: (id)controller
|
||||
- (instancetype) initWithContent: (id)content
|
||||
withController: (id)controller
|
||||
{
|
||||
self = [super initWithRepresentedObject: representedObject];
|
||||
self = [super initWithRepresentedObject:
|
||||
[GSControllerTreeProxy
|
||||
dictionaryWithChildren: content]];
|
||||
if (self != nil)
|
||||
{
|
||||
ASSIGN(_controller, controller);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,9 +192,8 @@
|
|||
|
||||
if ([_content isKindOfClass: [NSArray class]])
|
||||
{
|
||||
NSMutableDictionary *dictionary = [GSControllerTreeProxy dictionaryWithChildren: _content];
|
||||
_arranged_objects = [[GSControllerTreeProxy alloc] initWithRepresentedObject: dictionary
|
||||
withController: self];
|
||||
_arranged_objects = [[GSControllerTreeProxy alloc] initWithContent: _content
|
||||
withController: self];
|
||||
}
|
||||
|
||||
[self didChangeValueForKey: @"arrangedObjects"];
|
||||
|
@ -278,8 +277,8 @@
|
|||
{
|
||||
NSMutableArray *newContent = [NSMutableArray arrayWithArray: [self content]];
|
||||
GSControllerTreeProxy *node = [[GSControllerTreeProxy alloc]
|
||||
initWithRepresentedObject: newObject
|
||||
withController: self];
|
||||
initWithContent: newObject
|
||||
withController: self];
|
||||
|
||||
[newContent addObject: node];
|
||||
|
||||
|
@ -294,7 +293,10 @@
|
|||
NSIndexPath *p = [self selectionIndexPath];
|
||||
id newObject = [self newObject];
|
||||
|
||||
[self insertObject: newObject atArrangedObjectIndexPath: p];
|
||||
if (p != nil)
|
||||
{
|
||||
[self insertObject: newObject atArrangedObjectIndexPath: p];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) remove: (id)sender
|
||||
|
|
Loading…
Reference in a new issue