diff --git a/ChangeLog b/ChangeLog index fa1b1206..a2dc2457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-18 21:32 Gregory John Casamento + + * GormCore/GormDocument.m: attachObject:toParent code to add all + subviews of a view when it's added to the document. + 2005-08-18 21:02 Gregory John Casamento * GormCore/GormDocument.m: attachObject:toParent: added code to insert diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 91710b75..5cc1f73b 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -478,8 +478,8 @@ static NSImage *fileImage = nil; */ - (void) attachObject: (id)anObject toParent: (id)aParent { - NSArray *old; - BOOL newObject = NO; + NSArray *old; + BOOL newObject = NO; /* * Create a connector that links this object to its parent. @@ -524,13 +524,28 @@ static NSImage *fileImage = nil; [topLevelObjects addObject: anObject]; if ([anObject isKindOfClass: [NSWindow class]] == YES) { + NSWindow *win = (NSWindow *)anObject; + NSView *contentView = [win contentView]; + NSArray *subviews = [contentView subviews]; + NSEnumerator *en = [subviews objectEnumerator]; + NSView *view = nil; + // Turn off the release when closed flag, add the content view. [anObject setReleasedWhenClosed: NO]; - [self attachObject: [(NSWindow *)anObject contentView] + [self attachObject: contentView toParent: anObject]; + + // Add all subviews from the window, if any. + while((view = [en nextObject]) != nil) + { + [self attachObject: view toParent: win]; + } } [[self openEditorForObject: anObject] activate]; } + /* + * Add the menu. + */ else if((aParent == filesOwner || aParent == nil) && [anObject isKindOfClass: [NSMenu class]] == NO) { @@ -646,6 +661,20 @@ static NSImage *fileImage = nil; id v = [ti view]; [self attachObject: v toParent: ti]; } + /* + * If it's a simple NSView, add it and all of it's subviews. + */ + else if ([anObject isKindOfClass: [NSView class]] == YES) + { + NSView *view = (NSView *)anObject, *sv = nil; + NSEnumerator *en = [[view subviews] objectEnumerator]; + + // Add all subviews from the window, if any. + while((sv = [en nextObject]) != nil) + { + [self attachObject: sv toParent: view]; + } + } // Detect and add any connection the object might have. // This is done so that any palette items which have predefined connections will be