X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b18e2046af6c8eaf6e867ba18dd9410dbd7dfcf7..8a31648287be0ef976f133de2786b137f1e98340:/src/generic/filectrlg.cpp diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp index 4e3730f466..0a697894dc 100644 --- a/src/generic/filectrlg.cpp +++ b/src/generic/filectrlg.cpp @@ -33,6 +33,7 @@ #include "wx/generic/dirctrlg.h" // for wxFileIconsTable #include "wx/dir.h" #include "wx/tokenzr.h" +#include "wx/imaglist.h" #ifdef __WXMSW__ #include "wx/msw/wrapwin.h" @@ -52,7 +53,7 @@ // ---------------------------------------------------------------------------- static -int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataNameCompare( wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -70,7 +71,7 @@ int wxCALLBACK wxFileDataNameCompare( long data1, long data2, wxIntPtr sortOrder } static -int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataSizeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -92,7 +93,7 @@ int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, wxIntPtr sortOrder) } static -int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataTypeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -114,7 +115,7 @@ int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, wxIntPtr sortOrder) } static -int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, wxIntPtr sortOrder) +int wxCALLBACK wxFileDataTimeCompare(wxIntPtr data1, wxIntPtr data2, wxIntPtr sortOrder) { wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1); wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2); @@ -225,13 +226,7 @@ void wxFileData::ReadData() lstat( m_filePath.fn_str(), &buff ); m_type |= S_ISLNK(buff.st_mode) ? is_link : 0; #else // no lstat() - // only translate to file charset if we don't go by our - // wxStat implementation -#ifndef wxNEED_WX_UNISTD_H - wxStat( m_filePath.fn_str() , &buff ); -#else wxStat( m_filePath, &buff ); -#endif #endif m_type |= (buff.st_mode & S_IFDIR) != 0 ? is_dir : 0; @@ -244,25 +239,25 @@ void wxFileData::ReadData() // __WXWINCE__ #if defined(__UNIX__) - m_permissions.Printf(_T("%c%c%c%c%c%c%c%c%c"), - buff.st_mode & wxS_IRUSR ? _T('r') : _T('-'), - buff.st_mode & wxS_IWUSR ? _T('w') : _T('-'), - buff.st_mode & wxS_IXUSR ? _T('x') : _T('-'), - buff.st_mode & wxS_IRGRP ? _T('r') : _T('-'), - buff.st_mode & wxS_IWGRP ? _T('w') : _T('-'), - buff.st_mode & wxS_IXGRP ? _T('x') : _T('-'), - buff.st_mode & wxS_IROTH ? _T('r') : _T('-'), - buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'), - buff.st_mode & wxS_IXOTH ? _T('x') : _T('-')); + m_permissions.Printf(wxT("%c%c%c%c%c%c%c%c%c"), + buff.st_mode & wxS_IRUSR ? wxT('r') : wxT('-'), + buff.st_mode & wxS_IWUSR ? wxT('w') : wxT('-'), + buff.st_mode & wxS_IXUSR ? wxT('x') : wxT('-'), + buff.st_mode & wxS_IRGRP ? wxT('r') : wxT('-'), + buff.st_mode & wxS_IWGRP ? wxT('w') : wxT('-'), + buff.st_mode & wxS_IXGRP ? wxT('x') : wxT('-'), + buff.st_mode & wxS_IROTH ? wxT('r') : wxT('-'), + buff.st_mode & wxS_IWOTH ? wxT('w') : wxT('-'), + buff.st_mode & wxS_IXOTH ? wxT('x') : wxT('-')); #elif defined(__WIN32__) DWORD attribs = ::GetFileAttributes(m_filePath.c_str()); if (attribs != (DWORD)-1) { - m_permissions.Printf(_T("%c%c%c%c"), - attribs & FILE_ATTRIBUTE_ARCHIVE ? _T('A') : _T(' '), - attribs & FILE_ATTRIBUTE_READONLY ? _T('R') : _T(' '), - attribs & FILE_ATTRIBUTE_HIDDEN ? _T('H') : _T(' '), - attribs & FILE_ATTRIBUTE_SYSTEM ? _T('S') : _T(' ')); + m_permissions.Printf(wxT("%c%c%c%c"), + attribs & FILE_ATTRIBUTE_ARCHIVE ? wxT('A') : wxT(' '), + attribs & FILE_ATTRIBUTE_READONLY ? wxT('R') : wxT(' '), + attribs & FILE_ATTRIBUTE_HIDDEN ? wxT('H') : wxT(' '), + attribs & FILE_ATTRIBUTE_SYSTEM ? wxT('S') : wxT(' ')); } #endif @@ -356,7 +351,7 @@ wxString wxFileData::GetEntry( fileListFieldType num ) const #endif // defined(__UNIX__) || defined(__WIN32__) default: - wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") ); + wxFAIL_MSG( wxT("unexpected field in wxFileData::GetEntry()") ); } return s; @@ -381,8 +376,8 @@ void wxFileData::MakeItem( wxListItem &item ) if (IsLink()) { - wxColour dg = wxTheColourDatabase->Find( _T("MEDIUM GREY") ); - if ( dg.Ok() ) + wxColour dg = wxTheColourDatabase->Find( wxT("MEDIUM GREY") ); + if ( dg.IsOk() ) item.SetTextColour(dg); } item.m_data = wxPtrToUInt(this); @@ -682,14 +677,14 @@ void wxFileListCtrl::MakeDir() wxListItem item; item.m_itemId = 0; item.m_col = 0; - long id = Add( fd, item ); + long itemid = Add( fd, item ); - if (id != -1) + if (itemid != -1) { SortItems(m_sort_field, m_sort_forward); - id = FindItem( 0, wxPtrToUInt(fd) ); - EnsureVisible( id ); - EditLabel( id ); + itemid = FindItem( 0, wxPtrToUInt(fd) ); + EnsureVisible( itemid ); + EditLabel( itemid ); } else delete fd; @@ -1182,13 +1177,15 @@ void wxGenericFileCtrl::DoSetFilterIndex( int filterindex ) if ( str.Left( 2 ) == wxT( "*." ) ) { m_filterExtension = str.Mid( 1 ); - if ( m_filterExtension == _T( ".*" ) ) + if ( m_filterExtension == wxT( ".*" ) ) m_filterExtension.clear(); } else { m_filterExtension.clear(); } + + GenerateFilterChangedEvent( this, this ); } void wxGenericFileCtrl::SetWildcard( const wxString& wildCard )