From: Stefan Csomor Date: Mon, 22 Aug 2005 09:52:04 +0000 (+0000) Subject: correcting DropData behaviour so that preferred format is handled correctly X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6db6bfd1ce8c6c4b06a74e04fad3470ac792a770 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 --- diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index 52b0cbbf90..eac973dd14 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -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 ( preferredFormat == format ) + { + hasPreferredFormat = true ; + break ; + } + } + for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor ) { result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType); wxDataFormat format(theType) ; - if ( m_dataObject->IsSupportedFormat( format ) ) + if ( (hasPreferredFormat && format==preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format ))) { FlavorFlags theFlags; result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);