diff --git a/lib-src/FileDialog/mac/FileDialogPrivate.h b/lib-src/FileDialog/mac/FileDialogPrivate.h
index 697969fd2a31d24501361b71bfc076f37671f813..a2db97e9f21661e874984c01d8375b44d93ecd16 100644
a
|
b
|
protected: |
96 | 96 | int m_firstFileTypeFilter; |
97 | 97 | wxArrayString m_currentExtensions; |
98 | 98 | WX_NSObject m_delegate; |
| 99 | #if !wxCHECK_VERSION(3, 0, 3) |
99 | 100 | WX_NSObject m_sheetDelegate; |
| 101 | #endif |
100 | 102 | wxString m_noOverwritePromptFilename; |
101 | 103 | #endif |
102 | 104 | |
diff --git a/lib-src/FileDialog/mac/FileDialogPrivate.mm b/lib-src/FileDialog/mac/FileDialogPrivate.mm
index 508d8b8002dc18b17c8700f9eb7061c4178e0e6b..a9429f90f5418035152b678108dd7a97c9158653 100644
a
|
b
|
void FileDialog::Init() |
141 | 141 | { |
142 | 142 | m_filterIndex = -1; |
143 | 143 | m_delegate = nil; |
| 144 | #if !wxCHECK_VERSION(3, 0, 3) |
144 | 145 | m_sheetDelegate = nil; |
| 146 | #endif |
145 | 147 | m_filterPanel = NULL; |
146 | 148 | m_filterChoice = NULL; |
147 | 149 | } |
… |
… |
void FileDialog::Create( |
152 | 154 | long style, const wxPoint& pos, const wxSize& sz, const wxString& name) |
153 | 155 | { |
154 | 156 | FileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name); |
155 | | |
| 157 | #if !wxCHECK_VERSION(3, 0, 3) |
156 | 158 | m_sheetDelegate = [[ModalDialogDelegate alloc] init]; |
157 | 159 | [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this]; |
| 160 | #endif |
158 | 161 | } |
159 | 162 | |
160 | 163 | FileDialog::~FileDialog() |
161 | 164 | { |
| 165 | #if !wxCHECK_VERSION(3, 0, 3) |
162 | 166 | [m_sheetDelegate release]; |
| 167 | #endif |
163 | 168 | } |
164 | 169 | |
165 | 170 | bool FileDialog::SupportsExtraControl() const |
… |
… |
void FileDialog::ShowWindowModal() |
309 | 314 | [sPanel setAllowsOtherFileTypes:NO]; |
310 | 315 | |
311 | 316 | NSWindow* nativeParent = parentWindow->GetWXWindow(); |
| 317 | #if wxCHECK_VERSION(3, 0, 3) |
| 318 | // the ModalDialogDelegate class is no longer exported, but the |
| 319 | // beginSheetForDirectory: message has been deprecated since 10.6 |
| 320 | // Use the modern equivalent: |
| 321 | [sPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() isDirectory:YES]]; |
| 322 | [sPanel setNameFieldStringValue:file.AsNSString()]; |
| 323 | [sPanel beginSheetModalForWindow:nativeParent completionHandler:^(NSInteger result) { |
| 324 | if (result == NSFileHandlingPanelOKButton) { |
| 325 | NSLog(@"Saved file %@", [sPanel URL]); |
| 326 | } |
| 327 | }]; |
| 328 | #else |
312 | 329 | [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() |
313 | | modalForWindow: nativeParent modalDelegate: m_sheetDelegate |
| 330 | modalForWindow: nativeParent |
| 331 | modalDelegate: m_sheetDelegate |
314 | 332 | didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) |
315 | 333 | contextInfo: nil]; |
| 334 | #endif |
316 | 335 | } |
317 | | else |
| 336 | else |
318 | 337 | { |
319 | 338 | NSOpenPanel* oPanel = [NSOpenPanel openPanel]; |
320 | 339 | |
… |
… |
void FileDialog::ShowWindowModal() |
328 | 347 | [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; |
329 | 348 | |
330 | 349 | NSWindow* nativeParent = parentWindow->GetWXWindow(); |
| 350 | #if wxCHECK_VERSION(3, 0, 3) |
| 351 | [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() isDirectory:YES]]; |
| 352 | [oPanel setNameFieldStringValue:file.AsNSString()]; |
| 353 | [oPanel setAllowedFileTypes:types]; |
| 354 | [oPanel beginSheetModalForWindow:nativeParent completionHandler:^(NSInteger result) { |
| 355 | if (result == NSFileHandlingPanelOKButton) { |
| 356 | NSLog(@"Opened file(s) %@", [oPanel URLs]); |
| 357 | } |
| 358 | }]; |
| 359 | #else |
331 | 360 | [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString() |
332 | 361 | types: types modalForWindow: nativeParent |
333 | 362 | modalDelegate: m_sheetDelegate |
334 | 363 | didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) |
335 | 364 | contextInfo: nil]; |
| 365 | #endif |
336 | 366 | } |
337 | 367 | } |
338 | 368 | |