mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-01 20:41:00 +00:00
More tidying.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3471 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fd3f754cb5
commit
1299ad6aa2
2 changed files with 63 additions and 24 deletions
|
@ -95,6 +95,10 @@ static id NSApp;
|
||||||
static NSString *NSAbortModalException = @"NSAbortModalException";
|
static NSString *NSAbortModalException = @"NSAbortModalException";
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSApplication (Private)
|
||||||
|
- (void) _windowWillClose: (NSNotification*)n;
|
||||||
|
- (void) _windowWillOpen: (NSWindow*)win;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation NSApplication
|
@implementation NSApplication
|
||||||
|
|
||||||
|
@ -1322,17 +1326,7 @@ NSWindow *w;
|
||||||
*/
|
*/
|
||||||
if ([window_list indexOfObjectIdenticalTo: aWindow] == NSNotFound)
|
if ([window_list indexOfObjectIdenticalTo: aWindow] == NSNotFound)
|
||||||
{
|
{
|
||||||
[window_list addObject: aWindow];
|
[self _windowWillOpen: aWindow];
|
||||||
[aWindow setWindowNumber: window_count++];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If this was the first window then make it the main and key window.
|
|
||||||
*/
|
|
||||||
if ([window_list count] == 1)
|
|
||||||
{
|
|
||||||
[aWindow becomeMainWindow];
|
|
||||||
[aWindow becomeKeyWindow];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1342,6 +1336,15 @@ NSWindow *w;
|
||||||
if ([aWindow isKindOfClass: [NSMenu class]])
|
if ([aWindow isKindOfClass: [NSMenu class]])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this was the first window then make it the main and key window.
|
||||||
|
*/
|
||||||
|
if ([window_list count] == 1)
|
||||||
|
{
|
||||||
|
[aWindow becomeMainWindow];
|
||||||
|
[aWindow becomeKeyWindow];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Can't permit an untitled window in the window menu.
|
* Can't permit an untitled window in the window menu.
|
||||||
*/
|
*/
|
||||||
|
@ -1379,7 +1382,6 @@ NSWindow *w;
|
||||||
{
|
{
|
||||||
menu = [[NSMenu alloc] initWithTitle: [windows_menu title]];
|
menu = [[NSMenu alloc] initWithTitle: [windows_menu title]];
|
||||||
[self setWindowsMenu: menu];
|
[self setWindowsMenu: menu];
|
||||||
[menu release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1729,3 +1731,43 @@ BOOL result = YES;
|
||||||
|
|
||||||
@end /* NSApplication */
|
@end /* NSApplication */
|
||||||
|
|
||||||
|
@implementation NSApplication (Private)
|
||||||
|
- (void) _windowWillClose: (NSNotification*)n
|
||||||
|
{
|
||||||
|
NSWindow *win = [n object];
|
||||||
|
|
||||||
|
if ([win isReleasedWhenClosed])
|
||||||
|
{
|
||||||
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
|
[nc removeObserver: self
|
||||||
|
name: NSWindowWillCloseNotification
|
||||||
|
object: win];
|
||||||
|
[window_list removeObjectIdenticalTo: win];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Horrible kludge to handle case where an application has no menu - we
|
||||||
|
* assume that this is the only window in the application and terminate.
|
||||||
|
* We only do this for windows that release when closed - any other
|
||||||
|
* window may be intended to re-open.
|
||||||
|
*/
|
||||||
|
if (main_menu == nil)
|
||||||
|
[self terminate: nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _windowWillOpen: (NSWindow*)win
|
||||||
|
{
|
||||||
|
if ([window_list indexOfObjectIdenticalTo: win] == NSNotFound)
|
||||||
|
{
|
||||||
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
|
[window_list addObject: win];
|
||||||
|
[win setWindowNumber: window_count++];
|
||||||
|
[nc addObserver: self
|
||||||
|
selector: @selector(_windowWillClose:)
|
||||||
|
name: NSWindowWillCloseNotification
|
||||||
|
object: win];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
|
@ -630,24 +630,21 @@ NSView *v;
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
NSApplication *theApp = [NSApplication sharedApplication];
|
NSApplication *theApp = [NSApplication sharedApplication];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If 'is_released_when_closed' then the window will be removed from the
|
||||||
|
* applications list of windows (causing it to be released) - so we must
|
||||||
|
* bracket any work we do in a retain/release sequence.
|
||||||
|
*/
|
||||||
|
if (is_released_when_closed)
|
||||||
|
[self retain];
|
||||||
|
|
||||||
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
[nc postNotificationName: NSWindowWillCloseNotification object: self];
|
||||||
[theApp removeWindowsItem: self];
|
[theApp removeWindowsItem: self];
|
||||||
[self orderOut: self];
|
[self orderOut: self];
|
||||||
visible = NO;
|
visible = NO;
|
||||||
|
|
||||||
if (is_released_when_closed)
|
if (is_released_when_closed)
|
||||||
{
|
[self release];
|
||||||
[self autorelease];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Horrible kludge to handle case where an application has no menu - we
|
|
||||||
* assume that this is the only window in the application and terminate.
|
|
||||||
* We only do this for windows that release when closed - any other
|
|
||||||
* window may be intended to re-open.
|
|
||||||
*/
|
|
||||||
if ([theApp mainMenu] == nil)
|
|
||||||
[theApp terminate: nil];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)deminiaturize:sender
|
- (void)deminiaturize:sender
|
||||||
|
|
Loading…
Reference in a new issue