]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/filedlg.cpp
Fit modeless preferences dialog to its contents too.
[wxWidgets.git] / src / osx / carbon / filedlg.cpp
CommitLineData
489468fe 1/////////////////////////////////////////////////////////////////////////////
524c47aa 2// Name: src/osx/carbon/filedlg.cpp
489468fe
SC
3// Purpose: wxFileDialog
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#if wxUSE_FILEDLG
15
16#include "wx/filedlg.h"
17
18#ifndef WX_PRECOMP
19 #include "wx/intl.h"
20 #include "wx/app.h"
21 #include "wx/utils.h"
22 #include "wx/dialog.h"
23#endif
24
25#include "wx/tokenzr.h"
26#include "wx/filename.h"
27
1f0c8f31 28#include "wx/osx/private.h"
691745ab 29#include "wx/modalhook.h"
489468fe
SC
30
31#ifndef __DARWIN__
32 #include <Navigation.h>
33 #include "PLStringFuncs.h"
34#endif
35
36IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase)
37
38// the data we need to pass to our standard file hook routine
39// includes a pointer to the dialog, a pointer to the standard
40// file reply record (so we can inspect the current selection)
41// and a copy of the "previous" file spec of the reply record
42// so we can see if the selection has changed
43
61ad44c7 44class OpenUserDataRec
489468fe 45{
61ad44c7
SC
46public:
47 OpenUserDataRec( wxFileDialog* dialog );
ce00f59b 48
61ad44c7
SC
49 bool FilterCallback( AEDesc *theItem, void *info, NavFilterModes filterMode );
50 void EventProc( NavEventCallbackMessage inSelector, NavCBRecPtr ioParams );
489468fe 51
98daf410
SC
52 int GetCurrentFilter() const {return m_currentfilter;}
53 CFArrayRef GetMenuItems() const { return m_menuitems;}
ce00f59b
VZ
54
55
61ad44c7
SC
56private:
57 void EventProcCBEvent( NavCBRecPtr ioParams );
58 void EventProcCBEventMouseDown( NavCBRecPtr ioParams);
59 void EventProcCBStart( NavCBRecPtr ioParams );
60 void EventProcCBPopupMenuSelect( NavCBRecPtr ioParams );
61 void EventProcCBCustomize( NavCBRecPtr ioParams );
62 void EventProcCBAdjustRect( NavCBRecPtr ioParams );
63 bool CheckFile( const wxString &filename , OSType type);
64 void MakeUserDataRec( const wxString& filter);
ce00f59b 65
98daf410
SC
66 wxFileDialog* m_dialog;
67 int m_currentfilter;
68 wxString m_defaultLocation;
69 wxArrayString m_extensions;
70 wxArrayLong m_filtermactypes;
71 CFMutableArrayRef m_menuitems;
72 wxArrayString m_name;
73 bool m_saveMode;
74 SInt16 m_lastRight;
75 SInt16 m_lastBottom;
2f30930a 76 bool m_controlAdded;
61ad44c7 77};
489468fe 78
61ad44c7
SC
79OpenUserDataRec::OpenUserDataRec( wxFileDialog* d)
80{
98daf410 81 m_dialog = d;
2f30930a 82 m_controlAdded = false;
98daf410 83 m_saveMode = m_dialog->HasFdFlag(wxFD_SAVE);
ce00f59b 84
98daf410
SC
85 m_defaultLocation = m_dialog->GetDirectory();
86 MakeUserDataRec(m_dialog->GetWildcard());
87 m_currentfilter = m_dialog->GetFilterIndex();
ce00f59b 88
98daf410 89 m_menuitems = NULL;
ce00f59b 90
98daf410 91 size_t numFilters = m_extensions.GetCount();
61ad44c7
SC
92 if (numFilters)
93 {
98daf410 94 m_menuitems = CFArrayCreateMutable( kCFAllocatorDefault ,
61ad44c7
SC
95 numFilters , &kCFTypeArrayCallBacks ) ;
96 for ( size_t i = 0 ; i < numFilters ; ++i )
97 {
98daf410 98 CFArrayAppendValue( m_menuitems , (CFStringRef) wxCFStringRef( m_name[i] ) ) ;
61ad44c7
SC
99 }
100 }
98daf410 101 m_lastRight = m_lastBottom = 0;
61ad44c7 102}
489468fe 103
61ad44c7 104void OpenUserDataRec::EventProc(NavEventCallbackMessage inSelector,NavCBRecPtr ioParams)
489468fe 105{
61ad44c7 106 switch (inSelector)
489468fe 107 {
61ad44c7
SC
108 case kNavCBEvent:
109 EventProcCBEvent(ioParams);
110 break;
111 case kNavCBStart:
112 EventProcCBStart(ioParams);
113 break;
114 case kNavCBPopupMenuSelect:
115 EventProcCBPopupMenuSelect(ioParams);
116 break;
117 case kNavCBCustomize:
118 EventProcCBCustomize(ioParams);
119 break;
120 case kNavCBAdjustRect:
121 EventProcCBAdjustRect(ioParams);
122 break;
123 default:
124 break;
489468fe 125 }
61ad44c7
SC
126}
127
128void OpenUserDataRec::EventProcCBEvent(NavCBRecPtr callBackParms)
129{
130 switch (callBackParms->eventData.eventDataParms.event->what)
489468fe 131 {
61ad44c7 132 case mouseDown:
489468fe 133 {
61ad44c7
SC
134 EventProcCBEventMouseDown(callBackParms);
135 break;
489468fe 136 }
ce00f59b 137 }
61ad44c7 138}
489468fe 139
61ad44c7
SC
140void OpenUserDataRec::EventProcCBEventMouseDown(NavCBRecPtr callBackParms)
141{
142 EventRecord *evt = callBackParms->eventData.eventDataParms.event;
143 Point where = evt->where;
98daf410 144 QDGlobalToLocalPoint(GetWindowPort(callBackParms->window), &where);
ce00f59b 145
61ad44c7
SC
146 ControlRef whichControl = FindControlUnderMouse(where, callBackParms->window, NULL);
147 if (whichControl != NULL)
148 {
149 ControlKind theKind;
150 GetControlKind(whichControl, &theKind);
ce00f59b 151
98daf410 152 // Moving the focus if we clicked in an focusable control
ce00f59b
VZ
153 if ((theKind.kind == kControlKindEditUnicodeText) ||
154 (theKind.kind == kControlKindEditText) ||
155 (theKind.kind == kControlKindDataBrowser) ||
98daf410 156 (theKind.kind == kControlKindListBox))
489468fe 157 {
61ad44c7
SC
158 ControlRef currentlyFocusedControl;
159 GetKeyboardFocus(callBackParms->window, &currentlyFocusedControl);
160 if (currentlyFocusedControl != whichControl)
161 SetKeyboardFocus(callBackParms->window, whichControl, kControlFocusNextPart);
489468fe 162 }
61ad44c7 163 HandleControlClick(whichControl, where, evt->modifiers, NULL);
489468fe 164 }
61ad44c7
SC
165}
166
167void OpenUserDataRec::EventProcCBStart(NavCBRecPtr ioParams)
168{
98daf410 169 if (!m_defaultLocation.empty())
61ad44c7
SC
170 {
171 // Set default location for the modern Navigation APIs
172 // Apple Technical Q&A 1151
173 FSRef theFile;
98daf410 174 wxMacPathToFSRef(m_defaultLocation, &theFile);
61ad44c7
SC
175 AEDesc theLocation = { typeNull, NULL };
176 if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation))
177 ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
178 }
ce00f59b 179
98daf410 180 if( m_extensions.GetCount() > 0 )
489468fe 181 {
61ad44c7
SC
182 NavMenuItemSpec menuItem;
183 memset( &menuItem, 0, sizeof(menuItem) );
184 menuItem.version = kNavMenuItemSpecVersion;
98daf410 185 menuItem.menuType = m_currentfilter;
61ad44c7
SC
186 ::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem);
187 }
ce00f59b 188
98daf410 189 if (m_dialog->GetExtraControl())
61ad44c7 190 {
2f30930a 191 m_controlAdded = true;
98daf410 192 ControlRef ref = m_dialog->GetExtraControl()->GetPeer()->GetControlRef();
61ad44c7
SC
193 NavCustomControl(ioParams->context, kNavCtlAddControl, ref);
194 }
ce00f59b 195
61ad44c7 196}
489468fe 197
61ad44c7
SC
198void OpenUserDataRec::EventProcCBPopupMenuSelect(NavCBRecPtr ioParams)
199{
200 NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
98daf410 201 const size_t numFilters = m_extensions.GetCount();
ce00f59b 202
61ad44c7
SC
203 if ( menu->menuType < numFilters )
204 {
98daf410
SC
205 m_currentfilter = menu->menuType ;
206 if ( m_saveMode )
489468fe 207 {
61ad44c7 208 int i = menu->menuType ;
ce00f59b 209
61ad44c7 210 // isolate the first extension string
98daf410 211 wxString firstExtension = m_extensions[i].BeforeFirst('|').BeforeFirst(';');
ce00f59b 212
61ad44c7
SC
213 wxString extension = firstExtension.AfterLast('.') ;
214 wxString sfilename ;
ce00f59b 215
61ad44c7
SC
216 wxCFStringRef cfString( wxCFRetain( NavDialogGetSaveFileName( ioParams->context ) ) );
217 sfilename = cfString.AsString() ;
ce00f59b 218
61ad44c7
SC
219 int pos = sfilename.Find('.', true) ;
220 if ( pos != wxNOT_FOUND && extension != wxT("*") )
489468fe 221 {
61ad44c7
SC
222 sfilename = sfilename.Left(pos+1)+extension ;
223 cfString = wxCFStringRef( sfilename , wxFONTENCODING_DEFAULT ) ;
224 NavDialogSetSaveFileName( ioParams->context , cfString ) ;
489468fe
SC
225 }
226 }
227 }
228}
229
61ad44c7 230void OpenUserDataRec::EventProcCBCustomize(NavCBRecPtr ioParams)
489468fe 231{
98daf410 232 wxWindow* control = m_dialog->GetExtraControl();
ce00f59b 233
98daf410 234 if ( control )
61ad44c7 235 {
98daf410 236 SInt16 neededRight, neededBottom;
ce00f59b 237
98daf410
SC
238 wxSize size = m_dialog->GetExtraControl()->GetSize();
239 neededRight = ioParams->customRect.left + size.x;
240 neededBottom = ioParams->customRect.top + size.y;
ce00f59b 241
98daf410
SC
242 if (ioParams->customRect.right == 0 && ioParams->customRect.bottom == 0)
243 {
244 ioParams->customRect.right = neededRight;
245 ioParams->customRect.bottom = neededBottom;
246 }
ce00f59b 247 else
98daf410
SC
248 {
249 if ( ioParams->customRect.right != m_lastRight )
250 {
251 if ( ioParams->customRect.right < neededRight )
252 ioParams->customRect.right = neededRight;
253 }
254 if ( ioParams->customRect.bottom != m_lastBottom )
255 {
256 if ( ioParams->customRect.bottom < neededBottom )
257 ioParams->customRect.bottom = neededBottom;
258 }
259 }
260 m_lastRight = ioParams->customRect.right;
261 m_lastBottom = ioParams->customRect.bottom;
61ad44c7
SC
262 }
263}
264
265void OpenUserDataRec::EventProcCBAdjustRect(NavCBRecPtr ioParams)
266{
98daf410 267 wxWindow* control = m_dialog->GetExtraControl();
ce00f59b 268
2f30930a 269 if ( control && m_controlAdded)
98daf410 270 {
ce00f59b 271 control->SetSize(ioParams->customRect.left , ioParams->customRect.top,
2f30930a
SC
272 ioParams->customRect.right - ioParams->customRect.left,
273 ioParams->customRect.bottom - ioParams->customRect.top);
98daf410 274 }
61ad44c7
SC
275}
276
277void OpenUserDataRec::MakeUserDataRec( const wxString& filter )
278{
489468fe
SC
279 if ( !filter.empty() )
280 {
281 wxString filter2(filter) ;
282 int filterIndex = 0;
283 bool isName = true ;
284 wxString current ;
285
286 for ( unsigned int i = 0; i < filter2.length() ; i++ )
287 {
288 if ( filter2.GetChar(i) == wxT('|') )
289 {
290 if ( isName )
291 {
98daf410 292 m_name.Add( current ) ;
489468fe
SC
293 }
294 else
295 {
98daf410 296 m_extensions.Add( current ) ;
489468fe
SC
297 ++filterIndex ;
298 }
299
300 isName = !isName ;
301 current = wxEmptyString ;
302 }
303 else
304 {
305 current += filter2.GetChar(i) ;
306 }
307 }
308 // we allow for compatibility reason to have a single filter expression (like *.*) without
309 // an explanatory text, in that case the first part is name and extension at the same time
310
311 wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
312 if ( current.empty() )
98daf410 313 m_extensions.Add( m_name[filterIndex] ) ;
489468fe 314 else
98daf410 315 m_extensions.Add( current ) ;
489468fe 316 if ( filterIndex == 0 || isName )
98daf410 317 m_name.Add( current ) ;
489468fe
SC
318
319 ++filterIndex ;
320
98daf410 321 const size_t extCount = m_extensions.GetCount();
489468fe
SC
322 for ( size_t i = 0 ; i < extCount; i++ )
323 {
324 wxUint32 fileType, creator;
98daf410 325 wxString extension = m_extensions[i];
489468fe
SC
326
327 // Remove leading '*'
6636ef8d 328 if ( !extension.empty() && (extension.GetChar(0) == '*') )
489468fe
SC
329 extension = extension.Mid( 1 );
330
331 // Remove leading '.'
6636ef8d 332 if ( !extension.empty() && (extension.GetChar(0) == '.') )
489468fe
SC
333 extension = extension.Mid( 1 );
334
335 if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator ))
98daf410 336 m_filtermactypes.Add( (OSType)fileType );
489468fe 337 else
98daf410 338 m_filtermactypes.Add( '****' ); // We'll fail safe if it's not recognized
489468fe
SC
339 }
340 }
341}
342
61ad44c7 343bool OpenUserDataRec::CheckFile( const wxString &filename , OSType type)
489468fe
SC
344{
345 wxString file(filename) ;
346 file.MakeUpper() ;
347
98daf410 348 if ( m_extensions.GetCount() > 0 )
489468fe
SC
349 {
350 //for ( int i = 0 ; i < data->numfilters ; ++i )
98daf410
SC
351 int i = m_currentfilter ;
352 if ( m_extensions[i].Right(2) == wxT(".*") )
489468fe
SC
353 return true ;
354
355 {
98daf410 356 if ( type == (OSType)m_filtermactypes[i] )
489468fe
SC
357 return true ;
358
98daf410 359 wxStringTokenizer tokenizer( m_extensions[i] , wxT(";") ) ;
489468fe
SC
360 while ( tokenizer.HasMoreTokens() )
361 {
362 wxString extension = tokenizer.GetNextToken() ;
363 if ( extension.GetChar(0) == '*' )
364 extension = extension.Mid(1) ;
365 extension.MakeUpper();
366
367 if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) )
368 return true ;
369 }
370 }
371
372 return false ;
373 }
374
375 return true ;
376}
377
61ad44c7
SC
378bool OpenUserDataRec::FilterCallback(
379 AEDesc *theItem,
380 void *info,
381 NavFilterModes filterMode )
489468fe 382{
489468fe
SC
383 if (filterMode == kNavFilteringBrowserList)
384 {
385 // We allow navigation to all folders. For files, we check against the current
386 // filter string.
387 // However, packages should be dealt with like files and not like folders. So
388 // check if a folder is a package before deciding what to do.
389 NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
390 FSRef fsref;
ce00f59b 391
489468fe
SC
392 if ( theInfo->isFolder )
393 {
394 // check bundle bit (using Finder Services - used by OS9 on some bundles)
395 FSCatalogInfo catalogInfo;
396 if (FSGetCatalogInfo (&fsref, kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL) != noErr)
397 return true;
ce00f59b 398
489468fe
SC
399 // Check bundle item (using Launch Services - used by OS-X through info.plist or APP)
400 LSItemInfoRecord lsInfo;
401 if (LSCopyItemInfoForRef(&fsref, kLSRequestBasicFlagsOnly, &lsInfo ) != noErr)
402 return true;
ce00f59b 403
489468fe
SC
404 // If it's not a bundle, then it's a normal folder and it passes our filter
405 FileInfo *fileInfo = (FileInfo *) catalogInfo.finderInfo;
406 if ( !(fileInfo->finderFlags & kHasBundle) &&
61ad44c7 407 !(lsInfo.flags & (kLSItemInfoIsApplication | kLSItemInfoIsPackage)) )
489468fe
SC
408 return true;
409 }
410 else
411 {
412 AECoerceDesc (theItem, typeFSRef, theItem);
413 if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr)
414 {
415 wxString file = wxMacFSRefToPath( &fsref ) ;
61ad44c7 416 return CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType ) ;
489468fe
SC
417 }
418 }
419 }
ce00f59b 420
489468fe
SC
421 return true;
422}
423
61ad44c7
SC
424// end wxmac
425
426pascal Boolean CrossPlatformFilterCallback(
427 AEDesc *theItem,
428 void *info,
429 void *callBackUD,
430 NavFilterModes filterMode );
431
432pascal Boolean CrossPlatformFilterCallback(
433 AEDesc *theItem,
434 void *info,
435 void *callBackUD,
436 NavFilterModes filterMode )
437{
438 OpenUserDataRec* data = (OpenUserDataRec*) callBackUD ;
439 return data->FilterCallback(theItem,info,filterMode);
440}
441
442static pascal void NavEventProc(
443 NavEventCallbackMessage inSelector,
444 NavCBRecPtr ioParams,
445 NavCallBackUserData ioUserData );
446
447static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
448
449static pascal void NavEventProc(
450 NavEventCallbackMessage inSelector,
451 NavCBRecPtr ioParams,
452 NavCallBackUserData ioUserData )
453{
454 OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
455 data->EventProc(inSelector, ioParams);
456}
457
458
459wxFileDialog::wxFileDialog(
460 wxWindow *parent, const wxString& message,
461 const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
462 long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
463 : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
464{
465 wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
466}
467
2f30930a
SC
468void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
469{
0e05b13c 470 wxTopLevelWindow::Create( GetParent(), nativeWindow );
ce00f59b 471
2f30930a
SC
472 if (HasExtraControlCreator())
473 {
474 CreateExtraControl();
475 }
476}
477
489468fe
SC
478int wxFileDialog::ShowModal()
479{
691745ab 480 WX_HOOK_MODAL_DIALOG();
643e9cf9 481
8b558f12
JS
482 m_paths.Empty();
483 m_fileNames.Empty();
ce00f59b 484
489468fe
SC
485 OSErr err;
486 NavDialogCreationOptions dialogCreateOptions;
487
488 // set default options
489 ::NavGetDefaultDialogCreationOptions(&dialogCreateOptions);
490
491 // this was always unset in the old code
492 dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
493
494 wxCFStringRef message(m_message, GetFont().GetEncoding());
495 dialogCreateOptions.windowTitle = message;
496
497 wxCFStringRef defaultFileName(m_fileName, GetFont().GetEncoding());
498 dialogCreateOptions.saveFileName = defaultFileName;
499
489468fe
SC
500 NavDialogRef dialog;
501 NavObjectFilterUPP navFilterUPP = NULL;
61ad44c7 502 OpenUserDataRec myData( this );
ce00f59b 503
61ad44c7 504 dialogCreateOptions.popupExtension = myData.GetMenuItems();
ce00f59b 505
489468fe
SC
506 if (HasFdFlag(wxFD_SAVE))
507 {
489468fe
SC
508 dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
509 dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
61ad44c7 510 if (dialogCreateOptions.popupExtension == NULL)
489468fe
SC
511 dialogCreateOptions.optionFlags |= kNavNoTypePopup;
512
513 // The extension is important
61ad44c7 514 if ( dialogCreateOptions.popupExtension == NULL || CFArrayGetCount(dialogCreateOptions.popupExtension)<2)
489468fe
SC
515 dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
516
517 if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT))
518 dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
519
520 err = ::NavCreatePutFileDialog(
521 &dialogCreateOptions,
522 kNavGenericSignature, // Suppresses the 'Default' (top) menu item
523 kNavGenericSignature,
524 sStandardNavEventFilter,
525 &myData, // for defaultLocation
526 &dialog );
527 }
528 else
529 {
530 // let the user select bundles/programs in dialogs
531 dialogCreateOptions.optionFlags |= kNavSupportPackages;
532
533 navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
534 err = ::NavCreateGetFileDialog(
535 &dialogCreateOptions,
536 NULL, // NavTypeListHandle
537 sStandardNavEventFilter,
538 NULL, // NavPreviewUPP
539 navFilterUPP,
540 (void *) &myData, // inClientData
541 &dialog );
542 }
ce00f59b 543
2f30930a 544 SetupExtraControls(NavDialogGetWindow(dialog));
ce00f59b 545
489468fe 546 if (err == noErr)
445e564f
SC
547 {
548 wxDialog::OSXBeginModalDialog();
489468fe 549 err = ::NavDialogRun(dialog);
445e564f
SC
550 wxDialog::OSXEndModalDialog();
551 }
489468fe
SC
552
553 // clean up filter related data, etc.
554 if (navFilterUPP)
555 ::DisposeNavObjectFilterUPP(navFilterUPP);
556
557 if (err != noErr)
558 {
559 ::NavDialogDispose(dialog);
560 return wxID_CANCEL;
561 }
562
563 NavReplyRecord navReply;
564 err = ::NavDialogGetReply(dialog, &navReply);
565 if (err == noErr && navReply.validRecord)
566 {
567 AEKeyword theKeyword;
568 DescType actualType;
569 Size actualSize;
570 FSRef theFSRef;
571 wxString thePath ;
572 long count;
573
61ad44c7 574 m_filterIndex = myData.GetCurrentFilter();
489468fe
SC
575 ::AECountItems( &navReply.selection, &count );
576 for (long i = 1; i <= count; ++i)
577 {
578 err = ::AEGetNthPtr(
579 &(navReply.selection), i, typeFSRef, &theKeyword, &actualType,
580 &theFSRef, sizeof(theFSRef), &actualSize );
581 if (err != noErr)
582 break;
583
584 if (HasFdFlag(wxFD_SAVE))
585 thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
586 else
587 thePath = wxMacFSRefToPath( &theFSRef );
588
589 if (!thePath)
590 {
591 ::NavDisposeReply(&navReply);
592 ::NavDialogDispose(dialog);
593 return wxID_CANCEL;
594 }
595
596 m_path = thePath;
597 m_paths.Add(m_path);
598 m_fileName = wxFileNameFromPath(m_path);
599 m_fileNames.Add(m_fileName);
600 }
601
602 // set these to the first hit
603 m_path = m_paths[0];
604 m_fileName = wxFileNameFromPath(m_path);
605 m_dir = wxPathOnly(m_path);
606 }
607
d623e8b1 608 UnsubclassWin();
489468fe
SC
609 ::NavDisposeReply(&navReply);
610 ::NavDialogDispose(dialog);
611
612 return (err == noErr) ? wxID_OK : wxID_CANCEL;
613}
614
61ad44c7
SC
615bool wxFileDialog::SupportsExtraControl() const
616{
617 return true;
618}
619
489468fe
SC
620#endif // wxUSE_FILEDLG
621