]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/droptgt.cpp
more MSLU fixes and moved MSLU stuff into separate file
[wxWidgets.git] / src / msw / ole / droptgt.cpp
index 094ca925e4e4744bef9af5dede2422db4f76eb0b..d1e4a97b114619dc7861f5af2d8353a27502d2b1 100644 (file)
@@ -142,9 +142,31 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
                                       POINTL       pt,
                                       DWORD       *pdwEffect)
 {
-    wxLogDebug(wxT("IDropTarget::DragEnter"));
+    wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::DragEnter"));
 
-    wxASSERT( m_pIDataObject == NULL );
+    wxASSERT_MSG( m_pIDataObject == NULL,
+                  _T("drop target must have data object") );
+
+    // show the list of formats supported by the source data object for the
+    // debugging purposes, this is quite useful sometimes - please don't remove
+#if 0
+    IEnumFORMATETC *penumFmt;
+    if ( SUCCEEDED(pIDataSource->EnumFormatEtc(DATADIR_GET, &penumFmt)) )
+    {
+        FORMATETC fmt;
+        while ( penumFmt->Next(1, &fmt, NULL) == S_OK )
+        {
+            wxLogDebug(_T("Drop source supports format %s"),
+                       wxDataObject::GetFormatName(fmt.cfFormat));
+        }
+
+        penumFmt->Release();
+    }
+    else
+    {
+        wxLogLastError(_T("IDataObject::EnumFormatEtc"));
+    }
+#endif // 0
 
     if ( !m_pTarget->IsAcceptedData(pIDataSource) ) {
         // we don't accept this kind of data
@@ -216,7 +238,7 @@ STDMETHODIMP wxIDropTarget::DragOver(DWORD   grfKeyState,
 // Notes   : good place to do any clean-up
 STDMETHODIMP wxIDropTarget::DragLeave()
 {
-  wxLogDebug(wxT("IDropTarget::DragLeave"));
+  wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::DragLeave"));
 
   // remove the UI feedback
   m_pTarget->OnLeave();
@@ -241,7 +263,7 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
                                  POINTL       pt,
                                  DWORD       *pdwEffect)
 {
-    wxLogDebug(wxT("IDropTarget::Drop"));
+    wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::Drop"));
 
     // TODO I don't know why there is this parameter, but so far I assume
     //      that it's the same we've already got in DragEnter
@@ -380,11 +402,11 @@ bool wxDropTarget::GetData()
             rc = TRUE;
         }
         else {
-            wxLogLastError(wxT("IDataObject::SetData()"));
+            wxLogApiError(wxT("IDataObject::SetData()"), hr);
         }
     }
     else {
-        wxLogLastError(wxT("IDataObject::GetData()"));
+        wxLogApiError(wxT("IDataObject::GetData()"), hr);
     }
 
     return rc;
@@ -425,7 +447,7 @@ wxDataFormat wxDropTarget::GetSupportedFormat(IDataObject *pIDataSource) const
     // get the list of supported formats
     size_t nFormats = m_dataObject->GetFormatCount(wxDataObject::Set);
     wxDataFormat format;
-       wxDataFormat *formats;
+    wxDataFormat *formats;
     formats = nFormats == 1 ? &format :  new wxDataFormat[nFormats];
 
     m_dataObject->GetAllFormats(formats, wxDataObject::Set);
@@ -462,6 +484,9 @@ static wxDragResult ConvertDragEffectToResult(DWORD dwEffect)
         case DROPEFFECT_COPY:
             return wxDragCopy;
 
+        case DROPEFFECT_LINK:
+            return wxDragLink;
+
         case DROPEFFECT_MOVE:
             return wxDragMove;
 
@@ -480,6 +505,9 @@ static DWORD ConvertDragResultToEffect(wxDragResult result)
         case wxDragCopy:
             return DROPEFFECT_COPY;
 
+        case wxDragLink:
+            return DROPEFFECT_LINK;
+
         case wxDragMove:
             return DROPEFFECT_MOVE;