X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd52bee1062faef26287d2f5a2595a9d8ee4d85a..ad4297f34e21cea85219f3866d96c2622d5bb699:/src/msw/ole/dataobj.cpp diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index f0b939a5c4..72776682a6 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -62,7 +62,7 @@ #ifdef __WXDEBUG__ static const wxChar *GetTymedName(DWORD tymed); #else // !Debug - #define GetTymedName(tymed) "" + #define GetTymedName(tymed) _T("") #endif // Debug/!Debug // ---------------------------------------------------------------------------- @@ -621,7 +621,7 @@ STDMETHODIMP wxIDataObject::EnumFormatEtc(DWORD dwDir, size_t nFormatCount = m_pDataObject->GetFormatCount(dir); wxDataFormat format; - wxDataFormat *formats; + wxDataFormat *formats; formats = nFormatCount == 1 ? &format : new wxDataFormat[nFormatCount]; m_pDataObject->GetAllFormats(formats, dir); @@ -1029,11 +1029,53 @@ bool wxFileDataObject::GetDataHere(void *pData) const *pbuf++ = wxT('\0'); } - *pbuf = wxT('\0'); // add final null terminator + // add final null terminator + *pbuf = wxT('\0'); 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 // ----------------------------------------------------------------------------