mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 12:01:16 +00:00
Further improvements to attachObject:toParent:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21659 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
08f846d1df
commit
05a4b62108
2 changed files with 37 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-08-18 21:32 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* 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 <greg_casamento@yahoo.com>
|
2005-08-18 21:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormCore/GormDocument.m: attachObject:toParent: added code to insert
|
* GormCore/GormDocument.m: attachObject:toParent: added code to insert
|
||||||
|
|
|
@ -478,8 +478,8 @@ static NSImage *fileImage = nil;
|
||||||
*/
|
*/
|
||||||
- (void) attachObject: (id)anObject toParent: (id)aParent
|
- (void) attachObject: (id)anObject toParent: (id)aParent
|
||||||
{
|
{
|
||||||
NSArray *old;
|
NSArray *old;
|
||||||
BOOL newObject = NO;
|
BOOL newObject = NO;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a connector that links this object to its parent.
|
* Create a connector that links this object to its parent.
|
||||||
|
@ -524,13 +524,28 @@ static NSImage *fileImage = nil;
|
||||||
[topLevelObjects addObject: anObject];
|
[topLevelObjects addObject: anObject];
|
||||||
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
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.
|
// Turn off the release when closed flag, add the content view.
|
||||||
[anObject setReleasedWhenClosed: NO];
|
[anObject setReleasedWhenClosed: NO];
|
||||||
[self attachObject: [(NSWindow *)anObject contentView]
|
[self attachObject: contentView
|
||||||
toParent: anObject];
|
toParent: anObject];
|
||||||
|
|
||||||
|
// Add all subviews from the window, if any.
|
||||||
|
while((view = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
[self attachObject: view toParent: win];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[[self openEditorForObject: anObject] activate];
|
[[self openEditorForObject: anObject] activate];
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Add the menu.
|
||||||
|
*/
|
||||||
else if((aParent == filesOwner || aParent == nil) &&
|
else if((aParent == filesOwner || aParent == nil) &&
|
||||||
[anObject isKindOfClass: [NSMenu class]] == NO)
|
[anObject isKindOfClass: [NSMenu class]] == NO)
|
||||||
{
|
{
|
||||||
|
@ -646,6 +661,20 @@ static NSImage *fileImage = nil;
|
||||||
id v = [ti view];
|
id v = [ti view];
|
||||||
[self attachObject: v toParent: ti];
|
[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.
|
// Detect and add any connection the object might have.
|
||||||
// This is done so that any palette items which have predefined connections will be
|
// This is done so that any palette items which have predefined connections will be
|
||||||
|
|
Loading…
Reference in a new issue