]> git.saurik.com Git - wxWidgets.git/commitdiff
Some fixes for wxURLDataObject when wxUSE_UNICODE==1
authorRobin Dunn <robin@alldunn.com>
Wed, 13 Mar 2002 00:21:34 +0000 (00:21 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 13 Mar 2002 00:21:34 +0000 (00:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/ole/dataobj.cpp

index e816a3d629cc51f368333dd2250e2c71372e68a7..9bf10aab3d88371a5443e6dc71dce2b9854bdee8 100644 (file)
@@ -1065,7 +1065,8 @@ bool wxFileDataObject::GetDataHere(void *pData) const
 // wxURLDataObject
 // ----------------------------------------------------------------------------
 
-class CFSTR_SHELLURLDataObject:public wxCustomDataObject
+
+class CFSTR_SHELLURLDataObject : public wxCustomDataObject
 {
 public:
     CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {}
@@ -1089,6 +1090,7 @@ protected:
     {
         return buffer;
     }
+
 #if wxUSE_UNICODE
     virtual bool GetDataHere( void* buffer ) const
     {
@@ -1104,6 +1106,8 @@ protected:
 #endif
 };
 
+
+
 wxURLDataObject::wxURLDataObject()
 {
     // 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)
 {
-    SetData(wxDataFormat(wxDF_TEXT), url.Length()+1, url.c_str());
-    SetData(wxDataFormat(CFSTR_SHELLURL), url.Length()+1, url.c_str());
+    SetData(wxDataFormat(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT),
+            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);
 }
 
 // ----------------------------------------------------------------------------