X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e06b283ceba99daab0c8a8752cc7bbd77225eb1..ddbc8ac9ca91a8dfb26b9a4b4307a52bfe5754d7:/src/osx/cocoa/msgdlg.mm diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 255576afd1..504e019070 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -133,7 +133,7 @@ int wxMessageDialog::ShowModal() else { NSAlert* alert = [[NSAlert alloc] init]; - + wxCFStringRef cfNoString( GetNoLabel(), GetFont().GetEncoding() ); wxCFStringRef cfYesString( GetYesLabel(), GetFont().GetEncoding() ); wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding() ); @@ -144,7 +144,7 @@ int wxMessageDialog::ShowModal() [alert setMessageText:cfTitle.AsNSString()]; [alert setInformativeText:cfText.AsNSString()]; - + int buttonId[3] = { 0, 0, 0 }; int buttonCount = 0; @@ -183,10 +183,34 @@ int wxMessageDialog::ShowModal() } } - int button = [alert runModal]; - + + wxNonOwnedWindow* parentWindow = NULL; + int button = -1; + + if (GetParent()) + { + parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); + } + + /* + if (parentWindow) + { + NSWindow* nativeParent = parentWindow->GetWXWindow(); + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [alert beginSheetModalForWindow: nativeParent modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo: nil]; + [sheetDelegate waitForSheetToFinish]; + button = [sheetDelegate code]; + [sheetDelegate release]; + } + else +*/ + { + button = [alert runModal]; + } [alert release]; - + if ( button < NSAlertFirstButtonReturn ) resultbutton = wxID_CANCEL; else