+static pascal void NavEventProc(
+ NavEventCallbackMessage inSelector,
+ NavCBRecPtr ioParams,
+ NavCallBackUserData ioUserData );
+
+static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
+
+static pascal void NavEventProc(
+ NavEventCallbackMessage inSelector,
+ NavCBRecPtr ioParams,
+ NavCallBackUserData ioUserData )
+{
+ wxDirDialog * data = ( wxDirDialog *) ioUserData ;
+ if ( inSelector == kNavCBStart )
+ {
+ if (data && !data->GetPath().IsEmpty() )
+ {
+ // Set default location for the modern Navigation APIs
+ // Apple Technical Q&A 1151
+ FSSpec theFSSpec;
+ wxMacFilename2FSSpec(data->GetPath(), &theFSSpec);
+ AEDesc theLocation = { typeNull, NULL };
+ if (noErr == ::AECreateDesc(typeFSS, &theFSSpec, sizeof(FSSpec), &theLocation))
+ ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
+ }
+ }
+}
+