(svn r21575) -Codechange: [OSX] Use the same class for the window delegate routines in windowed screen drivers

This commit is contained in:
planetmaker
2010-12-21 15:57:55 +00:00
parent 7ab04792c5
commit 26575ab8f8
4 changed files with 51 additions and 96 deletions

View File

@@ -407,4 +407,40 @@ void cocoaReleaseAutoreleasePool()
[ _ottd_autorelease_pool release ];
}
@implementation OTTD_CocoaWindowDelegate
/** Initialize the video driver */
- (void)setDriver:(CocoaSubdriver*)drv
{
driver = drv;
}
/** Handle closure requests */
- (BOOL)windowShouldClose:(id)sender
{
HandleExitGameRequest();
return NO;
}
/** Handle key acceptance */
- (void)windowDidBecomeKey:(NSNotification*)aNotification
{
driver->active = true;
}
/** Resign key acceptance */
- (void)windowDidResignKey:(NSNotification*)aNotification
{
driver->active = false;
}
/** Handle becoming main window */
- (void)windowDidBecomeMain:(NSNotification*)aNotification
{
driver->active = true;
}
/** Resign being main window */
- (void)windowDidResignMain:(NSNotification*)aNotification
{
driver->active = false;
}
@end
#endif /* WITH_COCOA */