shell32: Add IExplorerBrowser interface stub.
[wine] / dlls / shell32 / ebrowser.c
1 /*
2  * ExplorerBrowser Control implementation.
3  *
4  * Copyright 2010 David Hedberg
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22
23 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26
27 #include "winerror.h"
28 #include "windef.h"
29 #include "winbase.h"
30
31 #include "wine/debug.h"
32 #include "debughlp.h"
33
34 WINE_DEFAULT_DEBUG_CHANNEL(shell);
35
36 typedef struct _ExplorerBrowserImpl {
37     const IExplorerBrowserVtbl *lpVtbl;
38     LONG ref;
39     BOOL destroyed;
40 } ExplorerBrowserImpl;
41
42 /**************************************************************************
43  * IExplorerBrowser Implementation
44  */
45 static HRESULT WINAPI IExplorerBrowser_fnQueryInterface(IExplorerBrowser *iface,
46                                                         REFIID riid, void **ppvObject)
47 {
48     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
49     TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvObject);
50
51     *ppvObject = NULL;
52     if(IsEqualIID(riid, &IID_IExplorerBrowser) ||
53        IsEqualIID(riid, &IID_IUnknown))
54     {
55         *ppvObject = This;
56     }
57
58     if(*ppvObject)
59     {
60         IUnknown_AddRef((IUnknown*)*ppvObject);
61         return S_OK;
62     }
63
64     return E_NOINTERFACE;
65 }
66
67 static ULONG WINAPI IExplorerBrowser_fnAddRef(IExplorerBrowser *iface)
68 {
69     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
70     LONG ref = InterlockedIncrement(&This->ref);
71     TRACE("%p - ref %d\n", This, ref);
72
73     return ref;
74 }
75
76 static ULONG WINAPI IExplorerBrowser_fnRelease(IExplorerBrowser *iface)
77 {
78     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
79     LONG ref = InterlockedDecrement(&This->ref);
80     TRACE("%p - ref %d\n", This, ref);
81
82     if(!ref)
83     {
84         TRACE("Freeing.\n");
85
86         if(!This->destroyed)
87             IExplorerBrowser_Destroy(iface);
88
89         HeapFree(GetProcessHeap(), 0, This);
90         return 0;
91     }
92
93     return ref;
94 }
95
96 static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface,
97                                                     HWND hwndParent, const RECT *prc,
98                                                     const FOLDERSETTINGS *pfs)
99 {
100     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
101     TRACE("%p (%p, %p, %p)\n", This, hwndParent, prc, pfs);
102
103     return S_OK;
104 }
105
106 static HRESULT WINAPI IExplorerBrowser_fnDestroy(IExplorerBrowser *iface)
107 {
108     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
109     TRACE("%p\n", This);
110
111     This->destroyed = TRUE;
112
113     return S_OK;
114 }
115
116 static HRESULT WINAPI IExplorerBrowser_fnSetRect(IExplorerBrowser *iface,
117                                                  HDWP *phdwp, RECT rcBrowser)
118 {
119     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
120     FIXME("stub, %p (%p, %s)\n", This, phdwp, wine_dbgstr_rect(&rcBrowser));
121
122     return E_NOTIMPL;
123 }
124
125 static HRESULT WINAPI IExplorerBrowser_fnSetPropertyBag(IExplorerBrowser *iface,
126                                                         LPCWSTR pszPropertyBag)
127 {
128     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
129     FIXME("stub, %p (%s)\n", This, debugstr_w(pszPropertyBag));
130
131     return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI IExplorerBrowser_fnSetEmptyText(IExplorerBrowser *iface,
135                                                       LPCWSTR pszEmptyText)
136 {
137     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
138     FIXME("stub, %p (%s)\n", This, debugstr_w(pszEmptyText));
139
140     return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI IExplorerBrowser_fnSetFolderSettings(IExplorerBrowser *iface,
144                                                            const FOLDERSETTINGS *pfs)
145 {
146     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
147     FIXME("stub, %p (%p)\n", This, pfs);
148
149     return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface,
153                                                 IExplorerBrowserEvents *psbe,
154                                                 DWORD *pdwCookie)
155 {
156     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
157     FIXME("stub, %p (%p, %p)\n", This, psbe, pdwCookie);
158
159     return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI IExplorerBrowser_fnUnadvise(IExplorerBrowser *iface,
163                                                   DWORD dwCookie)
164 {
165     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
166     FIXME("stub, %p (0x%x)\n", This, dwCookie);
167
168     return E_NOTIMPL;
169 }
170
171 static HRESULT WINAPI IExplorerBrowser_fnSetOptions(IExplorerBrowser *iface,
172                                                     EXPLORER_BROWSER_OPTIONS dwFlag)
173 {
174     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
175     FIXME("stub, %p (0x%x)\n", This, dwFlag);
176
177     return E_NOTIMPL;
178 }
179
180 static HRESULT WINAPI IExplorerBrowser_fnGetOptions(IExplorerBrowser *iface,
181                                                     EXPLORER_BROWSER_OPTIONS *pdwFlag)
182 {
183     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
184     FIXME("stub, %p (%p)\n", This, pdwFlag);
185
186     return E_NOTIMPL;
187 }
188
189 static HRESULT WINAPI IExplorerBrowser_fnBrowseToIDList(IExplorerBrowser *iface,
190                                                         PCUIDLIST_RELATIVE pidl,
191                                                         UINT uFlags)
192 {
193     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
194     FIXME("stub, %p (%p, 0x%x)\n", This, pidl, uFlags);
195
196     return E_NOTIMPL;
197 }
198
199 static HRESULT WINAPI IExplorerBrowser_fnBrowseToObject(IExplorerBrowser *iface,
200                                                         IUnknown *punk, UINT uFlags)
201 {
202     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
203     FIXME("stub, %p (%p, 0x%x)\n", This, punk, uFlags);
204
205     return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI IExplorerBrowser_fnFillFromObject(IExplorerBrowser *iface,
209                                                         IUnknown *punk,
210                                                         EXPLORER_BROWSER_FILL_FLAGS dwFlags)
211 {
212     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
213     FIXME("stub, %p (%p, 0x%x)\n", This, punk, dwFlags);
214
215     return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI IExplorerBrowser_fnRemoveAll(IExplorerBrowser *iface)
219 {
220     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
221     FIXME("stub, %p\n", This);
222
223     return E_NOTIMPL;
224 }
225
226 static HRESULT WINAPI IExplorerBrowser_fnGetCurrentView(IExplorerBrowser *iface,
227                                                         REFIID riid, void **ppv)
228 {
229     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
230     FIXME("stub, %p (%s, %p)\n", This, shdebugstr_guid(riid), ppv);
231
232     *ppv = NULL;
233     return E_FAIL;
234 }
235
236 static const IExplorerBrowserVtbl vt_IExplorerBrowser =
237 {
238     IExplorerBrowser_fnQueryInterface,
239     IExplorerBrowser_fnAddRef,
240     IExplorerBrowser_fnRelease,
241     IExplorerBrowser_fnInitialize,
242     IExplorerBrowser_fnDestroy,
243     IExplorerBrowser_fnSetRect,
244     IExplorerBrowser_fnSetPropertyBag,
245     IExplorerBrowser_fnSetEmptyText,
246     IExplorerBrowser_fnSetFolderSettings,
247     IExplorerBrowser_fnAdvise,
248     IExplorerBrowser_fnUnadvise,
249     IExplorerBrowser_fnSetOptions,
250     IExplorerBrowser_fnGetOptions,
251     IExplorerBrowser_fnBrowseToIDList,
252     IExplorerBrowser_fnBrowseToObject,
253     IExplorerBrowser_fnFillFromObject,
254     IExplorerBrowser_fnRemoveAll,
255     IExplorerBrowser_fnGetCurrentView
256 };
257
258 HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
259 {
260     ExplorerBrowserImpl *eb;
261     HRESULT ret;
262
263     TRACE("%p %s %p\n", pUnkOuter, shdebugstr_guid (riid), ppv);
264
265     if(!ppv)
266         return E_POINTER;
267     if(pUnkOuter)
268         return CLASS_E_NOAGGREGATION;
269
270     eb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ExplorerBrowserImpl));
271     eb->ref = 1;
272     eb->lpVtbl = &vt_IExplorerBrowser;
273
274     ret = IExplorerBrowser_QueryInterface((IExplorerBrowser*)eb, riid, ppv);
275     IExplorerBrowser_Release((IExplorerBrowser*)eb);
276
277     TRACE("--(%p)\n", ppv);
278     return ret;
279 }