]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/filedlg.cpp
Change event names to clarify that they are only fired by button clicks, and note...
[wxWidgets.git] / src / mac / carbon / filedlg.cpp
index 9e73bcf2d3510e495b91e066ea01624126342504..1eee666aaeb601402c95bf12d7e3be33a600fc80 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "wx/wxprec.h"
 
+#if wxUSE_FILEDLG
+
 #include "wx/filedlg.h"
 
 #ifndef WX_PRECOMP
@@ -74,10 +76,10 @@ static pascal void NavEventProc(
         {
             // Set default location for the modern Navigation APIs
             // Apple Technical Q&A 1151
-            FSSpec theFSSpec;
-            wxMacFilename2FSSpec(data->defaultLocation, &theFSSpec);
+            FSRef theFile;
+            wxMacPathToFSRef(data->defaultLocation, &theFile);
             AEDesc theLocation = { typeNull, NULL };
-            if (noErr == ::AECreateDesc(typeFSS, &theFSSpec, sizeof(FSSpec), &theLocation))
+            if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation))
                 ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
         }
 
@@ -275,16 +277,11 @@ pascal Boolean CrossPlatformFilterCallback(
         NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
         if ( !theInfo->isFolder )
         {
-            if (theItem->descriptorType == typeFSS)
-            {
-                FSSpec    spec;
-                memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
-                wxString file = wxMacMakeStringFromPascal( spec.name ) ;
-                display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
-            }
-            else if ( theItem->descriptorType == typeFSRef )
+            AECoerceDesc (theItem, typeFSRef, theItem); 
+            
+            FSRef fsref ;
+            if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr )
             {
-                FSRef fsref ;
                 memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ;
                 wxString file = wxMacFSRefToPath( &fsref ) ;
                 display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
@@ -333,7 +330,7 @@ int wxFileDialog::ShowModal()
         }
     }
 
-    if (HasFlag(wxFD_SAVE))
+    if (HasFdFlag(wxFD_SAVE))
     {
         myData.saveMode = true;
 
@@ -406,7 +403,7 @@ int wxFileDialog::ShowModal()
             if (err != noErr)
                 break;
 
-            if (HasFlag(wxFD_SAVE))
+            if (HasFdFlag(wxFD_SAVE))
                 thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
             else
                 thePath = wxMacFSRefToPath( &theFSRef );
@@ -433,3 +430,6 @@ int wxFileDialog::ShowModal()
 
     return (err == noErr) ? wxID_OK : wxID_CANCEL;
 }
+
+#endif // wxUSE_FILEDLG
+