]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/filedlgg.cpp
Demo tweaks
[wxWidgets.git] / src / generic / filedlgg.cpp
index 3e526cd611d42da36ddd04db0f3667ae4d7048de..2c0933436d3a184baaa87f07b8a9dc71a66a4d3e 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "filedlgg.h"
 #endif
 
     #endif
 #endif
 
+#ifdef __WINDOWS__
+    #include "wx/msw/wrapwin.h"
+    #include "wx/msw/mslu.h"
+#endif
+
 #ifdef __WATCOMC__
     #include <direct.h>
 #endif
@@ -77,7 +82,7 @@
 // ----------------------------------------------------------------------------
 
 static
-int wxFileDataNameCompare( long data1, long data2, long data)
+int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long data)
 {
      wxFileData *fd1 = (wxFileData*)data1;
      wxFileData *fd2 = (wxFileData*)data2;
@@ -89,7 +94,7 @@ int wxFileDataNameCompare( long data1, long data2, long data)
 }
 
 static
-int wxFileDataSizeCompare( long data1, long data2, long data)
+int wxCALLBACK wxFileDataSizeCompare( long data1, long data2, long data)
 {
      wxFileData *fd1 = (wxFileData*)data1;
      wxFileData *fd2 = (wxFileData*)data2;
@@ -103,7 +108,7 @@ int wxFileDataSizeCompare( long data1, long data2, long data)
 }
 
 static
-int wxFileDataTypeCompare( long data1, long data2, long data)
+int wxCALLBACK wxFileDataTypeCompare( long data1, long data2, long data)
 {
      wxFileData *fd1 = (wxFileData*)data1;
      wxFileData *fd2 = (wxFileData*)data2;
@@ -117,7 +122,7 @@ int wxFileDataTypeCompare( long data1, long data2, long data)
 }
 
 static
-int wxFileDataTimeCompare( long data1, long data2, long data)
+int wxCALLBACK wxFileDataTimeCompare( long data1, long data2, long data)
 {
      wxFileData *fd1 = (wxFileData*)data1;
      wxFileData *fd2 = (wxFileData*)data2;
@@ -180,7 +185,7 @@ void wxFileData::ReadData()
 
 #if defined(__DOS__) || defined(__WINDOWS__)
     // c:\.. is a drive don't stat it
-    if ((fileName == wxT("..")) && (filePath.length() <= 5))
+    if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5))
     {
         m_type = is_drive;
         m_size = 0;
@@ -225,7 +230,7 @@ void wxFileData::ReadData()
                          buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'),
                          buff.st_mode & wxS_IXOTH ? _T('x') : _T('-'));
 #elif defined(__WIN32__)
-    DWORD attribs = GetFileAttributes(filePath);
+    DWORD attribs = GetFileAttributes(m_filePath);
     if (attribs != (DWORD)-1)
     {
         m_permissions.Printf(_T("%c%c%c%c"),
@@ -485,7 +490,6 @@ void wxFileCtrl::UpdateFiles()
     FreeAllItemsData();
     DeleteAllItems();
 
-    wxFileData *fd = (wxFileData *) NULL;
     wxListItem item;
     item.m_itemId = 0;
     item.m_col = 0;
@@ -499,7 +503,7 @@ void wxFileCtrl::UpdateFiles()
 
         for (n=0; n<count; n++)
             {
-            fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
+            wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
                 Add(fd, item);
                 item.m_itemId++;
             }
@@ -514,7 +518,7 @@ void wxFileCtrl::UpdateFiles()
 #ifdef __UNIX__
             if (p.IsEmpty()) p = wxT("/");
 #endif // __UNIX__
-            fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
+            wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
             Add(fd, item);
             item.m_itemId++;
         }
@@ -541,7 +545,7 @@ void wxFileCtrl::UpdateFiles()
             cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag);
             while (cont)
             {
-                fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
+                wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
                 Add(fd, item);
                 item.m_itemId++;
                 cont = dir.GetNext(&f);
@@ -556,7 +560,7 @@ void wxFileCtrl::UpdateFiles()
                                         wxDIR_FILES | hiddenFlag);
                 while (cont)
                 {
-                    fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
+                    wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
                     Add(fd, item);
                     item.m_itemId++;
                     cont = dir.GetNext(&f);
@@ -871,8 +875,10 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
 
     // interpret wildcards
     wxArrayString wildDescriptions, wildFilters;
-    int wild_count = ParseWildcard(m_wildCard, wildDescriptions, wildFilters);
-    wxASSERT_MSG(wild_count > 0, wxT("Wrong file type descripition") );
+    if ( !ParseWildcard(m_wildCard, wildDescriptions, wildFilters) )
+    {
+        wxFAIL_MSG( wxT("Wrong file type description") );
+    }
 
     // layout
 
@@ -1202,8 +1208,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
                 wxFileExists( filename ) )
     {
         wxString msg;
-        msg.Printf( _("File '%s' already exists, do you really want to "
-                     "overwrite it?"), filename.c_str() );
+        msg.Printf( _("File '%s' already exists, do you really want to overwrite it?"), filename.c_str() );
 
         if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
             return;
@@ -1224,7 +1229,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
         wxString cwd;
         wxSplitPath(filename, &cwd, NULL, NULL);
 
-        if ( cwd != wxGetWorkingDirectory() )
+        if ( cwd != wxGetCwd() )
         {
             wxSetWorkingDirectory(cwd);
         }