From ca9fb418d278d68df3529b04aea268600fb0080a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Feb 2005 15:54:25 +0000 Subject: [PATCH] added default ctor and fixed copying of wxFileData (patch 1149384) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32421 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/filedlgg.h | 8 ++++++-- src/generic/filedlgg.cpp | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/wx/generic/filedlgg.h b/include/wx/generic/filedlgg.h index 489beb5d1b..a8f5ac7c61 100644 --- a/include/wx/generic/filedlgg.h +++ b/include/wx/generic/filedlgg.h @@ -162,6 +162,7 @@ public: is_drive = 0x0008 }; + wxFileData() { Init(); } // Full copy constructor wxFileData( const wxFileData& fileData ) { Copy(fileData); } // Create a filedata from this information @@ -224,10 +225,10 @@ public: // initialize a wxListItem attributes void MakeItem( wxListItem &item ); - + // operators wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; } -private: +protected: wxString m_fileName; wxString m_filePath; long m_size; @@ -235,6 +236,9 @@ private: wxString m_permissions; int m_type; int m_image; + +private: + void Init(); }; //----------------------------------------------------------------------------- diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 6eeb171d42..334e2370df 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -157,6 +157,7 @@ extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, w wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id ) { + Init(); m_fileName = fileName; m_filePath = filePath; m_type = type; @@ -165,6 +166,13 @@ wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, file ReadData(); } +void wxFileData::Init() +{ + m_size = 0; + m_type = wxFileData::is_file; + m_image = wxFileIconsTable::file; +} + void wxFileData::Copy( const wxFileData& fileData ) { m_fileName = fileData.GetFileName(); @@ -173,7 +181,7 @@ void wxFileData::Copy( const wxFileData& fileData ) m_dateTime = fileData.GetDateTime(); m_permissions = fileData.GetPermissions(); m_type = fileData.GetType(); - m_image = GetImageId(); + m_image = fileData.GetImageId(); } void wxFileData::ReadData() -- 2.45.2