Now sorts the files case-insensitively
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -360,6 +360,16 @@ static bool wxIsDriveAvailable(const wxString dirName)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
// wxDirItemDataEx
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -743,7 +753,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
|||||||
while (d.GetNext(& eachFilename)) ;
|
while (d.GetNext(& eachFilename)) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dirs.Sort();
|
dirs.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
|
||||||
|
|
||||||
// Now do the filenames -- but only if we're allowed to
|
// Now do the filenames -- but only if we're allowed to
|
||||||
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
|
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
|
||||||
@@ -766,7 +776,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
|||||||
while (d.GetNext(& eachFilename)) ;
|
while (d.GetNext(& eachFilename)) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filenames.Sort();
|
filenames.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the sorted dirs
|
// Add the sorted dirs
|
||||||
|
Reference in New Issue
Block a user