filedata implementation streamlined

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2006-03-23 18:18:20 +00:00
parent d7b284e5c6
commit 55f5548f78

View File

@ -190,6 +190,8 @@ bool wxDropTarget::GetData()
UInt16 flavors;
bool firstFileAdded = false;
wxString filenamesPassed ;
CountDragItems( (DragReference)m_currentDrag, &items );
for (UInt16 index = 1; index <= items; ++index)
{
@ -261,23 +263,13 @@ bool wxDropTarget::GetData()
case kDragFlavorTypeHFS:
{
wxFileDataObject *fdo = dynamic_cast<wxFileDataObject*>(m_dataObject);
wxASSERT( fdo != NULL );
if ((theData != NULL) && (fdo != NULL))
if (theData != NULL)
{
HFSFlavor* theFile = (HFSFlavor*) theData;
wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec );
if ( !firstFileAdded )
{
// reset file list
fdo->SetData( 0, "" );
firstFileAdded = true;
}
if (!name.IsEmpty())
fdo->AddFile( name );
filenamesPassed += name + wxT("\n");
}
}
break;
@ -293,6 +285,11 @@ bool wxDropTarget::GetData()
}
}
}
if ( filenamesPassed.Len() > 0 )
{
wxCharBuffer buf = filenamesPassed.fn_str();
m_dataObject->SetData( wxDataFormat( wxDF_FILENAME ) , strlen( buf ) , (const char*) buf );
}
}
return true;