X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c193821a999730fbf6a9bea83763f37daae68f1..f820e98de02ee9c5d34f28372a2324d9b2909f6c:/src/generic/dirctrlg.cpp diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 08e424f7d7..2d3ad5a929 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -47,6 +47,7 @@ #include "wx/mimetype.h" #include "wx/image.h" #include "wx/choice.h" +#include "wx/filedlg.h" // for wxFileDialogBase::ParseWildcard #if wxUSE_STATLINE #include "wx/statline.h" @@ -101,9 +102,6 @@ extern bool wxIsDriveAvailable(const wxString& dirName); #undef GetFirstChild #endif -// declared in filedlg.h, defined in fldlgcmn.cpp -extern int wxParseFileFilter(const wxString& filterStr, wxArrayString& descriptions, wxArrayString& filters); - // ---------------------------------------------------------------------------- // wxGetAvailableDrives, for WINDOWS, DOS, WXPM, MAC, UNIX (returns "/") // ---------------------------------------------------------------------------- @@ -112,7 +110,12 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI { #if defined(__WINDOWS__) || defined(__DOS__) || defined(__WXPM__) -#ifdef __WIN32__ +#ifdef __WXWINCE__ + // No logical drives; return "\" + paths.Add(wxT("\\")); + names.Add(wxT("\\")); + return 1; +#elif defined(__WIN32__) wxChar driveBuffer[256]; size_t n = (size_t) GetLogicalDriveStrings(255, driveBuffer); size_t i = 0; @@ -292,7 +295,9 @@ bool wxIsDriveAvailable(const wxString& dirName) int setdrive(int drive) { -#if defined(__GNUWIN32__) && \ +#ifdef __WXWINCE__ + return 0; +#elif defined(__GNUWIN32__) && \ (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) return _chdrive(drive); #else @@ -304,11 +309,7 @@ int setdrive(int drive) newdrive[1] = wxT(':'); newdrive[2] = wxT('\0'); #if defined(__WXMSW__) -#ifdef __WIN16__ - if (wxSetWorkingDirectory(newdrive)) -#else if (::SetCurrentDirectory(newdrive)) -#endif #else // VA doesn't know what LPSTR is and has its own set if (DosSetCurrentDir((PSZ)newdrive)) @@ -321,6 +322,9 @@ int setdrive(int drive) bool wxIsDriveAvailable(const wxString& dirName) { +#ifdef __WXWINCE__ + return FALSE; +#else #ifdef __WIN32__ UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif @@ -350,6 +354,7 @@ bool wxIsDriveAvailable(const wxString& dirName) #endif return success; +#endif } #endif // __WINDOWS__ || __WXPM__ @@ -425,6 +430,13 @@ bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrl, wxControl) +/* +TODO PROPERTIES + defaultfolder string + filter string + (long) defaultfilter) +*/ + BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) EVT_TREE_ITEM_EXPANDING (-1, wxGenericDirCtrl::OnExpandItem) EVT_TREE_ITEM_COLLAPSED (-1, wxGenericDirCtrl::OnCollapseItem) @@ -646,7 +658,7 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId) return; data->m_isExpanded = FALSE; - long cookie; + wxTreeItemIdValue cookie; /* Workaround because DeleteChildren has disapeared (why?) and * CollapseAndReset doesn't work as advertised (deletes parent too) */ child = m_treeCtrl->GetFirstChild(parentId, cookie); @@ -823,7 +835,7 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& path2.MakeLower(); #endif - long cookie; + wxTreeItemIdValue cookie; wxTreeItemId childId = m_treeCtrl->GetFirstChild(parentId, cookie); while (childId.IsOk()) { @@ -885,7 +897,7 @@ bool wxGenericDirCtrl::ExpandPath(const wxString& path) if ((GetWindowStyle() & wxDIRCTRL_SELECT_FIRST) && data->m_isDir) { // Find the first file in this directory - long cookie; + wxTreeItemIdValue cookie; wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie); bool selectedChild = FALSE; while (childId.IsOk()) @@ -1039,7 +1051,7 @@ bool wxGenericDirCtrl::ExtractWildcard(const wxString& filterStr, int n, wxStrin int wxGenericDirCtrl::ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions) { - return wxParseFileFilter(filterStr, descriptions, filters ); + return wxFileDialogBase::ParseWildcard(filterStr, descriptions, filters ); } void wxGenericDirCtrl::DoResize()