+#if wxUSE_UNICODE
+ #if defined(__WXGTK20__)
+ #define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
+ #elif defined(__WXMAC__)
+ #define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
+ #endif
+#endif // wxUSE_UNICODE
+
+class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple
+{
+public:
+ // ctor: you can specify the text here or in SetText(), or override
+ // GetText()
+ wxHTMLDataObject(const wxString& html = wxEmptyString)
+ : wxDataObjectSimple(wxDF_HTML),
+ m_html(html)
+ {
+ }
+
+ // virtual functions which you may override if you want to provide text on
+ // demand only - otherwise, the trivial default versions will be used
+ virtual size_t GetLength() const { return m_html.Len() + 1; }
+ virtual wxString GetHTML() const { return m_html; }
+ virtual void SetHTML(const wxString& html) { m_html = html; }
+
+ virtual size_t GetDataSize() const;
+ virtual bool GetDataHere(void *buf) const;
+ virtual bool SetData(size_t len, const void *buf);
+
+ // Must provide overloads to avoid hiding them (and warnings about it)
+ virtual size_t GetDataSize(const wxDataFormat&) const
+ {
+ return GetDataSize();
+ }
+ virtual bool GetDataHere(const wxDataFormat&, void *buf) const
+ {
+ return GetDataHere(buf);
+ }
+ virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
+ {
+ return SetData(len, buf);
+ }
+
+private:
+ wxString m_html;
+};
+