mshtml: Added HTMLWindow2_prompt implementation.
[wine] / dlls / shell32 / dragdrophelper.c
1 /*
2  *      file system folder
3  *
4  *      Copyright 1997                  Marcus Meissner
5  *      Copyright 1998, 1999, 2002      Juergen Schmied
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24
25 #include <stdarg.h>
26 #include <string.h>
27
28 #define COBJMACROS
29
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winreg.h"
33 #include "wingdi.h"
34 #include "winuser.h"
35
36 #include "objbase.h"
37 #include "ole2.h"
38 #include "shlguid.h"
39 #include "shlobj.h"
40
41 #include "wine/debug.h"
42 #include "debughlp.h"
43
44 WINE_DEFAULT_DEBUG_CHANNEL (shell);
45
46 /***********************************************************************
47 *   IDropTargetHelper implementation
48 */
49
50 typedef struct {
51     const IDropTargetHelperVtbl *lpVtbl;
52     LONG ref;
53 } IDropTargetHelperImpl;
54
55 static const IDropTargetHelperVtbl vt_IDropTargetHelper;
56
57 #define _IUnknown_(This)          ((IUnknown*)&(This)->lpVtbl)
58 #define _IDropTargetHelper_(This) (&(This)->lpVtbl)
59
60 /**************************************************************************
61 *       IDropTargetHelper_Constructor
62 */
63 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
64 {
65     IDropTargetHelperImpl *dth;
66
67     TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
68
69     if (!ppv)
70         return E_POINTER;
71     if (pUnkOuter)
72         return CLASS_E_NOAGGREGATION;
73
74     dth = LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
75     if (!dth) return E_OUTOFMEMORY;
76
77     dth->ref = 0;
78     dth->lpVtbl = &vt_IDropTargetHelper;
79
80     if (FAILED (IUnknown_QueryInterface (_IUnknown_ (dth), riid, ppv))) {
81         IUnknown_Release (_IUnknown_ (dth));
82         return E_NOINTERFACE;
83     }
84
85     TRACE ("--(%p)\n", dth);
86     return S_OK;
87 }
88
89 /**************************************************************************
90  *      IDropTargetHelper_fnQueryInterface
91  */
92 static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * iface, REFIID riid, LPVOID * ppvObj)
93 {
94     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
95
96     TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
97
98     *ppvObj = NULL;
99
100     if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper)) {
101         *ppvObj = This;
102     }
103
104     if (*ppvObj) {
105         IUnknown_AddRef ((IUnknown *) (*ppvObj));
106         TRACE ("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
107         return S_OK;
108     }
109     FIXME ("-- Interface: E_NOINTERFACE\n");
110     return E_NOINTERFACE;
111 }
112
113 static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
114 {
115     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
116     ULONG refCount = InterlockedIncrement(&This->ref);
117
118     TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
119
120     return refCount;
121 }
122
123 static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface)
124 {
125     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
126     ULONG refCount = InterlockedDecrement(&This->ref);
127
128     TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
129
130     if (!refCount) {
131         TRACE ("-- destroying (%p)\n", This);
132         LocalFree (This);
133         return 0;
134     }
135     return refCount;
136 }
137
138 static HRESULT WINAPI IDropTargetHelper_fnDragEnter (
139         IDropTargetHelper * iface,
140         HWND hwndTarget,
141         IDataObject* pDataObject,
142         POINT* ppt,
143         DWORD dwEffect)
144 {
145     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
146     FIXME ("(%p)->(%p %p %p 0x%08x)\n", This,hwndTarget, pDataObject, ppt, dwEffect);
147     return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI IDropTargetHelper_fnDragLeave (IDropTargetHelper * iface)
151 {
152     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
153     FIXME ("(%p)->()\n", This);
154     return E_NOTIMPL;
155 }
156
157 static HRESULT WINAPI IDropTargetHelper_fnDragOver (IDropTargetHelper * iface, POINT* ppt, DWORD dwEffect)
158 {
159     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
160     FIXME ("(%p)->(%p 0x%08x)\n", This, ppt, dwEffect);
161     return E_NOTIMPL;
162 }
163
164 static HRESULT WINAPI IDropTargetHelper_fnDrop (IDropTargetHelper * iface, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect)
165 {
166     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
167     FIXME ("(%p)->(%p %p 0x%08x)\n", This, pDataObject, ppt, dwEffect);
168     return E_NOTIMPL;
169 }
170
171 static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL fShow)
172 {
173     IDropTargetHelperImpl *This = (IDropTargetHelperImpl *)iface;
174     FIXME ("(%p)->(%u)\n", This, fShow);
175     return E_NOTIMPL;
176 }
177
178 static const IDropTargetHelperVtbl vt_IDropTargetHelper =
179 {
180         IDropTargetHelper_fnQueryInterface,
181         IDropTargetHelper_fnAddRef,
182         IDropTargetHelper_fnRelease,
183         IDropTargetHelper_fnDragEnter,
184         IDropTargetHelper_fnDragLeave,
185         IDropTargetHelper_fnDragOver,
186         IDropTargetHelper_fnDrop,
187         IDropTargetHelper_fnShow
188 };