X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/945eac794c1b3039dddafc53c5f104f7ba88fadf..840a5948c7023a650b3b8427991654e12c3427c1:/src/osx/cocoa/utils.mm diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 48bc5c9a96..b8aa14190b 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -76,12 +76,14 @@ void wxMacWakeUp() - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { + wxUnusedVar(sender); // let wx do this, not cocoa return NO; } - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename; { + wxUnusedVar(sender); wxCFStringRef cf(wxCFRetain(filename)); wxTheApp->MacOpenFile(cf.AsString()) ; return YES; @@ -89,12 +91,14 @@ void wxMacWakeUp() - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender; { + wxUnusedVar(sender); wxTheApp->MacNewFile() ; return NO; } - (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename { + wxUnusedVar(sender); wxCFStringRef cf(wxCFRetain(filename)); wxTheApp->MacPrintFile(cf.AsString()) ; return YES; @@ -109,6 +113,7 @@ void wxMacWakeUp() */ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { + wxUnusedVar(sender); wxWindow* win = wxTheApp->GetTopWindow() ; if ( win ) { @@ -125,6 +130,8 @@ void wxMacWakeUp() - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { + wxUnusedVar(flag); + wxUnusedVar(sender); wxTheApp->MacReopenApp() ; return NO; } @@ -132,14 +139,58 @@ void wxMacWakeUp() - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { + wxUnusedVar(replyEvent); NSString* url = [[event descriptorAtIndex:1] stringValue]; wxCFStringRef cf(wxCFRetain(url)); wxTheApp->MacOpenURL(cf.AsString()) ; } @end +/* + allows ShowModal to work when using sheets. + see include/wx/osx/cocoa/private.h for more info +*/ +@implementation ModalDialogDelegate +- (id)init +{ + [super init]; + sheetFinished = NO; + resultCode = -1; + return self; +} + +- (BOOL)finished +{ + return sheetFinished; +} + +- (int)code +{ + return resultCode; +} + +- (void)waitForSheetToFinish +{ + while (!sheetFinished) + { + wxSafeYield(); + } +} + +- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + wxUnusedVar(contextInfo); + resultCode = returnCode; + sheetFinished = YES; + // NSAlerts don't need nor respond to orderOut + if ([sheet respondsToSelector:@selector(orderOut:)]) + [sheet orderOut: self]; +} +@end + bool wxApp::DoInitGui() { + wxMacAutoreleasePool pool; [NSApplication sharedApplication]; if (!sm_isEmbedded) @@ -150,8 +201,8 @@ bool wxApp::DoInitGui() NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:controller andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; + [NSApp finishLaunching]; } - [NSApp finishLaunching]; return true; } @@ -226,14 +277,6 @@ bool wxIsBusy() return (gs_wxBusyCursorCount > 0); } -void wxMacGlobalToLocal( WindowRef window , Point*pt ) -{ -} - -void wxMacLocalToGlobal( WindowRef window , Point*pt ) -{ -} - wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const { // wxScreenDC is derived from wxWindowDC, so a screen dc will