// 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 );
g_altTextAtom = gdk_atom_intern( "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)
// wxTextDataObject
// ----------------------------------------------------------------------------
-#if defined(__WXGTK20__) && wxUSE_UNICODE
+#if wxUSE_UNICODE
+
void
wxTextDataObject::GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir)) const
*formats++ = GetPreferredFormat();
*formats = g_altTextAtom;
}
-#endif
+
+#endif // wxUSE_UNICODE
// ----------------------------------------------------------------------------
// wxFileDataObject
image.SaveFile(mstream, wxBITMAP_TYPE_PNG);
}
+// ----------------------------------------------------------------------------
+// wxURLDataObject
+// ----------------------------------------------------------------------------
+
+wxURLDataObject::wxURLDataObject(const wxString& url) :
+ wxDataObjectSimple( wxDataFormat( gdk_atom_intern("text/x-moz-url",FALSE) ) )
+{
+ m_url = url;
+}
+
+size_t wxURLDataObject::GetDataSize() const
+{
+ if (m_url.empty())
+ return 0;
+
+ return 2*m_url.Len()+2;
+}
+
+bool wxURLDataObject::GetDataHere(void *buf) const
+{
+ if (m_url.empty())
+ return false;
+
+ wxCSConv conv( "UCS2" );
+ conv.FromWChar( (char*) buf, 2*m_url.Len()+2, m_url.wc_str() );
+
+ return true;
+}
+
+ // copy data from buffer to our data
+bool wxURLDataObject::SetData(size_t len, const void *buf)
+{
+ if (len == 0)
+ {
+ m_url = wxEmptyString;
+ return false;
+ }
+
+ wxCSConv conv( "UCS2" );
+ wxWCharBuffer res = conv.cMB2WC( (const char*) buf );
+ m_url = res;
+ int pos = m_url.Find( '\n' );
+ if (pos != wxNOT_FOUND)
+ m_url.Remove( pos, m_url.Len() - pos );
+
+ return true;
+}
+
+
#endif // wxUSE_DATAOBJ