]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/dirdlg.mm
Use the app name, not display name, as debug report name,
[wxWidgets.git] / src / osx / cocoa / dirdlg.mm
index 6094f86e03751ee10a982e2b6d90316ddf5fe6b1..e68bf5020b8812f8a40aef545720155ca5825691 100644 (file)
@@ -37,8 +37,8 @@
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
 
 wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
-        const wxString& defaultPath, long style, const wxPoint& pos,
-        const wxSize& size, const wxString& name)
+        const wxString& defaultPath, long style, const wxPoint& WXUNUSED(pos),
+        const wxSize& WXUNUSED(size), const wxString& WXUNUSED(name))
 {
     m_parent = parent;
 
@@ -66,8 +66,38 @@ int wxDirDialog::ShowModal()
     wxCFStringRef dir( m_path );
     
     m_path = wxEmptyString;
+
+    wxNonOwnedWindow* parentWindow = NULL;
+    int returnCode = -1;
     
-    if ( [oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil] == NSOKButton )
+    if (GetParent()) 
+    {
+        parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
+    }
+    else
+    {
+        fprintf(stderr, "No parent!\n");
+    }
+
+/*    
+    if (parentWindow)
+    {
+        NSWindow* nativeParent = parentWindow->GetWXWindow();
+        ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; 
+        [oPanel beginSheetForDirectory:dir.AsNSString() file:nil types: nil 
+            modalForWindow: nativeParent modalDelegate: sheetDelegate 
+            didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) 
+            contextInfo: nil];
+        [sheetDelegate waitForSheetToFinish];
+        returnCode = [sheetDelegate code];
+        [sheetDelegate release];
+    }
+    else
+*/
+    {
+        returnCode = (NSInteger)[oPanel runModalForDirectory:dir.AsNSString() file:nil types:nil];
+    }
+    if (returnCode == NSOKButton )
     {
         wxCFStringRef resultpath( [[[oPanel filenames] objectAtIndex:0] retain] );