]> git.saurik.com Git - wxWidgets.git/commitdiff
correcting DropData behaviour so that preferred format is handled correctly
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 22 Aug 2005 09:52:04 +0000 (09:52 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 22 Aug 2005 09:52:04 +0000 (09:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/dnd.cpp

index 52b0cbbf9043e0df8d651a045a48260e08f66c83..eac973dd14d3380002510e64e4103b7aa46259a0 100644 (file)
@@ -186,11 +186,25 @@ bool wxDropTarget::GetData()
             UInt16 flavors = 0 ;
             GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
             CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
             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) ;
             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);
                 {
                     FlavorFlags theFlags;
                     result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);