// Created:
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
#if wxUSE_OLE && wxUSE_DRAG_AND_DROP
+#include "wx/msw/private.h"
#include "wx/log.h"
+#ifdef __WXWINCE__
+ #include <winreg.h>
+ #include <ole2.h>
+#endif
+
#ifdef __WIN32__
#if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS
#if wxCHECK_W32API_VERSION( 1, 0 )
- #include <windows.h>
+ #include "wx/msw/wrapwin.h"
#endif
#include <shlobj.h> // for DROPFILES structure
#endif
#include "wx/dnd.h"
-#ifndef __WIN32__
- #include <ole2.h>
- #include <olestd.h>
-#endif
-
#include "wx/msw/ole/oleutils.h"
// ----------------------------------------------------------------------------
// get default drop effect for given keyboard flags
static inline DWORD GetDropEffect(DWORD flags);
+
+ DECLARE_NO_COPY_CLASS(wxIDropTarget)
};
// ----------------------------------------------------------------------------
wxIDropTarget::wxIDropTarget(wxDropTarget *pTarget)
{
- m_cRef = 0;
m_pTarget = pTarget;
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
+ // debugging purposes, this is quite useful sometimes - please don't remove
#if 0
IEnumFORMATETC *penumFmt;
if ( SUCCEEDED(pIDataSource->EnumFormatEtc(DATADIR_GET, &penumFmt)) )
bool wxDropTarget::Register(WXHWND hwnd)
{
- HRESULT hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE);
+ HRESULT hr;
+
+ // May exist in later WinCE versions
+#ifndef __WXWINCE__
+ hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE);
if ( FAILED(hr) ) {
wxLogApiError(wxT("CoLockObjectExternal"), hr);
return FALSE;
}
+#endif
hr = ::RegisterDragDrop((HWND) hwnd, m_pIDropTarget);
if ( FAILED(hr) ) {
+ // May exist in later WinCE versions
+#ifndef __WXWINCE__
::CoLockObjectExternal(m_pIDropTarget, FALSE, FALSE);
-
+#endif
wxLogApiError(wxT("RegisterDragDrop"), hr);
return FALSE;
}
wxLogApiError(wxT("RevokeDragDrop"), hr);
}
+ // May exist in later WinCE versions
+#ifndef __WXWINCE__
::CoLockObjectExternal(m_pIDropTarget, FALSE, TRUE);
+#endif
m_pIDropTarget->SetHwnd(0);
}
rc = TRUE;
}
else {
- wxLogLastError(wxT("IDataObject::SetData()"));
+ wxLogApiError(wxT("IDataObject::SetData()"), hr);
}
}
else {
- wxLogLastError(wxT("IDataObject::GetData()"));
+ wxLogApiError(wxT("IDataObject::GetData()"), hr);
}
return rc;
case DROPEFFECT_COPY:
return wxDragCopy;
+ case DROPEFFECT_LINK:
+ return wxDragLink;
+
case DROPEFFECT_MOVE:
return wxDragMove;
case wxDragCopy:
return DROPEFFECT_COPY;
+ case wxDragLink:
+ return DROPEFFECT_LINK;
+
case wxDragMove:
return DROPEFFECT_MOVE;