explorerframe: Add classfactory implementation.
[wine.git] / dlls / explorerframe / nstc.c
blob5c25d8c8ddb35329d7e269505a2999e837689686
1 /*
2 * NamespaceTreeControl implementation.
4 * Copyright 2010 David Hedberg
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.
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.
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
21 #include <stdarg.h>
23 #define COBJMACROS
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
27 #include "winerror.h"
28 #include "windef.h"
29 #include "winbase.h"
31 #include "wine/debug.h"
33 #include "explorerframe_main.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(nstc);
37 typedef struct {
38 const INameSpaceTreeControl2Vtbl *lpVtbl;
39 LONG ref;
40 } NSTC2Impl;
42 /**************************************************************************
43 * INameSpaceTreeControl2 Implementation
45 static HRESULT WINAPI NSTC2_fnQueryInterface(INameSpaceTreeControl2* iface,
46 REFIID riid,
47 void **ppvObject)
49 NSTC2Impl *This = (NSTC2Impl*)iface;
50 TRACE("%p (%s, %p)\n", This, debugstr_guid(riid), ppvObject);
52 *ppvObject = NULL;
53 if(IsEqualIID(riid, &IID_INameSpaceTreeControl2) ||
54 IsEqualIID(riid, &IID_INameSpaceTreeControl) ||
55 IsEqualIID(riid, &IID_IUnknown))
57 *ppvObject = This;
60 if(*ppvObject)
62 IUnknown_AddRef((IUnknown*)*ppvObject);
63 return S_OK;
66 return E_NOINTERFACE;
69 static ULONG WINAPI NSTC2_fnAddRef(INameSpaceTreeControl2* iface)
71 NSTC2Impl *This = (NSTC2Impl*)iface;
72 LONG ref = InterlockedIncrement(&This->ref);
74 TRACE("%p - ref %d\n", This, ref);
76 return ref;
79 static ULONG WINAPI NSTC2_fnRelease(INameSpaceTreeControl2* iface)
81 NSTC2Impl *This = (NSTC2Impl*)iface;
82 LONG ref = InterlockedDecrement(&This->ref);
84 TRACE("%p - ref: %d\n", This, ref);
86 if(!ref)
88 TRACE("Freeing.\n");
89 HeapFree(GetProcessHeap(), 0, This);
90 EFRAME_UnlockModule();
91 return 0;
94 return ref;
97 static HRESULT WINAPI NSTC2_fnInitialize(INameSpaceTreeControl2* iface,
98 HWND hwndParent,
99 RECT *prc,
100 NSTCSTYLE nstcsFlags)
102 NSTC2Impl *This = (NSTC2Impl*)iface;
103 FIXME("stub, %p (%p, %p, %x)\n", This, hwndParent, prc, nstcsFlags);
104 return E_NOTIMPL;
107 static HRESULT WINAPI NSTC2_fnTreeAdvise(INameSpaceTreeControl2* iface,
108 IUnknown *punk,
109 DWORD *pdwCookie)
111 NSTC2Impl *This = (NSTC2Impl*)iface;
112 FIXME("stub, %p (%p, %p)\n", This, punk, pdwCookie);
113 return E_NOTIMPL;
116 static HRESULT WINAPI NSTC2_fnTreeUnadvise(INameSpaceTreeControl2* iface,
117 DWORD dwCookie)
119 NSTC2Impl *This = (NSTC2Impl*)iface;
120 FIXME("stub, %p (%x)\n", This, dwCookie);
121 return E_NOTIMPL;
124 static HRESULT WINAPI NSTC2_fnInsertRoot(INameSpaceTreeControl2* iface,
125 int iIndex,
126 IShellItem *psiRoot,
127 SHCONTF grfEnumFlags,
128 NSTCROOTSTYLE grfRootStyle,
129 IShellItemFilter *pif)
131 NSTC2Impl *This = (NSTC2Impl*)iface;
132 FIXME("stub, %p, %p, %x, %x, %p\n", This, psiRoot, grfEnumFlags, grfRootStyle, pif);
133 return E_NOTIMPL;
136 static HRESULT WINAPI NSTC2_fnAppendRoot(INameSpaceTreeControl2* iface,
137 IShellItem *psiRoot,
138 SHCONTF grfEnumFlags,
139 NSTCROOTSTYLE grfRootStyle,
140 IShellItemFilter *pif)
142 NSTC2Impl *This = (NSTC2Impl*)iface;
143 FIXME("stub, %p, %p, %x, %x, %p\n",
144 This, psiRoot, grfEnumFlags, grfRootStyle, pif);
145 return E_NOTIMPL;
148 static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface,
149 IShellItem *psiRoot)
151 NSTC2Impl *This = (NSTC2Impl*)iface;
152 FIXME("stub, %p (%p)\n", This, psiRoot);
153 return E_NOTIMPL;
156 static HRESULT WINAPI NSTC2_fnRemoveAllRoots(INameSpaceTreeControl2* iface)
158 NSTC2Impl *This = (NSTC2Impl*)iface;
159 FIXME("stub, %p\n", This);
160 return E_NOTIMPL;
163 static HRESULT WINAPI NSTC2_fnGetRootItems(INameSpaceTreeControl2* iface,
164 IShellItemArray **ppsiaRootItems)
166 NSTC2Impl *This = (NSTC2Impl*)iface;
167 FIXME("stub, %p (%p)\n", This, ppsiaRootItems);
168 return E_NOTIMPL;
171 static HRESULT WINAPI NSTC2_fnSetItemState(INameSpaceTreeControl2* iface,
172 IShellItem *psi,
173 NSTCITEMSTATE nstcisMask,
174 NSTCITEMSTATE nstcisFlags)
176 NSTC2Impl *This = (NSTC2Impl*)iface;
177 FIXME("stub, %p (%p, %x, %x)\n", This, psi, nstcisMask, nstcisFlags);
178 return E_NOTIMPL;
181 static HRESULT WINAPI NSTC2_fnGetItemState(INameSpaceTreeControl2* iface,
182 IShellItem *psi,
183 NSTCITEMSTATE nstcisMask,
184 NSTCITEMSTATE *pnstcisFlags)
186 NSTC2Impl *This = (NSTC2Impl*)iface;
187 FIXME("stub, %p (%p, %x, %p)\n", This, psi, nstcisMask, pnstcisFlags);
188 return E_NOTIMPL;
191 static HRESULT WINAPI NSTC2_fnGetSelectedItems(INameSpaceTreeControl2* iface,
192 IShellItemArray **psiaItems)
194 NSTC2Impl *This = (NSTC2Impl*)iface;
195 FIXME("stub, %p (%p)\n", This, psiaItems);
196 return E_NOTIMPL;
199 static HRESULT WINAPI NSTC2_fnGetItemCustomState(INameSpaceTreeControl2* iface,
200 IShellItem *psi,
201 int *piStateNumber)
203 NSTC2Impl *This = (NSTC2Impl*)iface;
204 FIXME("stub, %p (%p, %p)\n", This, psi, piStateNumber);
205 return E_NOTIMPL;
208 static HRESULT WINAPI NSTC2_fnSetItemCustomState(INameSpaceTreeControl2* iface,
209 IShellItem *psi,
210 int iStateNumber)
212 NSTC2Impl *This = (NSTC2Impl*)iface;
213 FIXME("stub, %p (%p, %d)\n", This, psi, iStateNumber);
214 return E_NOTIMPL;
217 static HRESULT WINAPI NSTC2_fnEnsureItemVisible(INameSpaceTreeControl2* iface,
218 IShellItem *psi)
220 NSTC2Impl *This = (NSTC2Impl*)iface;
221 FIXME("stub, %p (%p)\n", This, psi);
222 return E_NOTIMPL;
225 static HRESULT WINAPI NSTC2_fnSetTheme(INameSpaceTreeControl2* iface,
226 LPCWSTR pszTheme)
228 NSTC2Impl *This = (NSTC2Impl*)iface;
229 FIXME("stub, %p (%p)\n", This, pszTheme);
230 return E_NOTIMPL;
233 static HRESULT WINAPI NSTC2_fnGetNextItem(INameSpaceTreeControl2* iface,
234 IShellItem *psi,
235 NSTCGNI nstcgi,
236 IShellItem **ppsiNext)
238 NSTC2Impl *This = (NSTC2Impl*)iface;
239 FIXME("stub, %p (%p, %x, %p)\n", This, psi, nstcgi, ppsiNext);
240 return E_NOTIMPL;
243 static HRESULT WINAPI NSTC2_fnHitTest(INameSpaceTreeControl2* iface,
244 POINT *ppt,
245 IShellItem **ppsiOut)
247 NSTC2Impl *This = (NSTC2Impl*)iface;
248 FIXME("stub, %p (%p, %p)\n", This, ppsiOut, ppt);
249 return E_NOTIMPL;
252 static HRESULT WINAPI NSTC2_fnGetItemRect(INameSpaceTreeControl2* iface,
253 IShellItem *psi,
254 RECT *prect)
256 NSTC2Impl *This = (NSTC2Impl*)iface;
257 FIXME("stub, %p (%p, %p)\n", This, psi, prect);
258 return E_NOTIMPL;
261 static HRESULT WINAPI NSTC2_fnCollapseAll(INameSpaceTreeControl2* iface)
263 NSTC2Impl *This = (NSTC2Impl*)iface;
264 FIXME("stub, %p\n", This);
265 return E_NOTIMPL;
268 static HRESULT WINAPI NSTC2_fnSetControlStyle(INameSpaceTreeControl2* iface,
269 NSTCSTYLE nstcsMask,
270 NSTCSTYLE nstcsStyle)
272 NSTC2Impl *This = (NSTC2Impl*)iface;
273 FIXME("stub, %p (%x, %x)\n", This, nstcsMask, nstcsStyle);
274 return E_NOTIMPL;
277 static HRESULT WINAPI NSTC2_fnGetControlStyle(INameSpaceTreeControl2* iface,
278 NSTCSTYLE nstcsMask,
279 NSTCSTYLE *pnstcsStyle)
281 NSTC2Impl *This = (NSTC2Impl*)iface;
282 FIXME("stub, %p (%x, %p)\n", This, nstcsMask, pnstcsStyle);
283 return E_NOTIMPL;
286 static HRESULT WINAPI NSTC2_fnSetControlStyle2(INameSpaceTreeControl2* iface,
287 NSTCSTYLE2 nstcsMask,
288 NSTCSTYLE2 nstcsStyle)
290 NSTC2Impl *This = (NSTC2Impl*)iface;
291 FIXME("stub, %p (%x, %x)\n", This, nstcsMask, nstcsStyle);
292 return E_NOTIMPL;
295 static HRESULT WINAPI NSTC2_fnGetControlStyle2(INameSpaceTreeControl2* iface,
296 NSTCSTYLE2 nstcsMask,
297 NSTCSTYLE2 *pnstcsStyle)
299 NSTC2Impl *This = (NSTC2Impl*)iface;
300 FIXME("stub, %p (%x, %p)\n", This, nstcsMask, pnstcsStyle);
301 return E_NOTIMPL;
304 static const INameSpaceTreeControl2Vtbl vt_INameSpaceTreeControl2 = {
305 NSTC2_fnQueryInterface,
306 NSTC2_fnAddRef,
307 NSTC2_fnRelease,
308 NSTC2_fnInitialize,
309 NSTC2_fnTreeAdvise,
310 NSTC2_fnTreeUnadvise,
311 NSTC2_fnAppendRoot,
312 NSTC2_fnInsertRoot,
313 NSTC2_fnRemoveRoot,
314 NSTC2_fnRemoveAllRoots,
315 NSTC2_fnGetRootItems,
316 NSTC2_fnSetItemState,
317 NSTC2_fnGetItemState,
318 NSTC2_fnGetSelectedItems,
319 NSTC2_fnGetItemCustomState,
320 NSTC2_fnSetItemCustomState,
321 NSTC2_fnEnsureItemVisible,
322 NSTC2_fnSetTheme,
323 NSTC2_fnGetNextItem,
324 NSTC2_fnHitTest,
325 NSTC2_fnGetItemRect,
326 NSTC2_fnCollapseAll,
327 NSTC2_fnSetControlStyle,
328 NSTC2_fnGetControlStyle,
329 NSTC2_fnSetControlStyle2,
330 NSTC2_fnGetControlStyle2
333 HRESULT NamespaceTreeControl_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
335 NSTC2Impl *nstc;
336 HRESULT ret;
338 TRACE ("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppv);
340 if(!ppv)
341 return E_POINTER;
342 if(pUnkOuter)
343 return CLASS_E_NOAGGREGATION;
345 EFRAME_LockModule();
347 nstc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NSTC2Impl));
348 nstc->ref = 1;
349 nstc->lpVtbl = &vt_INameSpaceTreeControl2;
351 ret = INameSpaceTreeControl_QueryInterface((INameSpaceTreeControl*)nstc, riid, ppv);
352 INameSpaceTreeControl_Release((INameSpaceTreeControl*)nstc);
354 TRACE("--(%p)\n", ppv);
355 return ret;