native hook for supported datatypes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2012-07-01 15:46:26 +00:00
parent 5ce7b0b55c
commit f31c06b39e
2 changed files with 44 additions and 0 deletions

View File

@@ -31,6 +31,10 @@ public:
// returns true if any of the accepted formats of this dataobj is in the pasteboard
bool HasDataInPasteboard( void * pasteboardRef );
bool GetFromPasteboard( void * pasteboardRef );
#if wxOSX_USE_COCOA
virtual void AddSupportedTypes( void* cfarray);
#endif
};
#endif // _WX_MAC_DATAOBJ_H_

View File

@@ -594,6 +594,46 @@ bool wxDataObject::HasDataInPasteboard( void * pb )
return hasData;
}
#if wxOSX_USE_COCOA
void wxDataObject::AddSupportedTypes( void* cfarray)
{
wxDataFormat *array = new wxDataFormat[ GetFormatCount() ];
GetAllFormats( array );
for (size_t i = 0; i < GetFormatCount(); i++)
{
wxDataFormat dataFormat = array[ i ];
if ( dataFormat.GetType() == wxDF_UNICODETEXT || dataFormat.GetType() == wxDF_TEXT )
{
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypeUTF16PlainText);
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypePlainText);
}
else if ( dataFormat.GetType() == wxDF_FILENAME )
{
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypeFileURL);
CFArrayAppendValue((CFMutableArrayRef)cfarray, kPasteboardTypeFileURLPromise);
}
else if ( dataFormat.GetType() == wxDF_HTML )
{
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypeHTML);
}
else if ( dataFormat.GetType() == wxDF_BITMAP )
{
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypeTIFF);
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypePICT);
}
else if ( dataFormat.GetType() == wxDF_METAFILE )
{
CFArrayAppendValue((CFMutableArrayRef)cfarray, kUTTypePDF);
}
}
delete[] array;
}
#endif
// ----------------------------------------------------------------------------
// wxTextDataObject
// ----------------------------------------------------------------------------