]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/filedlg.cpp
1. registry files corresponding to the recent registry.h changes
[wxWidgets.git] / src / msw / filedlg.cpp
index f5cc104122b75b58ebc8c4f59f9309cd746572bd..30d397bf4fc07320ceef4999236879c9eddc3732 100644 (file)
 #include <stdio.h>
 #include "wx/defs.h"
 #include "wx/utils.h"
+#include "wx/msgdlg.h"
 #include "wx/dialog.h"
 #include "wx/filedlg.h"
+#include "wx/intl.h"
 #endif
 
 #include <windows.h>
 
-#ifndef __WIN32__
+#if !defined(__WIN32__) || defined(__SALFORDC__)
 #include <commdlg.h>
 #endif
 
@@ -82,12 +84,36 @@ char *wxFileSelector(const char *title,
         defaultFilenameString = "";
 
     wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
-
+    if(defaultExtension)
+      {
+       unsigned int ii;
+       int filterFind,filterIndex=0;
+       filterFind=1;
+       for(ii=0;ii<filter2.Length();ii++)
+         {
+           if(filter2[ii] == '|')
+             {
+               unsigned int is=ii++;
+               filterIndex++;
+               for(;ii<filter2.Length();ii++)
+                 if(filter2[ii] == '|')
+                   break;
+               if(ii-is-1 > 0 && is+1 < filter2.Length())
+                 if(filter2.Mid(is+1,ii-is-1) == defaultExtension)
+                   {
+                     filterFind=filterIndex;
+                     break;
+                   }
+             }
+         }
+       fileDialog.SetFilterIndex(filterFind);
+      }                 
+    
     if ( fileDialog.ShowModal() == wxID_OK )
-    {
+      {
         strcpy(wxBuffer, (const char *)fileDialog.GetPath());
         return wxBuffer;
-    }
+      }
     else
         return NULL;
 }