X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f9b48d1e1535f8b92a73031be8cceff39123d27..7735b2ea691f41d7a7f007befbe969386873b86e:/src/osx/cocoa/dirdlg.mm diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index 6094f86e03..e68bf5020b 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -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(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] );