]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/filedlg.mm
wiring OnInit on osx to a later point in event processing
[wxWidgets.git] / src / osx / cocoa / filedlg.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/filedlg.mm
3 // Purpose: wxFileDialog for wxCocoa
4 // Author: Ryan Norton
5 // Modified by:
6 // Created: 2004-10-02
7 // RCS-ID: $Id$
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #if wxUSE_FILEDLG
24
25 #include "wx/filedlg.h"
26
27 #ifndef WX_PRECOMP
28 #include "wx/msgdlg.h"
29 #include "wx/app.h"
30 #include "wx/sizer.h"
31 #include "wx/stattext.h"
32 #include "wx/choice.h"
33 #endif
34
35 #include "wx/filename.h"
36 #include "wx/tokenzr.h"
37 #include "wx/evtloop.h"
38
39 #include "wx/osx/private.h"
40 #include "wx/sysopt.h"
41 #include "wx/modalhook.h"
42
43 #include <mach-o/dyld.h>
44
45 // ============================================================================
46 // implementation
47 // ============================================================================
48
49 // Open Items:
50 // - parameter support for descending into packages as directories (setTreatsFilePackagesAsDirectories)
51 // - as setAllowedFileTypes is only functional for NSOpenPanel on 10.6+, on earlier systems, the file
52 // type choice will not be shown, but all possible file items will be shown, if a popup must be working
53 // then the delegate method - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename will have to
54 // be implemented
55
56 namespace
57 {
58
59 bool HasAppKit_10_6()
60 {
61 // Even if we require 10.6, we might be loaded by an application that
62 // was linked against 10.5. setAllowedFileTypes will still be ignored
63 // in this case. From NSSavePanel.h:
64 // NSOpenPanel: On versions less than 10.6, this property is ignored.
65 // For applications that link against 10.6 and higher, this property will
66 // determine which files should be enabled in the open panel.
67 int32_t version = NSVersionOfLinkTimeLibrary("AppKit");
68 if (version == -1)
69 {
70 // If we're loaded by an application that doesn't link against AppKit,
71 // use the runtime version instead. This check will not work for the
72 // case above.
73 version = NSVersionOfRunTimeLibrary("AppKit");
74 }
75
76 // Notice that this still works correctly even if version is -1.
77 return version >= 0x40e2400 /* version of 10.6 AppKit */;
78 }
79
80 } // anonymous namespace
81
82 @interface wxOpenPanelDelegate : NSObject wxOSX_10_6_AND_LATER(<NSOpenSavePanelDelegate>)
83 {
84 wxFileDialog* _dialog;
85 }
86
87 - (wxFileDialog*) fileDialog;
88 - (void) setFileDialog:(wxFileDialog*) dialog;
89
90 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
91
92 @end
93
94 @implementation wxOpenPanelDelegate
95
96 - (id) init
97 {
98 self = [super init];
99 _dialog = NULL;
100 return self;
101 }
102
103 - (wxFileDialog*) fileDialog
104 {
105 return _dialog;
106 }
107
108 - (void) setFileDialog:(wxFileDialog*) dialog
109 {
110 _dialog = dialog;
111 }
112
113 - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
114 {
115 BOOL showObject = YES;
116
117 NSString* resolvedLink = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath:filename];
118 if ( resolvedLink != nil )
119 filename = resolvedLink;
120
121 NSDictionary* fileAttribs = [[NSFileManager defaultManager]
122 fileAttributesAtPath:filename traverseLink:YES];
123 if (fileAttribs)
124 {
125 // check for packages
126 if ([NSFileTypeDirectory isEqualTo:[fileAttribs objectForKey:NSFileType]])
127 {
128 if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
129 showObject = YES; // it's a folder, OK to show
130 else
131 {
132 // it's a packaged directory, apply check
133 wxCFStringRef filecf([filename retain]);
134 showObject = _dialog->CheckFile(filecf.AsString());
135 }
136 }
137 else
138 {
139 // the code above only solves links, not aliases, do this here:
140
141 NSString* resolvedAlias = nil;
142
143 CFURLRef url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,
144 (CFStringRef)filename,
145 kCFURLPOSIXPathStyle,
146 NO);
147 if (url != NULL)
148 {
149 FSRef fsRef;
150 if (CFURLGetFSRef(url, &fsRef))
151 {
152 Boolean targetIsFolder, wasAliased;
153 OSErr err = FSResolveAliasFile (&fsRef, true, &targetIsFolder, &wasAliased);
154
155 if ((err == noErr) && wasAliased)
156 {
157 CFURLRef resolvedUrl = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsRef);
158 if (resolvedUrl != NULL)
159 {
160 resolvedAlias = (NSString*) CFURLCopyFileSystemPath(resolvedUrl,
161 kCFURLPOSIXPathStyle);
162 CFRelease(resolvedUrl);
163 }
164 }
165 }
166 CFRelease(url);
167 }
168
169 if (resolvedAlias != nil)
170 {
171 // recursive call
172 [resolvedAlias autorelease];
173 showObject = [self panel:sender shouldShowFilename:resolvedAlias];
174 }
175 else
176 {
177 wxCFStringRef filecf([filename retain]);
178 showObject = _dialog->CheckFile(filecf.AsString());
179 }
180 }
181 }
182
183 return showObject;
184 }
185
186 @end
187
188 IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
189
190 void wxFileDialog::Init()
191 {
192 m_filterIndex = -1;
193 m_delegate = nil;
194 m_sheetDelegate = nil;
195 }
196
197 void wxFileDialog::Create(
198 wxWindow *parent, const wxString& message,
199 const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
200 long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
201 {
202 wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
203
204 m_sheetDelegate = [[ModalDialogDelegate alloc] init];
205 [(ModalDialogDelegate*)m_sheetDelegate setImplementation: this];
206 }
207
208 wxFileDialog::~wxFileDialog()
209 {
210 [m_sheetDelegate release];
211 }
212
213 bool wxFileDialog::SupportsExtraControl() const
214 {
215 return true;
216 }
217
218 NSArray* GetTypesFromExtension( const wxString extensiongroup, wxArrayString& extensions )
219 {
220 NSMutableArray* types = nil;
221 extensions.Clear();
222
223 wxStringTokenizer tokenizer( extensiongroup, wxT(";") ) ;
224 while ( tokenizer.HasMoreTokens() )
225 {
226 wxString extension = tokenizer.GetNextToken() ;
227 // Remove leading '*'
228 if ( extension.length() && (extension.GetChar(0) == '*') )
229 extension = extension.Mid( 1 );
230
231 // Remove leading '.'
232 if ( extension.length() && (extension.GetChar(0) == '.') )
233 extension = extension.Mid( 1 );
234
235 // Remove leading '*', this is for handling *.*
236 if ( extension.length() && (extension.GetChar(0) == '*') )
237 extension = extension.Mid( 1 );
238
239 if ( extension.IsEmpty() )
240 {
241 extensions.Clear();
242 [types release];
243 types = nil;
244 return nil;
245 }
246
247 if ( types == nil )
248 types = [[NSMutableArray alloc] init];
249
250 extensions.Add(extension.Lower());
251 wxCFStringRef cfext(extension);
252 [types addObject: (NSString*)cfext.AsNSString() ];
253 #if 0
254 // add support for classic fileType / creator here
255 wxUint32 fileType, creator;
256 // extension -> mactypes
257 #endif
258 }
259 [types autorelease];
260 return types;
261 }
262
263 NSArray* GetTypesFromFilter( const wxString& filter, wxArrayString& names, wxArrayString& extensiongroups )
264 {
265 NSMutableArray* types = nil;
266 bool allowAll = false;
267
268 names.Clear();
269 extensiongroups.Clear();
270
271 if ( !filter.empty() )
272 {
273 wxStringTokenizer tokenizer( filter, wxT("|") );
274 int numtokens = (int)tokenizer.CountTokens();
275 if(numtokens == 1)
276 {
277 // we allow for compatibility reason to have a single filter expression (like *.*) without
278 // an explanatory text, in that case the first part is name and extension at the same time
279 wxString extension = tokenizer.GetNextToken();
280 names.Add( extension );
281 extensiongroups.Add( extension );
282 }
283 else
284 {
285 int numextensions = numtokens / 2;
286 for(int i = 0; i < numextensions; i++)
287 {
288 wxString name = tokenizer.GetNextToken();
289 wxString extension = tokenizer.GetNextToken();
290 names.Add( name );
291 extensiongroups.Add( extension );
292 }
293 }
294
295 const size_t extCount = extensiongroups.GetCount();
296 wxArrayString extensions;
297 for ( size_t i = 0 ; i < extCount; i++ )
298 {
299 NSArray* exttypes = GetTypesFromExtension(extensiongroups[i], extensions);
300 if ( exttypes != nil )
301 {
302 if ( allowAll == false )
303 {
304 if ( types == nil )
305 types = [[NSMutableArray alloc] init];
306
307 [types addObjectsFromArray:exttypes];
308 }
309 }
310 else
311 {
312 allowAll = true;
313 [types release];
314 types = nil;
315 }
316 }
317 }
318 [types autorelease];
319 return types;
320 }
321
322 void wxFileDialog::ShowWindowModal()
323 {
324 wxCFStringRef cf( m_message );
325 wxCFStringRef dir( m_dir );
326 wxCFStringRef file( m_fileName );
327
328 wxNonOwnedWindow* parentWindow = NULL;
329
330 m_modality = wxDIALOG_MODALITY_WINDOW_MODAL;
331
332 if (GetParent())
333 parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
334
335 wxASSERT_MSG(parentWindow, "Window modal display requires parent.");
336
337 NSArray* types = GetTypesFromFilter( m_wildCard, m_filterNames, m_filterExtensions ) ;
338 if ( HasFlag(wxFD_SAVE) )
339 {
340 NSSavePanel* sPanel = [NSSavePanel savePanel];
341
342 SetupExtraControls(sPanel);
343
344 // makes things more convenient:
345 [sPanel setCanCreateDirectories:YES];
346 [sPanel setMessage:cf.AsNSString()];
347 // if we should be able to descend into pacakges we must somehow
348 // be able to pass this in
349 [sPanel setTreatsFilePackagesAsDirectories:NO];
350 [sPanel setCanSelectHiddenExtension:YES];
351 [sPanel setAllowedFileTypes:types];
352 [sPanel setAllowsOtherFileTypes:NO];
353
354 NSWindow* nativeParent = parentWindow->GetWXWindow();
355 [sPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString()
356 modalForWindow: nativeParent modalDelegate: m_sheetDelegate
357 didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
358 contextInfo: nil];
359 }
360 else
361 {
362 NSOpenPanel* oPanel = [NSOpenPanel openPanel];
363
364 SetupExtraControls(oPanel);
365
366 [oPanel setTreatsFilePackagesAsDirectories:NO];
367 [oPanel setCanChooseDirectories:NO];
368 [oPanel setResolvesAliases:YES];
369 [oPanel setCanChooseFiles:YES];
370 [oPanel setMessage:cf.AsNSString()];
371 [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )];
372
373 NSWindow* nativeParent = parentWindow->GetWXWindow();
374 [oPanel beginSheetForDirectory:dir.AsNSString() file:file.AsNSString()
375 types: types modalForWindow: nativeParent
376 modalDelegate: m_sheetDelegate
377 didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
378 contextInfo: nil];
379 }
380 }
381
382 // Create a panel with the file type drop down list
383 // If extra controls need to be added (see wxFileDialog::SetExtraControlCreator), add
384 // them to the panel as well
385 // Returns the newly created wxPanel
386
387 wxWindow* wxFileDialog::CreateFilterPanel(wxWindow *extracontrol)
388 {
389 wxPanel *extrapanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
390 wxBoxSizer *verticalSizer = new wxBoxSizer(wxVERTICAL);
391 extrapanel->SetSizer(verticalSizer);
392
393 // the file type control
394 {
395 wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
396 verticalSizer->Add(horizontalSizer, 0, wxEXPAND, 0);
397 wxStaticText *stattext = new wxStaticText( extrapanel, wxID_ANY, _("File type:") );
398 horizontalSizer->Add(stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
399 m_filterChoice = new wxChoice(extrapanel, wxID_ANY);
400 horizontalSizer->Add(m_filterChoice, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
401 m_filterChoice->Append(m_filterNames);
402 if( m_filterNames.GetCount() > 0)
403 {
404 if ( m_firstFileTypeFilter >= 0 )
405 m_filterChoice->SetSelection(m_firstFileTypeFilter);
406 }
407 m_filterChoice->Connect(wxEVT_CHOICE, wxCommandEventHandler(wxFileDialog::OnFilterSelected), NULL, this);
408 }
409
410 if(extracontrol)
411 {
412 wxBoxSizer *horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
413 verticalSizer->Add(horizontalSizer, 0, wxEXPAND, 0);
414
415 extracontrol->Reparent(extrapanel);
416 horizontalSizer->Add(extracontrol);
417 }
418
419 verticalSizer->Layout();
420 verticalSizer->SetSizeHints(extrapanel);
421 return extrapanel;
422 }
423
424 void wxFileDialog::DoOnFilterSelected(int index)
425 {
426 NSArray* types = GetTypesFromExtension(m_filterExtensions[index],m_currentExtensions);
427 NSSavePanel* panel = (NSSavePanel*) GetWXWindow();
428 if ( m_delegate )
429 [panel validateVisibleColumns];
430 else
431 [panel setAllowedFileTypes:types];
432 }
433
434 // An item has been selected in the file filter wxChoice:
435 void wxFileDialog::OnFilterSelected( wxCommandEvent &WXUNUSED(event) )
436 {
437 DoOnFilterSelected( m_filterChoice->GetSelection() );
438 }
439
440 bool wxFileDialog::CheckFile( const wxString& filename )
441 {
442 if ( m_currentExtensions.GetCount() == 0 )
443 return true;
444
445 wxString ext = filename.AfterLast('.').Lower();
446
447 for ( size_t i = 0; i < m_currentExtensions.GetCount(); ++i )
448 {
449 if ( ext == m_currentExtensions[i] )
450 return true;
451 }
452 return false;
453 }
454
455 void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
456 {
457 NSSavePanel* panel = (NSSavePanel*) nativeWindow;
458 // for sandboxed app we cannot access the outer structures
459 // this leads to problems with extra controls, so as a temporary
460 // workaround for crashes we don't support those yet
461 if ( [panel contentView] == nil )
462 return;
463
464 wxNonOwnedWindow::Create( GetParent(), nativeWindow );
465 wxWindow* extracontrol = NULL;
466 if ( HasExtraControlCreator() )
467 {
468 CreateExtraControl();
469 extracontrol = GetExtraControl();
470 }
471
472 NSView* accView = nil;
473
474 if ( m_useFileTypeFilter )
475 {
476 m_filterPanel = CreateFilterPanel(extracontrol);
477 accView = m_filterPanel->GetHandle();
478 if( HasFlag(wxFD_OPEN) )
479 {
480 if ( UMAGetSystemVersion() < 0x1060 || !HasAppKit_10_6() )
481 {
482 wxOpenPanelDelegate* del = [[wxOpenPanelDelegate alloc]init];
483 [del setFileDialog:this];
484 [panel setDelegate:del];
485 m_delegate = del;
486 }
487 }
488 }
489 else
490 {
491 m_filterPanel = NULL;
492 m_filterChoice = NULL;
493 if ( extracontrol != nil )
494 accView = extracontrol->GetHandle();
495 }
496
497 if ( accView != nil )
498 {
499 [accView removeFromSuperview];
500 [panel setAccessoryView:accView];
501 }
502 else
503 {
504 [panel setAccessoryView:nil];
505 }
506 }
507
508 int wxFileDialog::ShowModal()
509 {
510 WX_HOOK_MODAL_DIALOG();
511
512 wxCFEventLoopPauseIdleEvents pause;
513
514 wxMacAutoreleasePool autoreleasepool;
515
516 wxCFStringRef cf( m_message );
517
518 wxCFStringRef dir( m_dir );
519 wxCFStringRef file( m_fileName );
520
521 m_path = wxEmptyString;
522 m_fileNames.Clear();
523 m_paths.Clear();
524
525 wxNonOwnedWindow* parentWindow = NULL;
526 int returnCode = -1;
527
528 if (GetParent())
529 {
530 parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
531 }
532
533
534 NSArray* types = GetTypesFromFilter( m_wildCard, m_filterNames, m_filterExtensions ) ;
535
536 m_useFileTypeFilter = m_filterExtensions.GetCount() > 1;
537
538 if( HasFlag(wxFD_OPEN) )
539 {
540 if ( !(wxSystemOptions::HasOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) && (wxSystemOptions::GetOptionInt( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) == 1)) )
541 m_useFileTypeFilter = false;
542 }
543
544 m_firstFileTypeFilter = -1;
545
546 if ( m_useFileTypeFilter
547 && m_filterIndex >= 0 && m_filterIndex < m_filterExtensions.GetCount() )
548 {
549 m_firstFileTypeFilter = m_filterIndex;
550 }
551 else if ( m_useFileTypeFilter )
552 {
553 types = nil;
554 bool useDefault = true;
555 for ( size_t i = 0; i < m_filterExtensions.GetCount(); ++i )
556 {
557 types = GetTypesFromExtension(m_filterExtensions[i], m_currentExtensions);
558 if ( m_currentExtensions.GetCount() == 0 )
559 {
560 useDefault = false;
561 m_firstFileTypeFilter = i;
562 break;
563 }
564
565 for ( size_t j = 0; j < m_currentExtensions.GetCount(); ++j )
566 {
567 if ( m_fileName.EndsWith(m_currentExtensions[j]) )
568 {
569 m_firstFileTypeFilter = i;
570 useDefault = false;
571 break;
572 }
573 }
574 if ( !useDefault )
575 break;
576 }
577 if ( useDefault )
578 {
579 types = GetTypesFromExtension(m_filterExtensions[0], m_currentExtensions);
580 m_firstFileTypeFilter = 0;
581 }
582 }
583
584 if ( HasFlag(wxFD_SAVE) )
585 {
586 NSSavePanel* sPanel = [NSSavePanel savePanel];
587
588 SetupExtraControls(sPanel);
589
590 // makes things more convenient:
591 [sPanel setCanCreateDirectories:YES];
592 [sPanel setMessage:cf.AsNSString()];
593 // if we should be able to descend into pacakges we must somehow
594 // be able to pass this in
595 [sPanel setTreatsFilePackagesAsDirectories:NO];
596 [sPanel setCanSelectHiddenExtension:YES];
597 [sPanel setAllowedFileTypes:types];
598 [sPanel setAllowsOtherFileTypes:NO];
599
600 if ( HasFlag(wxFD_OVERWRITE_PROMPT) )
601 {
602 }
603
604 /*
605 Let the file dialog know what file type should be used initially.
606 If this is not done then when setting the filter index
607 programmatically to 1 the file will still have the extension
608 of the first file type instead of the second one. E.g. when file
609 types are foo and bar, a filename "myletter" with SetDialogIndex(1)
610 would result in saving as myletter.foo, while we want myletter.bar.
611 */
612 if(m_firstFileTypeFilter > 0)
613 {
614 DoOnFilterSelected(m_firstFileTypeFilter);
615 }
616
617 returnCode = [sPanel runModalForDirectory: m_dir.IsEmpty() ? nil : dir.AsNSString() file:file.AsNSString() ];
618 ModalFinishedCallback(sPanel, returnCode);
619 }
620 else
621 {
622 NSOpenPanel* oPanel = [NSOpenPanel openPanel];
623
624 SetupExtraControls(oPanel);
625
626 [oPanel setTreatsFilePackagesAsDirectories:NO];
627 [oPanel setCanChooseDirectories:NO];
628 [oPanel setResolvesAliases:YES];
629 [oPanel setCanChooseFiles:YES];
630 [oPanel setMessage:cf.AsNSString()];
631 [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )];
632
633 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
634 if ( UMAGetSystemVersion() >= 0x1060 && HasAppKit_10_6() )
635 {
636 [oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)];
637 if ( !m_dir.IsEmpty() )
638 [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString()
639 isDirectory:YES]];
640 returnCode = [oPanel runModal];
641 }
642 else
643 #endif
644 {
645 returnCode = [oPanel runModalForDirectory:m_dir.IsEmpty() ? nil : dir.AsNSString()
646 file:file.AsNSString() types:(m_delegate == nil ? types : nil)];
647 }
648
649 ModalFinishedCallback(oPanel, returnCode);
650 }
651
652 return GetReturnCode();
653 }
654
655 void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode)
656 {
657 int result = wxID_CANCEL;
658 if (HasFlag(wxFD_SAVE))
659 {
660 if (returnCode == NSOKButton )
661 {
662 NSSavePanel* sPanel = (NSSavePanel*)panel;
663 result = wxID_OK;
664
665 m_path = wxCFStringRef::AsStringWithNormalizationFormC([sPanel filename]);
666 m_fileName = wxFileNameFromPath(m_path);
667 m_dir = wxPathOnly( m_path );
668 if (m_filterChoice)
669 {
670 m_filterIndex = m_filterChoice->GetSelection();
671 }
672 }
673 }
674 else
675 {
676 NSOpenPanel* oPanel = (NSOpenPanel*)panel;
677 if (returnCode == NSOKButton )
678 {
679 panel = oPanel;
680 result = wxID_OK;
681 NSArray* filenames = [oPanel filenames];
682 for ( size_t i = 0 ; i < [filenames count] ; ++ i )
683 {
684 wxString fnstr = wxCFStringRef::AsStringWithNormalizationFormC([filenames objectAtIndex:i]);
685 m_paths.Add( fnstr );
686 m_fileNames.Add( wxFileNameFromPath(fnstr) );
687 if ( i == 0 )
688 {
689 m_path = fnstr;
690 m_fileName = wxFileNameFromPath(fnstr);
691 m_dir = wxPathOnly( fnstr );
692 }
693 }
694 }
695 if ( m_delegate )
696 {
697 [oPanel setDelegate:nil];
698 [m_delegate release];
699 m_delegate = nil;
700 }
701 }
702 SetReturnCode(result);
703
704 if (GetModality() == wxDIALOG_MODALITY_WINDOW_MODAL)
705 SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
706
707 // workaround for sandboxed app, see above
708 if ( m_isNativeWindowWrapper )
709 UnsubclassWin();
710 [(NSSavePanel*) panel setAccessoryView:nil];
711 }
712
713 #endif // wxUSE_FILEDLG