From 6db6bfd1ce8c6c4b06a74e04fad3470ac792a770 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 22 Aug 2005 09:52:04 +0000 Subject: [PATCH] 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 --- src/mac/carbon/dnd.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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); -- 2.47.2