#include "wx/osx/private.h"
-#ifdef __DARWIN__
+#if wxOSX_USE_COCOA_OR_CARBON
#include <QuickTime/QuickTime.h>
#endif
m_format = 0;
}
m_format = (NativeFormat) CFStringCreateCopy(NULL, (CFStringRef)format);
- if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.utf16-plain-text") ) )
+ if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.utf16-plain-text") ) )
{
m_type = wxDF_UNICODETEXT;
- }
+ }
else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.plain-text") ) )
{
m_type = wxDF_TEXT;
}
- else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.tiff") ) )
+ else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.tiff") ) )
{
m_type = wxDF_BITMAP;
}
- else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("com.adobe.pdf") ) )
+ else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("com.adobe.pdf") ) )
{
m_type = wxDF_METAFILE;
}
- else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.file-url") ) )
+ else if ( UTTypeConformsTo( (CFStringRef)format, CFSTR("public.file-url") ) )
{
m_type = wxDF_FILENAME;
}
- else
+ else
{
m_type = wxDF_PRIVATE;
m_id = wxCFStringRef( (CFStringRef) CFRetain((CFStringRef) format )).AsString();
for (size_t i = 0; i < GetFormatCount(); i++)
{
wxDataFormat thisFormat = array[ i ];
-
- // add four bytes at the end for data objs like text that
+
+ // add four bytes at the end for data objs like text that
// have a datasize = strlen but still need a buffer for the
// string including trailing zero
-
+
size_t datasize = GetDataSize( thisFormat );
size_t sz = datasize + 4;
void* buf = malloc( sz );
counter++;
fname = strtok (NULL,"\n");
}
-
+
}
else
{
PasteboardItemID itemID;
CFArrayRef flavorTypeArray;
CFIndex flavorCount;
-
+
err = PasteboardGetItemIdentifier( pasteboard, itemIndex, &itemID );
if ( err != noErr )
continue;
-
+
err = PasteboardCopyItemFlavors( pasteboard, itemID, &flavorTypeArray );
if ( err != noErr )
continue;
-
+
flavorCount = CFArrayGetCount( flavorTypeArray );
-
+
for( CFIndex flavorIndex = 0; flavorIndex < flavorCount && hasData == false ; flavorIndex++ )
{
CFStringRef flavorType;
-
+
flavorType = (CFStringRef)CFArrayGetValueAtIndex( flavorTypeArray,
flavorIndex );
-
+
wxDataFormat flavorFormat( (wxDataFormat::NativeFormat) flavorType );
if ( dataFormat == flavorFormat )
hasData = true;
err = PasteboardCopyItemFlavors( pasteboard, itemID, &flavorTypeArray );
if ( err != noErr )
continue;
-
+
flavorCount = CFArrayGetCount( flavorTypeArray );
for( CFIndex flavorIndex = 0; !transferred && flavorIndex < flavorCount ; flavorIndex++ )
CFStringRef flavorType;
CFDataRef flavorData;
CFIndex flavorDataSize;
-
+
flavorType = (CFStringRef)CFArrayGetValueAtIndex( flavorTypeArray,
flavorIndex );
flavorType = CFSTR("public.utf16-plain-text");
}
wxDataFormat flavorFormat( (wxDataFormat::NativeFormat) flavorType );
-
+
if ( dataFormat == flavorFormat )
{
err = PasteboardCopyItemFlavorData( pasteboard, itemID, flavorType , &flavorData );
{
memset( buf, 0, flavorDataSize + 4 );
memcpy( buf, CFDataGetBytePtr( flavorData ), flavorDataSize );
-
+
if (dataFormat.GetType() == wxDF_TEXT)
wxMacConvertNewlines10To13( (char*) buf );
SetData( flavorFormat, flavorDataSize, buf );
err = PasteboardCopyItemFlavors( pasteboard, itemID, &flavorTypeArray );
if ( err != noErr )
continue;
-
+
flavorCount = CFArrayGetCount( flavorTypeArray );
for( CFIndex flavorIndex = 0; !hasData && flavorIndex < flavorCount ; flavorIndex++ )
{
CFStringRef flavorType;
-
+
flavorType = (CFStringRef)CFArrayGetValueAtIndex( flavorTypeArray,
flavorIndex );
wxDataFormat flavorFormat( (wxDataFormat::NativeFormat) flavorType );
-
- if ( dataFormat == flavorFormat ||
+
+ if ( dataFormat == flavorFormat ||
dataFormat.GetType() == wxDF_UNICODETEXT && flavorFormat.GetType() == wxDF_TEXT )
{
hasData = true;
if (m_bitmap.Ok())
{
- SetBitmap( rBitmap );
+ SetBitmap( rBitmap );
}
}