X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9691c806e6fbb08b01c9eec9998ad1e8242c7df3..5d484919aad7cbd553103c414424bf488df272f7:/src/x11/dataobj.cpp diff --git a/src/x11/dataobj.cpp b/src/x11/dataobj.cpp index 75028159fe..fadc4afd80 100644 --- a/src/x11/dataobj.cpp +++ b/src/x11/dataobj.cpp @@ -7,16 +7,15 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "dataobj.h" -#endif - #include "wx/defs.h" +#if wxUSE_DATAOBJ + #include "wx/dataobj.h" #include "wx/mstream.h" #include "wx/app.h" #include "wx/image.h" +#include "wx/log.h" #include "wx/utils.h" #include "wx/x11/private.h" @@ -97,11 +96,15 @@ wxDataFormatId wxDataFormat::GetType() const wxString wxDataFormat::GetId() const { +#if wxUSE_NANOX + return wxEmptyString; +#else char *t = XGetAtomName ((Display*) wxGetDisplay(), m_format); - wxString ret( t ); // this will convert from ascii to Unicode + wxString ret = wxString::FromAscii( t ); if (t) XFree( t ); return ret; +#endif } void wxDataFormat::SetId( NativeFormat format ) @@ -123,20 +126,24 @@ void wxDataFormat::SetId( NativeFormat format ) void wxDataFormat::SetId( const wxChar *id ) { +#if !wxUSE_NANOX PrepareFormats(); m_type = wxDF_PRIVATE; wxString tmp( id ); - m_format = XInternAtom( (Display*) wxGetDisplay(), wxMBSTRINGCAST tmp.mbc_str(), FALSE ); // what is the string cast for? + m_format = XInternAtom( (Display*) wxGetDisplay(), tmp.ToAscii(), FALSE ); +#endif } void wxDataFormat::PrepareFormats() { +#if !wxUSE_NANOX if (!g_textAtom) g_textAtom = XInternAtom( (Display*) wxGetDisplay(), "STRING", FALSE ); if (!g_pngAtom) g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE ); if (!g_fileAtom) g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "text/uri-list", FALSE ); +#endif } //------------------------------------------------------------------------- @@ -342,7 +349,7 @@ bool wxBitmapDataObject::SetData(size_t size, const void *buf) return FALSE; } - m_bitmap = image.ConvertToBitmap(); + m_bitmap = image; return m_bitmap.Ok(); #else @@ -356,7 +363,7 @@ void wxBitmapDataObject::DoConvertToPng() if (!m_bitmap.Ok()) return; - wxImage image( m_bitmap ); + wxImage image = m_bitmap.ConvertToImage(); wxPNGHandler handler; wxCountingOutputStream count; @@ -370,3 +377,5 @@ void wxBitmapDataObject::DoConvertToPng() #endif } +#endif // wxUSE_DATAOBJ +