]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirctrlg.cpp
corrected loop for calculating the proper updatergn taking into account only real...
[wxWidgets.git] / src / generic / dirctrlg.cpp
index a37f39da70de8d2538bb042d24c2a65fba5edef9..6f27f881aab8402a9d2392ae5758a632de3c96d8 100644 (file)
@@ -316,7 +316,11 @@ int setdrive(int drive)
        newdrive[1] = ':';
        newdrive[2] = '\0';
 #if defined(__WXMSW__)
+#ifdef __WIN16__
+    if (wxSetWorkingDirectory(newdrive))
+#else
        if (SetCurrentDirectory((LPSTR)newdrive))
+#endif
 #else
     // VA doesn't know what LPSTR is and has its own set
        if (DosSetCurrentDir((PSZ)newdrive))
@@ -360,6 +364,16 @@ static bool wxIsDriveAvailable(const wxString dirName)
 }
 #endif
 
+// Function which is called by quick sort. We want to override the default wxArrayString behaviour,
+// and sort regardless of case.
+static int LINKAGEMODE wxDirCtrlStringCompareFunction(const void *first, const void *second)
+{
+    wxString *strFirst = (wxString *)first;
+    wxString *strSecond = (wxString *)second;
+    
+    return strFirst->CmpNoCase(*strSecond);
+}
+
 //-----------------------------------------------------------------------------
 // wxDirItemDataEx
 //-----------------------------------------------------------------------------
@@ -743,7 +757,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
             while (d.GetNext(& eachFilename)) ;
         }
     }
-    dirs.Sort();
+    dirs.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
 
     // Now do the filenames -- but only if we're allowed to
     if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
@@ -766,7 +780,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
                 while (d.GetNext(& eachFilename)) ;
             }
         }
-        filenames.Sort();
+        filenames.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
     }
 
     // Add the sorted dirs