mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:41:12 +00:00
Source/NSBundleAdditions.m
Headers/gnustep/gui/NSNibLoading.h git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12931 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fb70f31618
commit
6123e28d45
3 changed files with 94 additions and 17 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2002-03-01 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||||
|
|
||||||
|
* Source/NSBundleAdditions.m
|
||||||
|
([GSNibItem -initWithCoder:]):
|
||||||
|
([GSNibItem -encodeWithCoder:]):
|
||||||
|
new encoding (support for autoresizingMask).
|
||||||
|
([GSNibItem +initialize]):
|
||||||
|
([GSCustomView +initialize]):
|
||||||
|
new methods, set the version number.
|
||||||
|
* Headers/gnustep/gui/NSNibLoading.h:
|
||||||
|
new autoresizingMask ivar in GSNibItem.
|
||||||
|
|
||||||
2002-02-28 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
2002-02-28 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||||
|
|
||||||
* Headers/gnustep/gui/NSEvent.h:
|
* Headers/gnustep/gui/NSEvent.h:
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
{
|
{
|
||||||
NSString *theClass;
|
NSString *theClass;
|
||||||
NSRect theFrame;
|
NSRect theFrame;
|
||||||
|
unsigned int autoresizingMask;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
#include <AppKit/NSNibLoading.h>
|
#include <AppKit/NSNibLoading.h>
|
||||||
#include <AppKit/IMLoading.h>
|
#include <AppKit/IMLoading.h>
|
||||||
|
|
||||||
|
static const int currentVersion = 1;
|
||||||
|
|
||||||
@implementation NSNibConnector
|
@implementation NSNibConnector
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
|
@ -590,6 +592,13 @@ Class gmodel_class(void)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GSNibItem
|
@implementation GSNibItem
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
if (self == [GSNibItem class])
|
||||||
|
{
|
||||||
|
[self setVersion: currentVersion];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
@ -601,9 +610,48 @@ Class gmodel_class(void)
|
||||||
{
|
{
|
||||||
[aCoder encodeObject: theClass];
|
[aCoder encodeObject: theClass];
|
||||||
[aCoder encodeRect: theFrame];
|
[aCoder encodeRect: theFrame];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &autoresizingMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aCoder
|
- (id) initWithCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
int version = [aCoder versionForClassName:
|
||||||
|
NSStringFromClass([self class])];
|
||||||
|
|
||||||
|
if (version == 1)
|
||||||
|
{
|
||||||
|
id obj;
|
||||||
|
Class cls;
|
||||||
|
unsigned int mask;
|
||||||
|
|
||||||
|
[aCoder decodeValueOfObjCType: @encode(id) at: &theClass];
|
||||||
|
theFrame = [aCoder decodeRect];
|
||||||
|
[aCoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
|
at: &mask];
|
||||||
|
|
||||||
|
cls = NSClassFromString(theClass);
|
||||||
|
if (cls == nil)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Unable to find class '%@'", theClass];
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = [cls allocWithZone: [self zone]];
|
||||||
|
if (theFrame.size.height > 0 && theFrame.size.width > 0)
|
||||||
|
obj = [obj initWithFrame: theFrame];
|
||||||
|
else
|
||||||
|
obj = [obj init];
|
||||||
|
|
||||||
|
if ([obj respondsToSelector: @selector(setAutoresizingMask:)])
|
||||||
|
{
|
||||||
|
[obj setAutoresizingMask: mask];
|
||||||
|
}
|
||||||
|
|
||||||
|
RELEASE(self);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
else if (version == 0)
|
||||||
{
|
{
|
||||||
id obj;
|
id obj;
|
||||||
Class cls;
|
Class cls;
|
||||||
|
@ -627,11 +675,27 @@ Class gmodel_class(void)
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"no initWithCoder for this version");
|
||||||
|
RELEASE(self);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation GSCustomView
|
@implementation GSCustomView
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
if (self == [GSCustomView class])
|
||||||
|
{
|
||||||
|
[self setVersion: currentVersion];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
Loading…
Reference in a new issue