mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:10:38 +00:00
Better unpacking of nib.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3569 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e18717400a
commit
a1947434d8
2 changed files with 62 additions and 0 deletions
|
@ -29,13 +29,16 @@
|
|||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSEnumerator.h>
|
||||
#include <Foundation/NSInvocation.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
|
||||
@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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue