correcting DropData behaviour so that preferred format is handled correctly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2005-08-22 09:52:04 +00:00
parent 6ac23e25b8
commit 6db6bfd1ce

View File

@@ -186,11 +186,25 @@ bool wxDropTarget::GetData()
UInt16 flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
bool hasPreferredFormat = false ;
wxDataFormat preferredFormat = m_dataObject->GetPreferredFormat( wxDataObject::Set ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ;
if ( m_dataObject->IsSupportedFormat( format ) )
if ( preferredFormat == format )
{
hasPreferredFormat = true ;
break ;
}
}
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ;
if ( (hasPreferredFormat && format==preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
{
FlavorFlags theFlags;
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);