diff --git a/Headers/gnustep/gui/NSNibLoading.h b/Headers/gnustep/gui/NSNibLoading.h index d70e121a6..21c92534e 100644 --- a/Headers/gnustep/gui/NSNibLoading.h +++ b/Headers/gnustep/gui/NSNibLoading.h @@ -79,6 +79,15 @@ toName: (NSString*)targetName; @end +@interface GSNibItem : NSObject +{ + NSString *theClass; + NSRect frame; + BOOL hasFrame; + NSMutableArray *settings; +} +@end + #endif /* NO_GNUSTEP */ #endif // _GNUstep_H_NSNibLoading diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index 25f32bd96..528c677f8 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -29,13 +29,16 @@ #include #include +#include #include #include #include #include #include +#include #include #include +#include #include @implementation NSBundle (NSBundleAdditions) @@ -295,3 +298,53 @@ } @end +@implementation GSNibItem +- (void) dealloc +{ + [theClass release]; + [settings release]; + [self dealloc]; +} + +- (id) init +{ + self = [super init]; + if (self) + { + settings = [[NSMutableArray alloc] initWithCapacity: 0]; + } + return self; +} + +- (id) initWithCoder: (NSCoder*)aCoder +{ + id obj; + Class cls; + unsigned i; + + self = [super initWithCoder: aCoder]; + [aCoder decodeValueOfObjCType: @encode(BOOL) at: &hasFrame]; + frame = [aCoder decodeRect]; + [aCoder decodeValueOfObjCType: @encode(id) at: &theClass]; + [aCoder decodeValueOfObjCType: @encode(id) at: &settings]; + + cls = NSClassFromString(theClass); + obj = [cls allocWithZone: [self zone]]; + if (hasFrame) + obj = [obj initWithFrame: frame]; + else + obj = [obj init]; + + for (i = 0; i < [settings count]; i++) + { + NSInvocation *inv = [settings objectAtIndex: i]; + + [inv setTarget: obj]; + [inv invoke]; + } + [self release]; + return obj; +} + +@end +