X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/144cf6da64594cfb404368c2f592de199c47add9..4b1e72e266ec6993d665c65d5f5e59e7981afc17:/src/generic/filedlgg.cpp?ds=sidebyside diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 6f301a8f23..ad1ad30a43 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -1,4 +1,4 @@ -///////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// // Name: filedlgg.cpp // Purpose: wxGenericFileDialog // Author: Robert Roebling @@ -6,7 +6,7 @@ // Created: 12/12/98 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows licence +// Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -154,17 +154,6 @@ extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, w // wxFileData //----------------------------------------------------------------------------- -wxFileData::wxFileData( const wxFileData& fileData ) -{ - m_fileName = fileData.GetFileName(); - m_filePath = fileData.GetFilePath(); - m_size = fileData.GetSize(); - m_dateTime = fileData.GetDateTime(); - m_permissions = fileData.GetPermissions(); - m_type = fileData.GetType(); - m_image = GetImageId(); -} - wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id ) { m_fileName = fileName; @@ -175,6 +164,17 @@ wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, file ReadData(); } +void wxFileData::Copy( const wxFileData& fileData ) +{ + m_fileName = fileData.GetFileName(); + m_filePath = fileData.GetFilePath(); + m_size = fileData.GetSize(); + m_dateTime = fileData.GetDateTime(); + m_permissions = fileData.GetPermissions(); + m_type = fileData.GetType(); + m_image = GetImageId(); +} + void wxFileData::ReadData() { if (IsDrive()) @@ -208,10 +208,13 @@ void wxFileData::ReadData() // try to get a better icon if (m_image == wxFileIconsTable::file) { - if (IsExe()) + if (m_fileName.Find(wxT('.'), TRUE) != wxNOT_FOUND) + { + m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.'))); + } else if (IsExe()) + { m_image = wxFileIconsTable::executable; - else if (m_fileName.Find(wxT('.'), TRUE) != wxNOT_FOUND) - m_image = wxTheFileIconsTable->GetIconID(m_fileName.AfterLast(wxT('.'))); + } } m_size = buff.st_size; @@ -358,6 +361,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl) BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl) EVT_LIST_DELETE_ITEM(-1, wxFileCtrl::OnListDeleteItem) + EVT_LIST_DELETE_ALL_ITEMS(-1, wxFileCtrl::OnListDeleteAllItems) EVT_LIST_END_LABEL_EDIT(-1, wxFileCtrl::OnListEndLabelEdit) EVT_LIST_COL_CLICK(-1, wxFileCtrl::OnListColClick) END_EVENT_TABLE() @@ -488,7 +492,6 @@ void wxFileCtrl::UpdateFiles() wxBusyCursor bcur; // this may take a while... - FreeAllItemsData(); DeleteAllItems(); wxListItem item; @@ -505,8 +508,10 @@ void wxFileCtrl::UpdateFiles() for (n=0; nRead(wxT("/wxWindows/wxFileDialog/ViewStyle"), + wxConfig::Get()->Read(wxT("/wxWidgets/wxFileDialog/ViewStyle"), &ms_lastViewStyle); - wxConfig::Get()->Read(wxT("/wxWindows/wxFileDialog/ShowHidden"), + wxConfig::Get()->Read(wxT("/wxWidgets/wxFileDialog/ShowHidden"), &ms_lastShowHidden); } @@ -958,19 +982,14 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent, // PDAs have a different screen layout mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 5 ); - wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL ); - m_choice = new wxChoice( this, ID_CHOICE ); - choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 5 ); - mainsizer->Add( choicesizer, 0, wxEXPAND ); - wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL ); m_text = new wxTextCtrl( this, ID_TEXT, m_fileName, wxDefaultPosition, wxDefaultSize, wxPROCESS_ENTER ); textsizer->Add( m_text, 1, wxCENTER | wxALL, 5 ); mainsizer->Add( textsizer, 0, wxEXPAND ); - m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") ); - m_check->SetValue( ms_lastShowHidden ); - textsizer->Add( m_check, 0, wxCENTER|wxALL, 5 ); + m_check = NULL; + m_choice = new wxChoice( this, ID_CHOICE ); + textsizer->Add( m_choice, 1, wxCENTER|wxALL, 5 ); buttonsizer = new wxBoxSizer( wxHORIZONTAL ); buttonsizer->Add( new wxButton( this, wxID_OK, _("OK") ), 0, wxCENTER | wxALL, 5 ); @@ -1018,9 +1037,9 @@ wxGenericFileDialog::~wxGenericFileDialog() { if (wxConfig::Get(FALSE)) { - wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ViewStyle"), + wxConfig::Get()->Write(wxT("/wxWidgets/wxFileDialog/ViewStyle"), ms_lastViewStyle); - wxConfig::Get()->Write(wxT("/wxWindows/wxFileDialog/ShowHidden"), + wxConfig::Get()->Write(wxT("/wxWidgets/wxFileDialog/ShowHidden"), ms_lastShowHidden); } @@ -1040,6 +1059,18 @@ int wxGenericFileDialog::ShowModal() return wxDialog::ShowModal(); } +bool wxGenericFileDialog::Show( bool show ) +{ + if (show) + { + m_list->GoToDir(m_dir); + UpdateControls(); + m_text->SetValue(m_fileName); + } + + return wxDialog::Show( show ); +} + void wxGenericFileDialog::DoSetFilterIndex(int filterindex) { wxString *str = (wxString*) m_choice->GetClientData( filterindex );