From ba41a8c629381ebd8ce7c0f309dc3545df51c315 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Thu, 5 Mar 2009 21:20:05 +0000 Subject: [PATCH] Sheet support for wxMessageDialog. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59352 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/msgdlg.mm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 255576afd1..d574137f1e 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -183,8 +183,30 @@ 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 ) -- 2.45.2