cleanup - reformat ()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-14 08:25:42 +00:00
parent 876b960ac2
commit e22ab33a47

View File

@@ -24,6 +24,7 @@
#include <Scrap.h>
#endif
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
@@ -136,7 +137,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
bool wxDropTarget::GetData()
{
if (!m_dataObject)
if (m_dataObject == NULL)
return false;
if ( !CurrentDragHasSupportedFormat() )
@@ -194,8 +195,8 @@ bool wxDropTarget::GetData()
flavors = 0 ;
GetDragItemReferenceNumber( (DragReference)m_currentDrag, index, &theItem );
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors );
bool hasPreferredFormat = false ;
wxDataFormat preferredFormat = m_dataObject->GetPreferredFormat( wxDataObject::Set );
bool hasPreferredFormat = false ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{
@@ -224,14 +225,14 @@ bool wxDropTarget::GetData()
GetFlavorDataSize( (DragReference)m_currentDrag, theItem, theType, &dataSize );
if ( theType == kScrapFlavorTypeText )
{
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
// this increment is only valid for allocating:
// on the next GetFlavorData call it is reset again to the original value
dataSize++ ;
}
else if ( theType == kScrapFlavorTypeUnicode )
{
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
// this increment is only valid for allocating:
// on the next GetFlavorData call it is reset again to the original value
dataSize++ ;
dataSize++ ;
}
@@ -295,6 +296,7 @@ wxDropSource::wxDropSource(wxWindow *win,
: wxDropSourceBase(cursorCopy, cursorMove, cursorStop)
{
wxMacEnsureTrackingHandlersInstalled() ;
m_window = win;
}
@@ -306,6 +308,7 @@ wxDropSource::wxDropSource(wxDataObject& data,
: wxDropSourceBase(cursorCopy, cursorMove, cursorStop)
{
wxMacEnsureTrackingHandlersInstalled() ;
SetData( data );
m_window = win;
}
@@ -434,8 +437,8 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
DisposeRgn( tempRgn ) ;
// TODO:work with promises in order to return data only when drag
// was successfully completed
// TODO: work with promises in order to return data
// only when drag was successfully completed
gTrackingGlobals.m_currentSource = this;
result = TrackDrag( theDrag, ev, dragRegion );
@@ -496,9 +499,12 @@ pascal OSErr wxMacWindowDragTrackingHandler(
void *handlerRefCon, DragReference theDrag )
{
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
Point mouse, localMouse;
DragAttributes attributes;
GetDragAttributes( theDrag, &attributes );
wxTopLevelWindowMac* toplevel = wxFindWinFromMacWindow( theWindow ) ;
bool optionDown = GetCurrentKeyModifiers() & optionKey ;
@@ -511,11 +517,16 @@ pascal OSErr wxMacWindowDragTrackingHandler(
break;
case kDragTrackingEnterWindow:
if (trackingGlobals != NULL)
{
trackingGlobals->m_currentTargetWindow = NULL ;
trackingGlobals->m_currentTarget = NULL ;
}
break;
case kDragTrackingInWindow:
if (trackingGlobals == NULL)
break;
if (toplevel == NULL)
break;
@@ -527,8 +538,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
wxWindow *win = NULL ;
ControlPartCode controlPart ;
ControlRef control = wxMacFindControlUnderMouse(
toplevel , localMouse ,
theWindow , &controlPart ) ;
toplevel , localMouse , theWindow , &controlPart ) ;
if ( control )
win = wxFindControlFromMacControl( control ) ;
else
@@ -632,6 +642,9 @@ pascal OSErr wxMacWindowDragTrackingHandler(
break;
case kDragTrackingLeaveWindow:
if (trackingGlobals == NULL)
break;
if (trackingGlobals->m_currentTarget)
{
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );