]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/msgdlg.mm
Applied #10007: SetWindowGroupParent hangs in Mac Carbon dialog.cpp
[wxWidgets.git] / src / osx / cocoa / msgdlg.mm
index 255576afd133f258529c75aa178252b19ff9300c..504e019070a81bdb081363cf6416054c792ad00e 100644 (file)
@@ -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<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 )
             resultbutton = wxID_CANCEL;
         else