X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/222ed1d678dff2f5c3c4164321dd05e8f47de487..f3291a824a192f7d672ff9e52aef5987b8795a34:/src/generic/dirctrlg.cpp diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 045fa1b2b9..c017d9f6d7 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "dirctrlg.h" #endif @@ -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" @@ -63,7 +64,9 @@ // older releases don't, but it should be verified and the checks modified // accordingly. #if !defined(__GNUWIN32__) || (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) +#if !defined(__WXWINCE__) #include +#endif #include #include #endif @@ -99,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 "/") // ---------------------------------------------------------------------------- @@ -110,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; @@ -185,7 +190,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI continue; } // add path separator at end if necessary - wxString path( thePath ) ; + wxString path( thePath , wxConvLocal) ; if (path.Last() != wxFILE_SEP_PATH) { path += wxFILE_SEP_PATH; } @@ -213,7 +218,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI CFRelease( cstr ); continue; } - wxString name( cstr ); + wxString name( cstr , wxConvLocal ); DisposePtr( cstr ); CFRelease( cfstr ); @@ -290,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 @@ -302,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)) @@ -319,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 @@ -348,6 +354,7 @@ bool wxIsDriveAvailable(const wxString& dirName) #endif return success; +#endif } #endif // __WINDOWS__ || __WXPM__ @@ -421,7 +428,24 @@ bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const // wxGenericDirCtrl //----------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +IMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl,"wx/dirctrl.h") + +WX_BEGIN_PROPERTIES_TABLE(wxGenericDirCtrl) + WX_PROPERTY( DefaultPath , wxString , SetDefaultPath , GetDefaultPath , ) + WX_PROPERTY( Filter , wxString , SetFilter , GetFilter , ) + WX_PROPERTY( DefaultFilter , int , SetFilterIndex, GetFilterIndex, ) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxGenericDirCtrl) +WX_END_HANDLERS_TABLE() + +WX_CONSTRUCTOR_8( wxGenericDirCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , DefaultPath , + wxPoint , Position , wxSize , Size , long , WindowStyle , wxString , Filter , int , DefaultFilter ) +#else IMPLEMENT_DYNAMIC_CLASS(wxGenericDirCtrl, wxControl) +#endif BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) EVT_TREE_ITEM_EXPANDING (-1, wxGenericDirCtrl::OnExpandItem) @@ -644,7 +668,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); @@ -821,7 +845,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()) { @@ -883,7 +907,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()) @@ -1037,7 +1061,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()