void wxDataFormat::SetType( wxDataFormatId type )
{
PrepareFormats();
- m_type = type;
+
+ if (type == wxDF_UNICODETEXT)
+ type = wxDF_TEXT;
+ m_type = type;
+
if (m_type == wxDF_TEXT)
m_format = g_textAtom;
else
wxString wxDataFormat::GetId() const
{
- wxString ret( gdk_atom_name( m_format ) ); // this will convert from ascii to Unicode
+ wxString ret = wxString::FromAscii( gdk_atom_name( m_format ) );
return ret;
}
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
- m_format = gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE ); // what is the string cast for?
+ m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE );
}
void wxDataFormat::PrepareFormats()
// text/uri-list for file dnd because compatibility is not important
// here (with whom?)
if (!g_textAtom)
+#if wxUSE_UNICODE
+ g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE );
+#else
g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE );
+#endif
if (!g_pngAtom)
g_pngAtom = gdk_atom_intern( "image/png", FALSE );
if (!g_fileAtom)
wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL,
wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") );
- wxImage image(m_bitmap);
+ wxImage image = m_bitmap.ConvertToImage();
wxCountingOutputStream count;
image.SaveFile(count, wxBITMAP_TYPE_PNG);