adaptions for cleaned up string conversions & carbon events support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-01-29 15:04:04 +00:00
parent 95fd868c8f
commit 45a0fd3723
2 changed files with 32 additions and 10 deletions

View File

@@ -194,8 +194,12 @@ bool wxDropTarget::GetData()
Size dataSize ; Size dataSize ;
Ptr theData ; Ptr theData ;
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize); GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
if ( theType == 'TEXT' ) if ( theType == 'TEXT' )
dataSize++ ; {
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
dataSize++ ;
}
theData = new char[dataSize]; 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 == 'TEXT' ) if( theType == 'TEXT' )
@@ -203,7 +207,7 @@ bool wxDropTarget::GetData()
theData[dataSize]=0 ; theData[dataSize]=0 ;
if ( wxApp::s_macDefaultEncodingIsPC ) if ( wxApp::s_macDefaultEncodingIsPC )
{ {
wxMacConvertToPC((char*)theData) ; wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
} }
m_dataObject->SetData( format, dataSize, theData ); m_dataObject->SetData( format, dataSize, theData );
} }
@@ -292,7 +296,7 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
dataSize-- ; dataSize-- ;
if ( wxApp::s_macDefaultEncodingIsPC ) if ( wxApp::s_macDefaultEncodingIsPC )
{ {
wxMacConvertFromPC((char*)dataPtr) ; wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
} }
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0); AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
} }
@@ -336,7 +340,14 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
dragRegion = NewRgn(); dragRegion = NewRgn();
RgnHandle tempRgn = NewRgn() ; RgnHandle tempRgn = NewRgn() ;
EventRecord* ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ; EventRecord* ev = NULL ;
#if !TARGET_CARBON // TODO
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
#else
EventRecord rec ;
ev = &rec ;
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
#endif
const short dragRegionOuterBoundary = 10 ; const short dragRegionOuterBoundary = 10 ;
const short dragRegionInnerBoundary = 9 ; const short dragRegionInnerBoundary = 9 ;

View File

@@ -194,8 +194,12 @@ bool wxDropTarget::GetData()
Size dataSize ; Size dataSize ;
Ptr theData ; Ptr theData ;
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize); GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
if ( theType == 'TEXT' ) if ( theType == 'TEXT' )
dataSize++ ; {
// this increment is only valid for allocating, on the next GetFlavorData
// call it is reset again to the original value
dataSize++ ;
}
theData = new char[dataSize]; 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 == 'TEXT' ) if( theType == 'TEXT' )
@@ -203,7 +207,7 @@ bool wxDropTarget::GetData()
theData[dataSize]=0 ; theData[dataSize]=0 ;
if ( wxApp::s_macDefaultEncodingIsPC ) if ( wxApp::s_macDefaultEncodingIsPC )
{ {
wxMacConvertToPC((char*)theData) ; wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
} }
m_dataObject->SetData( format, dataSize, theData ); m_dataObject->SetData( format, dataSize, theData );
} }
@@ -292,7 +296,7 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
dataSize-- ; dataSize-- ;
if ( wxApp::s_macDefaultEncodingIsPC ) if ( wxApp::s_macDefaultEncodingIsPC )
{ {
wxMacConvertFromPC((char*)dataPtr) ; wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
} }
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0); AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
} }
@@ -336,7 +340,14 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
dragRegion = NewRgn(); dragRegion = NewRgn();
RgnHandle tempRgn = NewRgn() ; RgnHandle tempRgn = NewRgn() ;
EventRecord* ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ; EventRecord* ev = NULL ;
#if !TARGET_CARBON // TODO
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
#else
EventRecord rec ;
ev = &rec ;
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
#endif
const short dragRegionOuterBoundary = 10 ; const short dragRegionOuterBoundary = 10 ;
const short dragRegionInnerBoundary = 9 ; const short dragRegionInnerBoundary = 9 ;