+void wxFileDataObject::AddFile(const wxString& file)
+{
+ // just add file to filenames array
+ // all useful data (such as DROPFILES struct) will be
+ // created later as necessary
+ m_filenames.Add(file);
+}
+
+size_t wxFileDataObject::GetDataSize() const
+{
+#ifndef __WXWINCE__
+ // size returned will be the size of the DROPFILES structure, plus the list
+ // of filesnames (null byte separated), plus a double null at the end
+
+ // if no filenames in list, size is 0
+ if ( m_filenames.empty() )
+ return 0;
+
+#if wxUSE_UNICODE_MSLU
+ size_t sizeOfChar;
+ if ( wxGetOsVersion() == wxOS_WINDOWS_9X )
+ {
+ // Win9x always uses ANSI file names and MSLU doesn't help with this
+ sizeOfChar = sizeof(char);
+ }
+ else
+ {
+ sizeOfChar = sizeof(wxChar);
+ }
+#else // !wxUSE_UNICODE_MSLU
+ static const size_t sizeOfChar = sizeof(wxChar);
+#endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU
+
+ // inital size of DROPFILES struct + null byte
+ size_t sz = sizeof(DROPFILES) + sizeOfChar;
+
+ const size_t count = m_filenames.size();
+ for ( size_t i = 0; i < count; i++ )
+ {
+ // add filename length plus null byte
+ size_t len;
+#if wxUSE_UNICODE_MSLU
+ if ( sizeOfChar == sizeof(char) )
+ len = strlen(m_filenames[i].mb_str(*wxConvFileName));
+ else
+#endif // wxUSE_UNICODE_MSLU
+ len = m_filenames[i].length();
+
+ sz += (len + 1) * sizeOfChar;
+ }