X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/440e5cb2fa76b5a722c14065f5d3e87f499daf33..b3cec67186d678d2c3985923bdb8c787455cf369:/src/osx/cocoa/filedlg.mm diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 0b34682a72..33ece87025 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -153,11 +153,11 @@ int wxFileDialog::ShowModal() m_path = wxEmptyString; m_fileNames.Clear(); - + wxNonOwnedWindow* parentWindow = NULL; int returnCode = -1; - - if (GetParent()) + + if (GetParent()) { parentWindow = dynamic_cast(wxGetTopLevelParent(GetParent())); } @@ -181,10 +181,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,15 +195,13 @@ int wxFileDialog::ShowModal() { returnCode = [sPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() ]; } - + if (returnCode == NSOKButton ) { panel = sPanel; result = wxID_OK; - wxCFStringRef filename( [[sPanel filename] retain] ); - - m_path = filename.AsString(); + m_path = wxCFStringRef::AsString([sPanel filename]); m_fileName = wxFileNameFromPath(m_path); m_dir = wxPathOnly( m_path ); } @@ -222,11 +220,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]; @@ -235,7 +233,7 @@ int wxFileDialog::ShowModal() else */ { - returnCode = [oPanel runModalForDirectory:dir.AsNSString() + returnCode = [oPanel runModalForDirectory:dir.AsNSString() file:file.AsNSString() types:types]; } if (returnCode == NSOKButton ) @@ -245,8 +243,7 @@ int wxFileDialog::ShowModal() NSArray* filenames = [oPanel filenames]; for ( size_t i = 0 ; i < [filenames count] ; ++ i ) { - wxCFStringRef filename( [(NSString*) [filenames objectAtIndex:i] retain] ); - wxString fnstr = filename.AsString(); + wxString fnstr = wxCFStringRef::AsString([filenames objectAtIndex:i]); m_paths.Add( fnstr ); m_fileNames.Add( wxFileNameFromPath(fnstr) ); if ( i == 0 )