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