Implemented applicationShouldTerminate: and applicationShouldTerminateAfterLastWindowClosed: on Mac OS X.
This commit is contained in:
parent
e556f92e52
commit
441b8c7c73
|
@ -61,8 +61,6 @@ windows
|
|||
- tab order is backwards
|
||||
- flicker ahoy
|
||||
- not all controls are transparent
|
||||
mac os x
|
||||
- applicationShouldTerminate: not handled
|
||||
gtk+
|
||||
- Area: default buttons, escape
|
||||
all
|
||||
|
|
|
@ -47,6 +47,33 @@ static Class areaClass;
|
|||
@end
|
||||
|
||||
@implementation appDelegateClass
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
||||
{
|
||||
NSArray *windows;
|
||||
NSUInteger i, n;
|
||||
|
||||
windows = [NSApp windows];
|
||||
n = [windows count];
|
||||
for (i = 0; i < n; i++) {
|
||||
NSWindow *w;
|
||||
|
||||
w = toNSWindow([windows objectAtIndex:i]);
|
||||
if (![[w delegate] windowShouldClose:w])
|
||||
// stop at the first rejection; thanks Lyle42 in irc.freenode.net/#macdev
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
// all windows closed; stop gracefully for Go
|
||||
uistop();
|
||||
// TODO can't use NSTerminateLater here as the run loop is different (???)
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
appDelegateClass *appDelegate;
|
||||
|
|
Loading…
Reference in New Issue