X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f1ae4143271ae63a17e052a1a471d16e9cd8c44..ad42b67c35ddcf8df2075ab582c9b64525756d09:/src/mac/dataobj.cpp diff --git a/src/mac/dataobj.cpp b/src/mac/dataobj.cpp index 67f938b414..c2f75326c0 100644 --- a/src/mac/dataobj.cpp +++ b/src/mac/dataobj.cpp @@ -33,6 +33,7 @@ #include "wx/dataobj.h" #include "wx/mstream.h" #include "wx/image.h" +#include "wx/mac/private.h" // ---------------------------------------------------------------------------- // functions @@ -77,7 +78,7 @@ void wxDataFormat::SetType( wxDataFormatId Type ) else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE ) m_format = 'PICT'; else if (m_type == wxDF_FILENAME) - m_format = 'SPEC'; + m_format = kDragFlavorTypeHFS ; else { wxFAIL_MSG( wxT("invalid dataformat") ); @@ -105,7 +106,7 @@ void wxDataFormat::SetId( NativeFormat format ) if (m_format == 'PICT') m_type = wxDF_BITMAP; else - if (m_format == 'SPEC') + if (m_format == kDragFlavorTypeHFS ) m_type = wxDF_FILENAME; else m_type = wxDF_PRIVATE; @@ -198,7 +199,7 @@ bool wxFileDataObject::SetData( , const void* pBuf ) { - /* TODO */ + m_filenames.Empty(); wxString sFile( (const char *)pBuf); /* char, not wxChar */ @@ -280,7 +281,7 @@ bool wxBitmapDataObject::SetData( return FALSE; } - m_bitmap = vImage.ConvertToBitmap(); + m_bitmap = wxBitmap( vImage ) ; return m_bitmap.Ok(); } @@ -289,17 +290,18 @@ void wxBitmapDataObject::DoConvertToPng() if (!m_bitmap.Ok()) return; - wxImage vImage(m_bitmap); - wxPNGHandler vHandler; - wxCountingOutputStream vCount; + wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL, + wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") ); - vHandler.SaveFile(&vImage, vCount); + wxImage image = m_bitmap.ConvertToImage(); - m_pngSize = vCount.GetSize() + 100; // sometimes the size seems to vary ??? - m_pngData = malloc(m_pngSize); + wxCountingOutputStream count; + image.SaveFile(count, wxBITMAP_TYPE_PNG); - wxMemoryOutputStream vMstream((char*) m_pngData, m_pngSize); + m_pngSize = count.GetSize() + 100; // sometimes the size seems to vary ??? + m_pngData = malloc(m_pngSize); - vHandler.SaveFile(&vImage, vMstream ); + wxMemoryOutputStream mstream((char*) m_pngData, m_pngSize); + image.SaveFile(mstream, wxBITMAP_TYPE_PNG); }