fix for nib loading code, NSWindow -init

This commit is contained in:
Christopher Lloyd 2011-02-03 15:55:50 -05:00
parent 6e72705bfd
commit 6f0bec0a62
2 changed files with 7 additions and 1 deletions

View File

@ -79,6 +79,7 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
return 0;
}
/* This method is Cococtron specific and can be override by subclasses, do not change method name */
+(BOOL)hasMainMenuForStyleMask:(NSUInteger)styleMask {
if(styleMask&NSTitledWindowMask)
return YES;
@ -86,6 +87,7 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
return NO;
}
/* This method is Cococtron specific and can be override by subclasses, do not change method name. */
-(BOOL)hasMainMenu {
return [isa hasMainMenuForStyleMask:_styleMask];
}
@ -145,6 +147,10 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
return [NSThemeFrame class];
}
-init {
return [self initWithContentRect:NSMakeRect(100,100,100,100) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
}
-initWithCoder:(NSCoder *)coder {
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] is not implemented for coder %@",isa,sel_getName(_cmd),coder];
return self;

View File

@ -36,7 +36,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
_windowAutosave=[[keyed decodeObjectForKey:@"NSFrameAutosaveName"] retain];
_windowRect.origin.y -= _screenRect.size.height - [[NSScreen mainScreen] frame].size.height;
if ([_windowClass hasMainMenuForStyleMask:_windowStyleMask])
if ([NSClassFromString(_windowClass) hasMainMenuForStyleMask:_windowStyleMask])
_windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar
}
else {