]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirctrlg.cpp
moving all dataview files to advanced
[wxWidgets.git] / src / generic / dirctrlg.cpp
index 057d074c04622848d46c732ff5098b1e652b2e6a..b50262b473d8f29d4e1f28196333aa3948753d3c 100644 (file)
@@ -40,6 +40,7 @@
     #include "wx/module.h"
 #endif
 
+#include "wx/filename.h"
 #include "wx/filefn.h"
 #include "wx/imaglist.h"
 #include "wx/tokenzr.h"
@@ -52,7 +53,7 @@
 #endif
 
 #if defined(__WXMAC__)
-    #include  "wx/mac/private.h"  // includes mac headers
+    #include  "wx/osx/private.h"  // includes mac headers
 #endif
 
 #ifdef __WXMSW__
@@ -86,7 +87,7 @@
 #endif // __OS2__
 
 #if defined(__WXMAC__)
-    #include "MoreFilesX.h"
+//    #include "MoreFilesX.h"
 #endif
 
 #ifdef __BORLANDC__
@@ -108,7 +109,7 @@ bool wxIsDriveAvailable(const wxString& dirName);
 
 size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids)
 {
-#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)
+#ifdef wxHAS_FILESYSTEM_VOLUMES
 
 #ifdef __WXWINCE__
     // No logical drives; return "\"
@@ -164,9 +165,10 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
         {
             if (ulDriveMap & ( 1 << i ))
             {
-                wxString path, name;
-                path.Printf(wxT("%c:\\"), 'A' + i);
-                name.Printf(wxT("%c:"), 'A' + i);
+                const wxString path = wxFileName::GetVolumeString(
+                                        'A' + i, wxPATH_GET_SEPARATOR);
+                const wxString name = wxFileName::GetVolumeString(
+                                        'A' + i, wxPATH_NO_SEPARATOR);
 
                 // Note: If _filesys is unsupported by some compilers,
                 //       we can always replace it by DosQueryFSAttach
@@ -201,25 +203,23 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
         }
     }
 #else // !__WIN32__, !__OS2__
-    int drive;
-
     /* If we can switch to the drive, it exists. */
-    for( drive = 1; drive <= 26; drive++ )
+    for ( char drive = 'A'; drive <= 'Z'; drive++ )
     {
-        wxString path, name;
-        path.Printf(wxT("%c:\\"), (char) (drive + 'a' - 1));
-        name.Printf(wxT("%c:"), (char) (drive + 'A' - 1));
+        const wxString
+            path = wxFileName::GetVolumeString(drive, wxPATH_GET_SEPARATOR);
 
         if (wxIsDriveAvailable(path))
         {
             paths.Add(path);
-            names.Add(name);
-            icon_ids.Add((drive <= 2) ? wxFileIconsTable::floppy : wxFileIconsTable::drive);
+            names.Add(wxFileName::GetVolumeString(drive, wxPATH_NO_SEPARATOR));
+            icon_ids.Add(drive <= 2 ? wxFileIconsTable::floppy
+                                    : wxFileIconsTable::drive);
         }
     }
 #endif // __WIN32__/!__WIN32__
 
-#elif defined(__WXMAC__)
+#elif defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON
 
     ItemCount volumeIndex = 1;
     OSErr err = noErr ;
@@ -251,7 +251,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
         }
     }
 
-#elif defined(__UNIX__)
+#elif defined(__UNIX__) || defined(__WXPALMOS__)
     paths.Add(wxT("/"));
     names.Add(wxT("/"));
     icon_ids.Add(wxFileIconsTable::computer);
@@ -668,7 +668,8 @@ void wxGenericDirCtrl::SetFocus()
 {
     // we don't need focus ourselves, give it to the tree so that the user
     // could navigate it
-    m_treeCtrl->SetFocus();
+    if (m_treeCtrl)
+        m_treeCtrl->SetFocus();
 }
 
 void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event)
@@ -1407,7 +1408,7 @@ static const char * file_icons_tbl_computer_xpm[] = {
 // ----------------------------------------------------------------------------
 
 // global instance of a wxFileIconsTable
-wxFileIconsTable* wxTheFileIconsTable = (wxFileIconsTable *)NULL;
+wxFileIconsTable* wxTheFileIconsTable = NULL;
 
 // A module to allow icons table cleanup