+size_t wxBitmapDataObject::GetDataSize() const
+{
+ if (m_pictHandle != NULL)
+ return GetHandleSize( (Handle)m_pictHandle );
+ else
+ return 0;
+}
+
+bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf )
+{
+ Clear();
+
+ if ((pBuf == NULL) || (nSize == 0))
+ return false;
+
+ PicHandle picHandle = (PicHandle)NewHandle( nSize );
+ memcpy( *picHandle, pBuf, nSize );
+ m_pictHandle = picHandle;
+
+ // ownership is transferred to the bitmap
+ m_pictCreated = false;
+#ifndef __LP64__
+ Rect frame;
+ wxMacGetPictureBounds( picHandle, &frame );
+#if wxUSE_METAFILE
+ wxMetafile mf;
+ mf.SetHMETAFILE( (WXHMETAFILE)m_pictHandle );
+#endif
+ wxMemoryDC mdc;
+ m_bitmap.Create( frame.right - frame.left, frame.bottom - frame.top );
+ mdc.SelectObject( m_bitmap );
+#if wxUSE_METAFILE
+ mf.Play( &mdc );
+#endif
+ mdc.SelectObject( wxNullBitmap );
+#endif