Allow addition of plain NSView to gorm file.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@27748 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2009-01-31 23:37:33 +00:00
parent 9791aa6c61
commit 4ff4b72168
2 changed files with 45 additions and 62 deletions

View file

@ -1,3 +1,8 @@
2009-01-31 18:45-EST Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormCustomView.m: Allow addition of plain NSView to
a gorm file.
2009-01-25 09:47-EST Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormViewWindow.m: Change the color used for standalone

View file

@ -36,6 +36,21 @@
@class GSCustomView;
@interface CustomView : NSView
@end
@implementation CustomView
- (id) initWithFrame: (NSRect)frame
{
if((self = [super initWithFrame: frame]) != nil)
{
// Replace the CustomView with an NSView of the same dimensions.
self = [[NSView alloc] initWithFrame: frame];
}
return self;
}
@end
@implementation GormCustomView
- (id)initWithFrame:(NSRect)frameRect
@ -105,83 +120,46 @@
return cls;
}
- (BOOL) classNameIsSet
{
if([className isEqualToString: @"CustomView"] ||
[className isEqualToString: @""] || className == nil)
{
return NO;
}
return YES;
}
/*
- (Class) classForCoder
{
if([self _classNameIsSet])
{
return [NSView class];
}
return [self class];
}
*/
/*
* This needs to be coded like a GSNibItem. How do we make sure this
* tracks changes in GSNibItem coding?
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
/*
if([self _classNameIsSet])
if([aCoder allowsKeyedCoding])
{
*/
if([aCoder allowsKeyedCoding])
GormClassManager *classManager = [(id<Gorm>)NSApp classManager];
NSString *extension = nil;
ASSIGNCOPY(extension,[classManager nonCustomSuperClassOf: className]);
[aCoder encodeObject: className forKey: @"NSClassName"];
[aCoder encodeRect: [self frame] forKey: @"NSFrame"];
if(extension != nil)
{
GormClassManager *classManager = [(id<Gorm>)NSApp classManager];
NSString *extension = nil;
ASSIGNCOPY(extension,[classManager nonCustomSuperClassOf: className]);
[aCoder encodeObject: className forKey: @"NSClassName"];
[aCoder encodeRect: [self frame] forKey: @"NSFrame"];
if(extension != nil)
{
[aCoder encodeObject: extension forKey: @"NSExtension"];
}
if([self nextResponder] != nil)
{
[aCoder encodeObject: [self nextResponder] forKey: @"NSNextResponder"];
}
if([self superview] != nil)
{
[aCoder encodeObject: [self superview] forKey: @"NSSuperview"];
}
RELEASE(extension);
[aCoder encodeObject: extension forKey: @"NSExtension"];
}
else
if([self nextResponder] != nil)
{
[aCoder encodeObject: [self stringValue]];
[aCoder encodeRect: _frame];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &_autoresizingMask];
[aCoder encodeObject: [self nextResponder] forKey: @"NSNextResponder"];
}
/*
if([self superview] != nil)
{
[aCoder encodeObject: [self superview] forKey: @"NSSuperview"];
}
RELEASE(extension);
}
else
{
if([aCoder allowsKeyedCoding] == NO)
{
NSView *temp = [[NSView alloc] initWithFrame: [self frame]];
[temp setNextResponder: [self nextResponder]];
[(NSArchiver *)aCoder replaceObject: self withObject: temp];
}
[aCoder encodeObject: [self stringValue]];
[aCoder encodeRect: _frame];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &_autoresizingMask];
}
*/
}
- (id) initWithCoder: (NSCoder*)aCoder