bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{
- if (!m_dataObject)
+ if (m_dataObject == NULL)
return false;
return CurrentDragHasSupportedFormat() ;
wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult def )
{
- if (!m_dataObject)
+ if (m_dataObject == NULL)
return wxDragNone;
if (!CurrentDragHasSupportedFormat())
bool wxDropTarget::CurrentDragHasSupportedFormat()
{
bool supported = false ;
+
if ( gTrackingGlobals.m_currentSource != NULL )
{
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
if ( data )
{
size_t formatcount = data->GetFormatCount() ;
- wxDataFormat *array = new wxDataFormat[ formatcount ];
+ wxDataFormat *array = new wxDataFormat[formatcount];
data->GetAllFormats( array );
for (size_t i = 0; !supported && i < formatcount ; i++)
{
UInt16 flavors = 0 ;
CountDragItems((DragReference)m_currentDrag, &items);
- for (UInt16 index = 1; index <= items && !supported ; ++index)
+ for (UInt16 index = 1; index <= items && !supported; ++index)
{
flavors = 0 ;
- GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
- CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+ GetDragItemReferenceNumber( (DragReference)m_currentDrag, index, &theItem );
+ CountDragItemFlavors( (DragReference)m_currentDrag, theItem, &flavors );
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
- result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
+ result = GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType );
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
{
supported = true ;
if (size == 0)
{
- m_dataObject->SetData(format , 0 , 0 ) ;
+ m_dataObject->SetData( format , 0 , 0 );
}
else
{
UInt16 flavors ;
bool firstFileAdded = false ;
- CountDragItems((DragReference)m_currentDrag, &items);
+ CountDragItems( (DragReference)m_currentDrag, &items );
for (UInt16 index = 1; index <= items; ++index)
{
flavors = 0 ;
- GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
- CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+ 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) ;
+ result = GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType );
+ wxDataFormat format( theType );
if ( preferredFormat == format )
{
hasPreferredFormat = true ;
{
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ;
- if ( (hasPreferredFormat && format == preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
+ if ( (hasPreferredFormat && format == preferredFormat)
+ || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
{
- result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
+ result = GetFlavorFlags( (DragReference)m_currentDrag, theItem, theType, &theFlags );
if (result == noErr)
{
Size dataSize ;
Ptr theData ;
- GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
+ GetFlavorDataSize( (DragReference)m_currentDrag, theItem, theType, &dataSize );
if ( theType == kScrapFlavorTypeText )
{
// this increment is only valid for allocating, on the next GetFlavorData
}
theData = new char[dataSize];
- GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
+
+ GetFlavorData( (DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L );
if ( theType == kScrapFlavorTypeText )
{
theData[dataSize] = 0 ;
#if wxUSE_UNICODE
else if ( theType == kScrapFlavorTypeUnicode )
{
- theData[dataSize] = 0 ;
+ theData[dataSize + 0] =
theData[dataSize + 1] = 0 ;
m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData );
}
if ( trackingGlobals->m_currentTarget )
{
HideDragHilite( theDrag );
- trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
- trackingGlobals->m_currentTarget->OnLeave() ;
+ trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
+ trackingGlobals->m_currentTarget->OnLeave();
trackingGlobals->m_currentTarget = NULL;
- trackingGlobals->m_currentTargetWindow = NULL ;
+ trackingGlobals->m_currentTargetWindow = NULL;
}
}
RgnHandle hiliteRgn = NewRgn() ;
Rect r = { y , x , y + win->GetSize().y , x + win->GetSize().x } ;
RectRgn( hiliteRgn , &r ) ;
- ShowDragHilite(theDrag, hiliteRgn, true);
+ ShowDragHilite( theDrag, hiliteRgn, true );
DisposeRgn( hiliteRgn ) ;
}
}
case kDragTrackingLeaveWindow:
if (trackingGlobals->m_currentTarget)
{
- trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
- trackingGlobals->m_currentTarget->OnLeave() ;
- HideDragHilite(theDrag);
- trackingGlobals->m_currentTarget = NULL ;
+ trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
+ trackingGlobals->m_currentTarget->OnLeave();
+ HideDragHilite( theDrag );
+ trackingGlobals->m_currentTarget = NULL;
}
- trackingGlobals->m_currentTargetWindow = NULL ;
+ trackingGlobals->m_currentTargetWindow = NULL;
break;
default: