diff options
author | planetmaker <planetmaker@openttd.org> | 2010-12-21 15:57:55 +0000 |
---|---|---|
committer | planetmaker <planetmaker@openttd.org> | 2010-12-21 15:57:55 +0000 |
commit | 26575ab8f880a39dc9c07203d4f8b31eb667fdac (patch) | |
tree | b856ca9c3891022933f1a291cbdaba461fcad11d /src/video/cocoa/wnd_quickdraw.mm | |
parent | 7ab04792c501fcc605eff92d79eab5a66707e28f (diff) | |
download | openttd-26575ab8f880a39dc9c07203d4f8b31eb667fdac.tar.xz |
(svn r21575) -Codechange: [OSX] Use the same class for the window delegate routines in windowed screen drivers
Diffstat (limited to 'src/video/cocoa/wnd_quickdraw.mm')
-rw-r--r-- | src/video/cocoa/wnd_quickdraw.mm | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/src/video/cocoa/wnd_quickdraw.mm b/src/video/cocoa/wnd_quickdraw.mm index de38e26c0..0e5340a62 100644 --- a/src/video/cocoa/wnd_quickdraw.mm +++ b/src/video/cocoa/wnd_quickdraw.mm @@ -62,16 +62,6 @@ class WindowQuickdrawSubdriver; - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag; @end -/* Delegate for our NSWindow to send ask for quit on close */ -@interface OTTD_QuickdrawWindowDelegate : NSObject { - WindowQuickdrawSubdriver *driver; -} - -- (void)setDriver:(WindowQuickdrawSubdriver*)drv; - -- (BOOL)windowShouldClose:(id)sender; -@end - class WindowQuickdrawSubdriver: public CocoaSubdriver { private: /** @@ -236,42 +226,6 @@ public: @end -@implementation OTTD_QuickdrawWindowDelegate -- (void)setDriver:(WindowQuickdrawSubdriver*)drv -{ - driver = drv; -} - -- (BOOL)windowShouldClose:(id)sender -{ - HandleExitGameRequest(); - - return NO; -} - -- (void)windowDidBecomeKey:(NSNotification*)aNotification -{ - driver->active = true; -} - -- (void)windowDidResignKey:(NSNotification*)aNotification -{ - driver->active = false; -} - -- (void)windowDidBecomeMain:(NSNotification*)aNotification -{ - driver->active = true; -} - -- (void)windowDidResignMain:(NSNotification*)aNotification -{ - driver->active = false; -} - -@end - - static const int _resize_icon_width = 16; static const int _resize_icon_height = 16; @@ -329,7 +283,7 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height) /* Check if we should recreate the window */ if (this->window == nil) { - OTTD_QuickdrawWindowDelegate *delegate; + OTTD_CocoaWindowDelegate *delegate; /* Set the window style */ unsigned int style = NSTitledWindowMask; @@ -360,7 +314,7 @@ bool WindowQuickdrawSubdriver::SetVideoMode(int width, int height) [ this->window setAcceptsMouseMovedEvents:YES ]; [ this->window setViewsNeedDisplay:NO ]; - delegate = [ [ OTTD_QuickdrawWindowDelegate alloc ] init ]; + delegate = [ [ OTTD_CocoaWindowDelegate alloc ] init ]; [ delegate setDriver:this ]; [ this->window setDelegate: [ delegate autorelease ] ]; } else { |