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