]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dobjcmn.cpp
merged in the commit from the 2.2 branch
[wxWidgets.git] / src / common / dobjcmn.cpp
index bf6ecc3dc90b162cc8de9bd1ccd13a4c2aceb9d6..820989a6f48fe5fcd9b7467291c407a67b2cab69 100644 (file)
@@ -61,6 +61,33 @@ wxDataObjectBase::~wxDataObjectBase()
 {
 }
 
 {
 }
 
+bool wxDataObjectBase::IsSupported(const wxDataFormat& format,
+                                   Direction dir) const
+{
+    size_t nFormatCount = GetFormatCount(dir);
+    if ( nFormatCount == 1 )
+    {
+        return format == GetPreferredFormat(dir);
+    }
+    else
+    {
+        wxDataFormat *formats = new wxDataFormat[nFormatCount];
+        GetAllFormats(formats, dir);
+
+        size_t n;
+        for ( n = 0; n < nFormatCount; n++ )
+        {
+            if ( formats[n] == format )
+                break;
+        }
+
+        delete [] formats;
+
+        // found?
+        return n < nFormatCount;
+    }
+}
+
 // ----------------------------------------------------------------------------
 // wxDataObjectComposite
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxDataObjectComposite
 // ----------------------------------------------------------------------------
@@ -255,7 +282,7 @@ void *wxCustomDataObject::Alloc(size_t size)
 
 void wxCustomDataObject::Free()
 {
 
 void wxCustomDataObject::Free()
 {
-    delete [] m_data;
+    delete [] (char *)m_data;
     m_size = 0;
     m_data = (void *)NULL;
 }
     m_size = 0;
     m_data = (void *)NULL;
 }