- Better implementation for GetTopindex/GetOrigin/SetIconSpacing.
[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     }
128     return This->ref;
129 }
130
131 static HRESULT WINAPI IDropTargetHelper_fnDragEnter (
132         IDropTargetHelper * iface,
133         HWND hwndTarget,
134         IDataObject* pDataObject,
135         POINT* ppt,
136         DWORD dwEffect)
137 {
138     ICOM_THIS (IDropTargetHelperImpl, iface);
139     FIXME ("(%p)->(0x%x %p %p 0x%08lx)\n", This,hwndTarget, pDataObject, ppt, dwEffect);
140     return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI IDropTargetHelper_fnDragLeave (IDropTargetHelper * iface)
144 {
145     ICOM_THIS (IDropTargetHelperImpl, iface);
146     FIXME ("(%p)->()\n", This);
147     return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI IDropTargetHelper_fnDragOver (IDropTargetHelper * iface, POINT* ppt, DWORD dwEffect)
151 {
152     ICOM_THIS (IDropTargetHelperImpl, iface);
153     FIXME ("(%p)->(%p 0x%08lx)\n", This, ppt, dwEffect);
154     return E_NOTIMPL;
155 }
156
157 static HRESULT WINAPI IDropTargetHelper_fnDrop (IDropTargetHelper * iface, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect)
158 {
159     ICOM_THIS (IDropTargetHelperImpl, iface);
160     FIXME ("(%p)->(%p %p 0x%08lx)\n", This, pDataObject, ppt, dwEffect);
161     return E_NOTIMPL;
162 }
163
164 static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL fShow)
165 {
166     ICOM_THIS (IDropTargetHelperImpl, iface);
167     FIXME ("(%p)->(%u)\n", This, fShow);
168     return E_NOTIMPL;
169 }
170
171 static ICOM_VTABLE (IDropTargetHelper) vt_IDropTargetHelper =
172 {
173         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
174         IDropTargetHelper_fnQueryInterface,
175         IDropTargetHelper_fnAddRef,
176         IDropTargetHelper_fnRelease,
177         IDropTargetHelper_fnDragEnter,
178         IDropTargetHelper_fnDragLeave,
179         IDropTargetHelper_fnDragOver,
180         IDropTargetHelper_fnDrop,
181         IDropTargetHelper_fnShow
182 };