X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f66ecdc4fbfa14f18f95331ba859a85baee36ae6..4d572a2cace8d11a10ecea598ff342c36ec007cf:/src/osx/cocoa/filedlg.mm diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 4a9d65fbc9..916b4e8b7a 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -153,11 +153,14 @@ int wxFileDialog::ShowModal() m_path = wxEmptyString; m_fileNames.Clear(); - + m_paths.Clear(); + // since we don't support retrieving the matching filter + m_filterIndex = -1; + wxNonOwnedWindow* parentWindow = NULL; int returnCode = -1; - - if (GetParent()) + + if (GetParent()) { parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); } @@ -181,10 +184,10 @@ int wxFileDialog::ShowModal() if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() - modalForWindow: nativeParent modalDelegate: sheetDelegate - didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() + modalForWindow: nativeParent modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; [sheetDelegate waitForSheetToFinish]; returnCode = [sheetDelegate code]; @@ -195,7 +198,7 @@ int wxFileDialog::ShowModal() { returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ]; } - + if (returnCode == NSOKButton ) { panel = sPanel; @@ -220,11 +223,11 @@ int wxFileDialog::ShowModal() if (parentWindow) { NSWindow* nativeParent = parentWindow->GetWXWindow(); - ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; - [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() - types: types modalForWindow: nativeParent - modalDelegate: sheetDelegate - didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) + ModalDialogDelegate* sheetDelegate = [[ModalDialogDelegate alloc] init]; + [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() + types: types modalForWindow: nativeParent + modalDelegate: sheetDelegate + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; [sheetDelegate waitForSheetToFinish]; returnCode = [sheetDelegate code]; @@ -233,7 +236,7 @@ int wxFileDialog::ShowModal() else */ { - returnCode = [oPanel runModalForDirectory:dir.AsNSString() + returnCode = [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types]; } if (returnCode == NSOKButton )