]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/dataobj.cpp
always pass WM_DESTROY to DefWindowProc() - this fixes memory/resource leak for wxListBox
[wxWidgets.git] / src / msw / ole / dataobj.cpp
index 7d55fcd05bd0faab0a1213d55b7a921241b1fccf..72776682a698e47047f10c43403f3f5c90975dba 100644 (file)
@@ -1035,6 +1035,47 @@ bool wxFileDataObject::GetDataHere(void *pData) const
     return TRUE;
 }
 
+// ----------------------------------------------------------------------------
+// wxURLDataObject
+// ----------------------------------------------------------------------------
+
+wxURLDataObject::wxURLDataObject()
+{
+    // we support CF_TEXT and CFSTR_SHELLURL formats which are basicly the same
+    // but it seems that some browsers only provideo ne of them so we have to
+    // support both
+    Add(new wxCustomDataObject(CFSTR_SHELLURL));
+    Add(new wxTextDataObject);
+
+    // we don't have any data yet
+    m_dataObjectLast = NULL;
+}
+
+bool wxURLDataObject::SetData(const wxDataFormat& format,
+                              size_t len,
+                              const void *buf)
+{
+    m_dataObjectLast = GetObject(format);
+
+    wxCHECK_MSG( m_dataObjectLast, FALSE,
+                 wxT("unsupported format in wxURLDataObject"));
+
+    return m_dataObjectLast->SetData(len, buf);
+}
+
+wxString wxURLDataObject::GetURL() const
+{
+    wxString url;
+    wxCHECK_MSG( m_dataObjectLast, url, _T("no data in wxURLDataObject") );
+
+    size_t len = m_dataObjectLast->GetDataSize();
+
+    m_dataObjectLast->GetDataHere(url.GetWriteBuf(len + 1));
+    url.UngetWriteBuf();
+
+    return url;
+}
+
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------