X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..51909b8b0bcc5291ec57ac22d8d0e5d73ae51d65:/src/osx/carbon/dataobj.cpp diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index a65b2b7dfe..a4cfb843af 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -29,7 +29,7 @@ #include "wx/osx/private.h" -#ifdef __DARWIN__ +#if wxOSX_USE_COCOA_OR_CARBON #include #endif @@ -162,6 +162,10 @@ void wxDataFormat::SetId( NativeFormat format ) { m_type = wxDF_UNICODETEXT; } + else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.utf16-external-plain-text") ) ) + { + m_type = wxDF_UNICODETEXT; + } else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.plain-text") ) ) { m_type = wxDF_TEXT; @@ -472,7 +476,7 @@ bool wxDataObject::GetFromPasteboard( void * pb ) } CFRelease( flavorTypeArray ); } - if (filenamesPassed.length() > 0) + if ( !filenamesPassed.empty() ) { wxCharBuffer buf = filenamesPassed.fn_str(); SetData( wxDF_FILENAME, strlen( buf ), (const char*)buf ); @@ -530,7 +534,7 @@ bool wxDataObject::HasDataInPasteboard( void * pb ) wxDataFormat flavorFormat( (wxDataFormat::NativeFormat) flavorType ); if ( dataFormat == flavorFormat || - dataFormat.GetType() == wxDF_UNICODETEXT && flavorFormat.GetType() == wxDF_TEXT ) + (dataFormat.GetType() == wxDF_UNICODETEXT && flavorFormat.GetType() == wxDF_TEXT) ) { hasData = true; } @@ -632,7 +636,7 @@ wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& rBitmap ) { Init(); - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) { SetBitmap( rBitmap ); } @@ -647,7 +651,7 @@ void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap ) { Clear(); wxBitmapDataObjectBase::SetBitmap( rBitmap ); - if (m_bitmap.Ok()) + if (m_bitmap.IsOk()) { CGImageRef cgImageRef = (CGImageRef) m_bitmap.CreateCGImage(); @@ -738,8 +742,8 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf ) if ( source ) { cgImageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL); + CFRelease( source ); } - CFRelease( source ); CFRelease( data ); if ( cgImageRef ) @@ -752,7 +756,7 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf ) cgImageRef = NULL; } - return m_bitmap.Ok(); + return m_bitmap.IsOk(); } #endif