server: Store the mapped file descriptor in the memory view.
[wine.git] / dlls / shell32 / dragdrophelper.c
blob425ee71b9f66a4a1a4dc64647edbecab97383941
1 /*
2 * file system folder
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdarg.h>
26 #include <string.h>
28 #define COBJMACROS
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winreg.h"
33 #include "wingdi.h"
34 #include "winuser.h"
36 #include "objbase.h"
37 #include "ole2.h"
38 #include "shlguid.h"
39 #include "shlobj.h"
41 #include "wine/debug.h"
42 #include "debughlp.h"
44 WINE_DEFAULT_DEBUG_CHANNEL (shell);
46 /***********************************************************************
47 * IDropTargetHelper implementation
50 typedef struct
52 IDropTargetHelper IDropTargetHelper_iface;
53 IDragSourceHelper IDragSourceHelper_iface;
54 LONG ref;
55 } dragdrophelper;
57 static inline dragdrophelper *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
59 return CONTAINING_RECORD(iface, dragdrophelper, IDropTargetHelper_iface);
62 static inline dragdrophelper *impl_from_IDragSourceHelper(IDragSourceHelper *iface)
64 return CONTAINING_RECORD(iface, dragdrophelper, IDragSourceHelper_iface);
67 /**************************************************************************
68 * IDropTargetHelper_fnQueryInterface
70 static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * iface, REFIID riid, LPVOID * ppvObj)
72 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
74 TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
76 *ppvObj = NULL;
78 if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper))
80 *ppvObj = &This->IDropTargetHelper_iface;
82 else if (IsEqualIID (riid, &IID_IDragSourceHelper))
84 *ppvObj = &This->IDragSourceHelper_iface;
87 if (*ppvObj) {
88 IUnknown_AddRef ((IUnknown *) (*ppvObj));
89 TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
90 return S_OK;
92 FIXME ("-- Interface: E_NOINTERFACE\n");
93 return E_NOINTERFACE;
96 static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
98 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
99 ULONG refCount = InterlockedIncrement(&This->ref);
101 TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
103 return refCount;
106 static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface)
108 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
109 ULONG refCount = InterlockedDecrement(&This->ref);
111 TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
113 if (!refCount) {
114 TRACE ("-- destroying (%p)\n", This);
115 LocalFree (This);
116 return 0;
118 return refCount;
121 static HRESULT WINAPI IDropTargetHelper_fnDragEnter (
122 IDropTargetHelper * iface,
123 HWND hwndTarget,
124 IDataObject* pDataObject,
125 POINT* ppt,
126 DWORD dwEffect)
128 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
129 FIXME ("(%p)->(%p %p %p 0x%08x)\n", This,hwndTarget, pDataObject, ppt, dwEffect);
130 return E_NOTIMPL;
133 static HRESULT WINAPI IDropTargetHelper_fnDragLeave (IDropTargetHelper * iface)
135 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
136 FIXME ("(%p)->()\n", This);
137 return E_NOTIMPL;
140 static HRESULT WINAPI IDropTargetHelper_fnDragOver (IDropTargetHelper * iface, POINT* ppt, DWORD dwEffect)
142 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
143 FIXME ("(%p)->(%p 0x%08x)\n", This, ppt, dwEffect);
144 return E_NOTIMPL;
147 static HRESULT WINAPI IDropTargetHelper_fnDrop (IDropTargetHelper * iface, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect)
149 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
150 FIXME ("(%p)->(%p %p 0x%08x)\n", This, pDataObject, ppt, dwEffect);
151 return E_NOTIMPL;
154 static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL fShow)
156 dragdrophelper *This = impl_from_IDropTargetHelper(iface);
157 FIXME ("(%p)->(%u)\n", This, fShow);
158 return E_NOTIMPL;
161 static const IDropTargetHelperVtbl DropTargetHelperVtbl =
163 IDropTargetHelper_fnQueryInterface,
164 IDropTargetHelper_fnAddRef,
165 IDropTargetHelper_fnRelease,
166 IDropTargetHelper_fnDragEnter,
167 IDropTargetHelper_fnDragLeave,
168 IDropTargetHelper_fnDragOver,
169 IDropTargetHelper_fnDrop,
170 IDropTargetHelper_fnShow
173 static HRESULT WINAPI DragSourceHelper_QueryInterface (IDragSourceHelper * iface, REFIID riid, LPVOID * ppv)
175 dragdrophelper *This = impl_from_IDragSourceHelper(iface);
176 return IDropTargetHelper_fnQueryInterface(&This->IDropTargetHelper_iface, riid, ppv);
179 static ULONG WINAPI DragSourceHelper_AddRef (IDragSourceHelper * iface)
181 dragdrophelper *This = impl_from_IDragSourceHelper(iface);
182 return IDropTargetHelper_fnAddRef(&This->IDropTargetHelper_iface);
185 static ULONG WINAPI DragSourceHelper_Release (IDragSourceHelper * iface)
187 dragdrophelper *This = impl_from_IDragSourceHelper(iface);
188 return IDropTargetHelper_fnRelease(&This->IDropTargetHelper_iface);
191 static HRESULT WINAPI DragSourceHelper_InitializeFromBitmap(IDragSourceHelper *iface,
192 SHDRAGIMAGE *dragimage, IDataObject *object)
194 dragdrophelper *This = impl_from_IDragSourceHelper(iface);
196 FIXME("(%p)->(%p, %p): stub\n", This, dragimage, object);
198 return E_NOTIMPL;
201 static HRESULT WINAPI DragSourceHelper_InitializeFromWindow(IDragSourceHelper *iface, HWND hwnd,
202 POINT *pt, IDataObject *object)
204 dragdrophelper *This = impl_from_IDragSourceHelper(iface);
206 FIXME("(%p)->(%p, %s, %p): stub\n", This, hwnd, wine_dbgstr_point(pt), object);
208 return E_NOTIMPL;
211 static const IDragSourceHelperVtbl DragSourceHelperVtbl =
213 DragSourceHelper_QueryInterface,
214 DragSourceHelper_AddRef,
215 DragSourceHelper_Release,
216 DragSourceHelper_InitializeFromBitmap,
217 DragSourceHelper_InitializeFromWindow
220 /**************************************************************************
221 * IDropTargetHelper_Constructor
223 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
225 dragdrophelper *dth;
226 HRESULT hr;
228 TRACE ("outer=%p %s %p\n", pUnkOuter, shdebugstr_guid (riid), ppv);
230 if (!ppv)
231 return E_POINTER;
232 if (pUnkOuter)
233 return CLASS_E_NOAGGREGATION;
235 dth = LocalAlloc (LMEM_ZEROINIT, sizeof (dragdrophelper));
236 if (!dth) return E_OUTOFMEMORY;
238 dth->IDropTargetHelper_iface.lpVtbl = &DropTargetHelperVtbl;
239 dth->IDragSourceHelper_iface.lpVtbl = &DragSourceHelperVtbl;
240 dth->ref = 1;
242 hr = IDropTargetHelper_QueryInterface (&dth->IDropTargetHelper_iface, riid, ppv);
243 IDropTargetHelper_Release (&dth->IDropTargetHelper_iface);
245 return hr;