From 2b2832ef0c9320b872d62cbf8f308ff4998af1ed Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 15 May 2004 14:58:49 +0000 Subject: [PATCH] unicode conversion support for text dnd git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dnd.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index 37c444ed78..14da3edf45 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -195,20 +195,34 @@ bool wxDropTarget::GetData() Size dataSize ; Ptr theData ; GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize); - if ( theType == 'TEXT' ) + if ( theType == kScrapFlavorTypeText ) { // 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 + dataSize++ ; + dataSize++ ; + } theData = new char[dataSize]; GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); - if( theType == 'TEXT' ) + if( theType == kScrapFlavorTypeText ) + { + theData[dataSize]=0 ; + m_dataObject->SetData( wxDataFormat(wxDF_TEXT), dataSize , theData ); + } + #if wxUSE_UNICODE + else if ( theType == kScrapFlavorTypeUnicode ) { theData[dataSize]=0 ; - wxString convert( theData , wxConvLocal ) ; - m_dataObject->SetData( format, convert.Length() * sizeof(wxChar), (const wxChar*) convert ); + theData[dataSize+1]=0 ; + m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData ); } + #endif else if ( theType == kDragFlavorTypeHFS ) { HFSFlavor* theFile = (HFSFlavor*) theData ; -- 2.45.2