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:
@@ -186,11 +186,25 @@ bool wxDropTarget::GetData()
|
|||||||
UInt16 flavors = 0 ;
|
UInt16 flavors = 0 ;
|
||||||
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
||||||
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
||||||
|
bool hasPreferredFormat = false ;
|
||||||
|
wxDataFormat preferredFormat = m_dataObject->GetPreferredFormat( wxDataObject::Set ) ;
|
||||||
|
|
||||||
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
||||||
{
|
{
|
||||||
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
||||||
wxDataFormat format(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;
|
FlavorFlags theFlags;
|
||||||
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
||||||
|
Reference in New Issue
Block a user