mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:40:37 +00:00
Some slight improvements. Made templates use a method called shouldSwapClass which checks for the existence of isInInterfaceBuilder and, if available, returns the value.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19933 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
da55fbe8a0
commit
b9ea1b1822
3 changed files with 37 additions and 12 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2004-08-28 10:34 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/GSNibTemplates.m: Added implementation of method
|
||||
shouldSwapClass to GSClassSwapper. This method checks for the
|
||||
implementation of isInInterfaceBuilder and returns whether or
|
||||
not the template should perform the class swap or whether it
|
||||
should retrieve the superclass.
|
||||
* Headers/Additions/GNUstepGUI/GSNibTemplates.h: Added
|
||||
declaration for -[GSClassSwapper shouldSwapClass].
|
||||
|
||||
2004-08-23 17:29 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSWindow.m (-setFrameFromString:): Don't change the size
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
NSString *_className;
|
||||
Class _superClass;
|
||||
}
|
||||
- (BOOL) shouldSwapClass;
|
||||
@end
|
||||
|
||||
@interface GSNibItem : NSObject <NSCoding>
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
|
||||
static const int currentVersion = 1; // GSNibItem version number...
|
||||
|
||||
@interface NSObject (GSNibPrivateMethods)
|
||||
- (BOOL) isInInterfaceBuilder;
|
||||
@end
|
||||
|
||||
@interface NSApplication (GSNibContainer)
|
||||
- (void)_deactivateVisibleWindow: (NSWindow *)win;
|
||||
@end
|
||||
|
@ -643,11 +647,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
|
||||
// if we are living within the interface builder app, then don't try to
|
||||
// morph into the subclass.
|
||||
if([self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
{
|
||||
obj = [_superClass alloc];
|
||||
}
|
||||
else
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
Class aClass = NSClassFromString(_className);
|
||||
if(aClass == 0)
|
||||
|
@ -660,6 +660,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
// allow us to instantiate the class we want.
|
||||
obj = [aClass alloc];
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = [_superClass alloc];
|
||||
}
|
||||
|
||||
// inform the coder that this object is to replace the template in all cases.
|
||||
[unarchiver replaceObject: self withObject: obj];
|
||||
|
@ -683,6 +687,16 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
[_object encodeWithCoder: aCoder];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) shouldSwapClass
|
||||
{
|
||||
BOOL result = YES;
|
||||
if([self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
{
|
||||
result = !([self isInInterfaceBuilder]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSWindowTemplate
|
||||
|
@ -715,7 +729,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
// decode the defer flag...
|
||||
[coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
|
||||
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class], @selector(initWithContentRect:styleMask:backing:defer:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -757,7 +771,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
id obj = [super initWithCoder: coder];
|
||||
if(obj != nil)
|
||||
{
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -786,7 +800,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
id obj = [super initWithCoder: coder];
|
||||
if(obj != nil)
|
||||
{
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -815,7 +829,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
id obj = [super initWithCoder: coder];
|
||||
if(obj != nil)
|
||||
{
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(initWithFrame:textContainer:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -846,7 +860,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
id obj = [super initWithCoder: coder];
|
||||
if(obj != nil)
|
||||
{
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(initWithTitle:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -877,7 +891,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
if(obj != nil)
|
||||
{
|
||||
/*
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL)
|
||||
{
|
||||
|
@ -906,7 +920,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
|
|||
id obj = [super initWithCoder: coder];
|
||||
if(obj != nil)
|
||||
{
|
||||
if(![self respondsToSelector: @selector(isInInterfaceBuilder)])
|
||||
if([self shouldSwapClass])
|
||||
{
|
||||
if(GSGetMethod([obj class],@selector(init), YES, NO) != NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue