diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 3bf59ed61bb..9e56ae68708 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in @@ -21,6 +21,7 @@ C_SRCS = \ dataobject.c \ debughlp.c \ dialogs.c \ + dragdrophelper.c \ enumidlist.c \ folders.c \ iconcache.c \ diff --git a/dlls/shell32/dragdrophelper.c b/dlls/shell32/dragdrophelper.c new file mode 100644 index 00000000000..d85619f51b7 --- /dev/null +++ b/dlls/shell32/dragdrophelper.c @@ -0,0 +1,182 @@ +/* + * file system folder + * + * Copyright 1997 Marcus Meissner + * Copyright 1998, 1999, 2002 Juergen Schmied + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include +#include + +#include "winerror.h" +#include "winbase.h" +#include "winreg.h" + +#include "oleidl.h" +#include "shlguid.h" + +#include "wine/obj_dragdrophelper.h" +#include "wine/debug.h" +#include "debughlp.h" + +WINE_DEFAULT_DEBUG_CHANNEL (shell); + +/*********************************************************************** +* IDropTargetHelper implementation +*/ + +typedef struct { + ICOM_VFIELD (IDropTargetHelper); + DWORD ref; +} IDropTargetHelperImpl; + +static struct ICOM_VTABLE (IDropTargetHelper) vt_IDropTargetHelper; + +#define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) +#define _IDropTargetHelper_(This) (IDropTargetHelper*)&(This->lpVtbl) + +/************************************************************************** +* IDropTargetHelper_Constructor +*/ +HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) +{ + IDropTargetHelperImpl *dth; + + TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid)); + + if (!ppv) + return E_POINTER; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + dth = (IDropTargetHelperImpl *) LocalAlloc (GMEM_ZEROINIT, sizeof (IDropTargetHelperImpl)); + if (!dth) return E_OUTOFMEMORY; + + dth->ref = 0; + ICOM_VTBL (dth) = &vt_IDropTargetHelper; + + if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (dth), riid, ppv))) { + IUnknown_Release (_IUnknown_ (dth)); + return E_NOINTERFACE; + } + + TRACE ("--(%p)\n", dth); + return S_OK; +} + +/************************************************************************** + * IDropTargetHelper_fnQueryInterface + */ +static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * iface, REFIID riid, LPVOID * ppvObj) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + + TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj); + + *ppvObj = NULL; + + if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper)) { + *ppvObj = This; + } + + if (*ppvObj) { + IUnknown_AddRef ((IUnknown *) (*ppvObj)); + TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj); + return S_OK; + } + FIXME ("-- Interface: E_NOINTERFACE\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + + TRACE ("(%p)->(count=%lu)\n", This, This->ref); + + return ++(This->ref); +} + +static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + + TRACE ("(%p)->(count=%lu)\n", This, This->ref); + + if (!--(This->ref)) { + TRACE ("-- destroying (%p)\n", This); + LocalFree ((HLOCAL) This); + } + return This->ref; +} + +static HRESULT WINAPI IDropTargetHelper_fnDragEnter ( + IDropTargetHelper * iface, + HWND hwndTarget, + IDataObject* pDataObject, + POINT* ppt, + DWORD dwEffect) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + FIXME ("(%p)->(0x%x %p %p 0x%08lx)\n", This,hwndTarget, pDataObject, ppt, dwEffect); + return E_NOTIMPL; +} + +static HRESULT WINAPI IDropTargetHelper_fnDragLeave (IDropTargetHelper * iface) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + FIXME ("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI IDropTargetHelper_fnDragOver (IDropTargetHelper * iface, POINT* ppt, DWORD dwEffect) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + FIXME ("(%p)->(%p 0x%08lx)\n", This, ppt, dwEffect); + return E_NOTIMPL; +} + +static HRESULT WINAPI IDropTargetHelper_fnDrop (IDropTargetHelper * iface, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + FIXME ("(%p)->(%p %p 0x%08lx)\n", This, pDataObject, ppt, dwEffect); + return E_NOTIMPL; +} + +static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL fShow) +{ + ICOM_THIS (IDropTargetHelperImpl, iface); + FIXME ("(%p)->(%u)\n", This, fShow); + return E_NOTIMPL; +} + +static ICOM_VTABLE (IDropTargetHelper) vt_IDropTargetHelper = +{ + ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + IDropTargetHelper_fnQueryInterface, + IDropTargetHelper_fnAddRef, + IDropTargetHelper_fnRelease, + IDropTargetHelper_fnDragEnter, + IDropTargetHelper_fnDragLeave, + IDropTargetHelper_fnDragOver, + IDropTargetHelper_fnDrop, + IDropTargetHelper_fnShow +}; diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index f21a405c252..2cf50337b47 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -80,6 +80,7 @@ HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); +HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); /* kind of enumidlist */ #define EIDL_DESK 0 diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 54f8bfdd2c9..bd2eeba4202 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -38,6 +38,7 @@ #include "shlwapi.h" #include "winuser.h" #include "debughlp.h" +#include "wine/obj_dragdrophelper.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -58,11 +59,12 @@ IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, struct { REFIID riid; LPFNCREATEINSTANCE lpfnCI; -} InterfaceTable[5] = { +} InterfaceTable[6] = { {&CLSID_ShellFSFolder, &IFSFolder_Constructor}, {&CLSID_MyComputer, &ISF_MyComputer_Constructor}, {&CLSID_ShellDesktop, &ISF_Desktop_Constructor}, {&CLSID_ShellLink, &IShellLink_Constructor}, + {&CLSID_DragDropHelper, &IDropTargetHelper_Constructor}, {NULL,NULL} }; diff --git a/include/Makefile.in b/include/Makefile.in index 4f18004f27c..4911d2e5349 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -153,6 +153,7 @@ INSTALLED_INCLUDES = \ wine/obj_dataobject.h \ wine/obj_dockingwindowframe.h \ wine/obj_dragdrop.h \ + wine/obj_dragdrophelper.h \ wine/obj_enumguid.h \ wine/obj_enumidlist.h \ wine/obj_errorinfo.h \ diff --git a/include/wine/obj_dragdrophelper.h b/include/wine/obj_dragdrophelper.h new file mode 100644 index 00000000000..f73cb17a5d5 --- /dev/null +++ b/include/wine/obj_dragdrophelper.h @@ -0,0 +1,105 @@ +/* + * Defines the COM interfaces related to SHELL DragDropHelper + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_WINE_OBJ_DRAGDROPHELPER_H +#define __WINE_WINE_OBJ_DRAGDROPHELPER_H + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +/***************************************************************************** + * Predeclare the interfaces + */ +DEFINE_GUID(CLSID_DragDropHelper, 0x4657278a, 0x411b, 0x11d2, 0x83, 0x9a, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0); + +DEFINE_GUID(IID_IDropTargetHelper, 0x4657278b, 0x411b, 0x11d2, 0x83, 0x9a, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0); +typedef struct IDropTargetHelper IDropTargetHelper,*LPDROPTARGETHELPER; + +DEFINE_GUID(IID_IDragSourceHelper, 0xde5bf786, 0x477a, 0x11d2, 0x83, 0x9d, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0); +typedef struct IDragSourceHelper IDragSourceHelper,*LPDRAGSOURCEHELPER; + +/***************************************************************************** + * IDragSourceHelper interface + */ + +typedef struct { + SIZE sizeDragImage; + POINT ptOffset; + HBITMAP hbmpDragImage; + COLORREF crColorKey; +} SHDRAGIMAGE, *LPSHDRAGIMAGE; + + +#define ICOM_INTERFACE IDragSourceHelper +#define IDragSourceHelper_METHODS \ + ICOM_METHOD2(HRESULT, InitializeFromBitmap, LPSHDRAGIMAGE, pshdi, IDataObject*, pDataObject) \ + ICOM_METHOD3(HRESULT, InitializeFromWindow, HWND, hwnd, POINT*, ppt, IDataObject*, pDataObject) +#define IDragSourceHelper_IMETHODS \ + IUnknown_IMETHODS \ + IDragSourceHelper_METHODS +ICOM_DEFINE(IDragSourceHelper,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IDragSourceHelper_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDragSourceHelper_AddRef(p) ICOM_CALL (AddRef,p) +#define IDragSourceHelper_Release(p) ICOM_CALL (Release,p) +/*** IDropSource methods ***/ +#define IDragSourceHelper_InitializeFromBitmap(p,a,b) ICOM_CALL2(InitializeFromBitmap,p,a,b) +#define IDragSourceHelper_InitializeFromWindow(p,a,b,c) ICOM_CALL1(InitializeFromWindow,p,a,b,c) + + +/***************************************************************************** + * IDropTargetHelper interface + */ +#define ICOM_INTERFACE IDropTargetHelper +#define IDropTargetHelper_METHODS \ + ICOM_METHOD4(HRESULT,DragEnter, HWND, hwndTarget, IDataObject*, pDataObject, POINT*, ppt, DWORD, dwEffect) \ + ICOM_METHOD (HRESULT,DragLeave) \ + ICOM_METHOD2(HRESULT,DragOver, POINT*, ppt, DWORD, dwEffect) \ + ICOM_METHOD3(HRESULT,Drop, IDataObject*, pDataObject, POINT*, ppt,DWORD, dwEffect) \ + ICOM_METHOD1(HRESULT,Show, BOOL, fShow) +#define IDropTargetHelper_IMETHODS \ + IUnknown_IMETHODS \ + IDropTargetHelper_METHODS +ICOM_DEFINE(IDropTargetHelper,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IDropTargetHelper_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDropTargetHelper_AddRef(p) ICOM_CALL (AddRef,p) +#define IDropTargetHelper_Release(p) ICOM_CALL (Release,p) +/*** IDropTargetHelper methods ***/ +#define IDropTargetHelper_DragEnter(p,a,b,c,d) ICOM_CALL4(DragEnter,p,a,b,c,d) +#define IDropTargetHelper_DragLeave(p) ICOM_CALL (DragLeave,p) +#define IDropTargetHelper_DragOver(p,a,b) ICOM_CALL2(DragOver,p,a,b) +#define IDropTargetHelper_Drop(p,a,b,c) ICOM_CALL3(Drop,p,a,b,c) +#define IDropTargetHelper_Show(p,a) ICOM_CALL4(Show,p,a,b,c,d) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + +#endif /* __WINE_WINE_OBJ_DRAGDROPHELPER_H */ + + + + + diff --git a/ole/uuid.c b/ole/uuid.c index 2bd1e79c92b..313608c5e84 100644 --- a/ole/uuid.c +++ b/ole/uuid.c @@ -45,6 +45,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include "shlguid.h" #include "shlobj.h" #include "wine/obj_channel.h" +#include "wine/obj_dragdrophelper.h" #include "comcat.h"