Some fixes for wxURLDataObject when wxUSE_UNICODE==1

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-03-13 00:21:34 +00:00
parent cb9965c3cc
commit 4a09bc4e34

View File

@@ -1065,7 +1065,8 @@ bool wxFileDataObject::GetDataHere(void *pData) const
// wxURLDataObject // wxURLDataObject
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class CFSTR_SHELLURLDataObject:public wxCustomDataObject
class CFSTR_SHELLURLDataObject : public wxCustomDataObject
{ {
public: public:
CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {} CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {}
@@ -1089,6 +1090,7 @@ protected:
{ {
return buffer; return buffer;
} }
#if wxUSE_UNICODE #if wxUSE_UNICODE
virtual bool GetDataHere( void* buffer ) const virtual bool GetDataHere( void* buffer ) const
{ {
@@ -1104,6 +1106,8 @@ protected:
#endif #endif
}; };
wxURLDataObject::wxURLDataObject() wxURLDataObject::wxURLDataObject()
{ {
// we support CF_TEXT and CFSTR_SHELLURL formats which are basicly the same // we support CF_TEXT and CFSTR_SHELLURL formats which are basicly the same
@@ -1143,8 +1147,13 @@ wxString wxURLDataObject::GetURL() const
void wxURLDataObject::SetURL(const wxString& url) void wxURLDataObject::SetURL(const wxString& url)
{ {
SetData(wxDataFormat(wxDF_TEXT), url.Length()+1, url.c_str()); SetData(wxDataFormat(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT),
SetData(wxDataFormat(CFSTR_SHELLURL), url.Length()+1, url.c_str()); url.Length()+1, url.c_str());
// CFSTR_SHELLURL is always supposed to be ANSI...
wxWX2MBbuf urlA = (wxWX2MBbuf)url.mbc_str();
size_t len = strlen(urlA);
SetData(wxDataFormat(CFSTR_SHELLURL), len+1, (const char*)urlA);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------