]> git.saurik.com Git - wxWidgets.git/commitdiff
Sheet support for wxMessageDialog.
authorKevin Ollivier <kevino@theolliviers.com>
Thu, 5 Mar 2009 21:20:05 +0000 (21:20 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Thu, 5 Mar 2009 21:20:05 +0000 (21:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59352 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/msgdlg.mm

index 255576afd133f258529c75aa178252b19ff9300c..d574137f1eea5c93f9d46fc60d3fd80a2367a80c 100644 (file)
@@ -183,8 +183,30 @@ int wxMessageDialog::ShowModal()
             }
         }
 
-        int button = [alert runModal];
-        
+
+        wxNonOwnedWindow* parentWindow = NULL;
+        int button = -1;
+                
+        if (GetParent()) 
+        {
+            parentWindow = dynamic_cast<wxNonOwnedWindow*>(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 )