blob: 5666926efdb25b683b7672c190c84c0ae93e1e8c [file] [log] [blame]
David Hedbergd6626962010-08-20 07:45:56 +02001/*
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
David Hedbergb88c3e22010-08-24 10:56:19 +020031#include "wine/list.h"
David Hedbergd6626962010-08-20 07:45:56 +020032#include "wine/debug.h"
33#include "debughlp.h"
34
David Hedberge4e62e72010-08-20 07:45:59 +020035#include "shell32_main.h"
David Hedberg73100ce2010-08-24 10:56:21 +020036#include "pidl.h"
David Hedberge4e62e72010-08-20 07:45:59 +020037
David Hedbergd6626962010-08-20 07:45:56 +020038WINE_DEFAULT_DEBUG_CHANNEL(shell);
39
David Hedbergb88c3e22010-08-24 10:56:19 +020040typedef struct _event_client {
41 struct list entry;
42 IExplorerBrowserEvents *pebe;
43 DWORD cookie;
44} event_client;
45
David Hedbergfdccbd92010-08-25 15:24:33 +020046typedef struct _travellog_entry {
47 struct list entry;
48 LPITEMIDLIST pidl;
49} travellog_entry;
50
David Hedbergd6626962010-08-20 07:45:56 +020051typedef struct _ExplorerBrowserImpl {
52 const IExplorerBrowserVtbl *lpVtbl;
David Hedberg1efc5402010-08-20 07:45:58 +020053 const IShellBrowserVtbl *lpsbVtbl;
David Hedberg59965f92010-08-25 15:24:34 +020054 const ICommDlgBrowser3Vtbl *lpcdb3Vtbl;
David Hedberg56b8d5d2010-08-25 15:24:36 +020055 const IObjectWithSiteVtbl *lpowsVtbl;
David Hedberg20952602010-08-26 13:58:19 +020056 const INameSpaceTreeControlEventsVtbl *lpnstceVtbl;
David Hedbergd6626962010-08-20 07:45:56 +020057 LONG ref;
58 BOOL destroyed;
David Hedberge4e62e72010-08-20 07:45:59 +020059
60 HWND hwnd_main;
David Hedbergd17d78e2010-08-23 12:55:18 +020061 HWND hwnd_sv;
David Hedberg9c0260f2010-08-23 12:55:17 +020062
63 EXPLORER_BROWSER_OPTIONS eb_options;
David Hedberg270845d2010-08-23 12:55:19 +020064 FOLDERSETTINGS fs;
David Hedbergd17d78e2010-08-23 12:55:18 +020065
David Hedbergb88c3e22010-08-24 10:56:19 +020066 struct list event_clients;
67 DWORD events_next_cookie;
David Hedbergfdccbd92010-08-25 15:24:33 +020068 struct list travellog;
69 travellog_entry *travellog_cursor;
70 int travellog_count;
David Hedbergb88c3e22010-08-24 10:56:19 +020071
David Hedbergd17d78e2010-08-23 12:55:18 +020072 IShellView *psv;
73 RECT sv_rc;
David Hedberg73100ce2010-08-24 10:56:21 +020074 LPITEMIDLIST current_pidl;
David Hedberg56b8d5d2010-08-25 15:24:36 +020075
76 IUnknown *punk_site;
David Hedbergddcd6192010-08-26 13:58:16 +020077 ICommDlgBrowser *pcdb_site;
78 ICommDlgBrowser2 *pcdb2_site;
79 ICommDlgBrowser3 *pcdb3_site;
David Hedberg555c5192010-08-26 13:58:17 +020080 IExplorerPaneVisibility *pepv_site;
David Hedbergd6626962010-08-20 07:45:56 +020081} ExplorerBrowserImpl;
82
83/**************************************************************************
David Hedbergb88c3e22010-08-24 10:56:19 +020084 * Event functions.
85 */
86static void events_unadvise_all(ExplorerBrowserImpl *This)
87{
88 event_client *client, *curs;
89 TRACE("%p\n", This);
90
91 LIST_FOR_EACH_ENTRY_SAFE(client, curs, &This->event_clients, event_client, entry)
92 {
93 TRACE("Removing %p\n", client);
94 list_remove(&client->entry);
95 IExplorerBrowserEvents_Release(client->pebe);
96 HeapFree(GetProcessHeap(), 0, client);
97 }
98}
99
David Hedberg73100ce2010-08-24 10:56:21 +0200100static HRESULT events_NavigationPending(ExplorerBrowserImpl *This, PCIDLIST_ABSOLUTE pidl)
101{
102 event_client *cursor;
103 HRESULT hres = S_OK;
104
105 TRACE("%p\n", This);
106
107 LIST_FOR_EACH_ENTRY(cursor, &This->event_clients, event_client, entry)
108 {
109 TRACE("Notifying %p\n", cursor);
110 hres = IExplorerBrowserEvents_OnNavigationPending(cursor->pebe, pidl);
111
112 /* If this failed for any reason, the browsing is supposed to be aborted. */
113 if(FAILED(hres))
114 break;
115 }
116
117 return hres;
118}
119
120static void events_NavigationComplete(ExplorerBrowserImpl *This, PCIDLIST_ABSOLUTE pidl)
121{
122 event_client *cursor;
123
124 TRACE("%p\n", This);
125
126 LIST_FOR_EACH_ENTRY(cursor, &This->event_clients, event_client, entry)
127 {
128 TRACE("Notifying %p\n", cursor);
129 IExplorerBrowserEvents_OnNavigationComplete(cursor->pebe, pidl);
130 }
131}
132
133static void events_NavigationFailed(ExplorerBrowserImpl *This, PCIDLIST_ABSOLUTE pidl)
134{
135 event_client *cursor;
136
137 TRACE("%p\n", This);
138
139 LIST_FOR_EACH_ENTRY(cursor, &This->event_clients, event_client, entry)
140 {
141 TRACE("Notifying %p\n", cursor);
142 IExplorerBrowserEvents_OnNavigationFailed(cursor->pebe, pidl);
143 }
144}
145
146static void events_ViewCreated(ExplorerBrowserImpl *This, IShellView *psv)
147{
148 event_client *cursor;
149
150 TRACE("%p\n", This);
151
152 LIST_FOR_EACH_ENTRY(cursor, &This->event_clients, event_client, entry)
153 {
154 TRACE("Notifying %p\n", cursor);
155 IExplorerBrowserEvents_OnViewCreated(cursor->pebe, psv);
156 }
157}
158
David Hedbergb88c3e22010-08-24 10:56:19 +0200159/**************************************************************************
David Hedbergfdccbd92010-08-25 15:24:33 +0200160 * Travellog functions.
161 */
162static void travellog_remove_entry(ExplorerBrowserImpl *This, travellog_entry *entry)
163{
164 TRACE("Removing %p\n", entry);
165
166 list_remove(&entry->entry);
167 HeapFree(GetProcessHeap(), 0, entry);
168 This->travellog_count--;
169}
170
171static void travellog_remove_all_entries(ExplorerBrowserImpl *This)
172{
173 travellog_entry *cursor, *cursor2;
174 TRACE("%p\n", This);
175
176 LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &This->travellog, travellog_entry, entry)
177 travellog_remove_entry(This, cursor);
178
179 This->travellog_cursor = NULL;
180}
181
182static void travellog_add_entry(ExplorerBrowserImpl *This, LPITEMIDLIST pidl)
183{
184 travellog_entry *new, *cursor, *cursor2;
185 TRACE("%p (old count %d)\n", pidl, This->travellog_count);
186
187 /* Replace the old tail, if any, with the new entry */
188 if(This->travellog_cursor)
189 {
190 LIST_FOR_EACH_ENTRY_SAFE_REV(cursor, cursor2, &This->travellog, travellog_entry, entry)
191 {
192 if(cursor == This->travellog_cursor)
193 break;
194 travellog_remove_entry(This, cursor);
195 }
196 }
197
198 /* Create and add the new entry */
199 new = HeapAlloc(GetProcessHeap(), 0, sizeof(travellog_entry));
200 new->pidl = ILClone(pidl);
201 list_add_tail(&This->travellog, &new->entry);
202 This->travellog_cursor = new;
203 This->travellog_count++;
204
205 /* Remove the first few entries if the size limit is reached. */
206 if(This->travellog_count > 200)
207 {
208 UINT i = 0;
209 LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &This->travellog, travellog_entry, entry)
210 {
211 if(i++ > 10)
212 break;
213 travellog_remove_entry(This, cursor);
214 }
215 }
216}
217
218static LPCITEMIDLIST travellog_go_back(ExplorerBrowserImpl *This)
219{
220 travellog_entry *prev;
221 TRACE("%p, %p\n", This, This->travellog_cursor);
222
223 if(!This->travellog_cursor)
224 return NULL;
225
226 prev = LIST_ENTRY(list_prev(&This->travellog, &This->travellog_cursor->entry),
227 travellog_entry, entry);
228 if(!prev)
229 return NULL;
230
231 This->travellog_cursor = prev;
232 return prev->pidl;
233}
234
235static LPCITEMIDLIST travellog_go_forward(ExplorerBrowserImpl *This)
236{
237 travellog_entry *next;
238 TRACE("%p, %p\n", This, This->travellog_cursor);
239
240 if(!This->travellog_cursor)
241 return NULL;
242
243 next = LIST_ENTRY(list_next(&This->travellog, &This->travellog_cursor->entry),
244 travellog_entry, entry);
245 if(!next)
246 return NULL;
247
248 This->travellog_cursor = next;
249 return next->pidl;
250}
251
252/**************************************************************************
David Hedbergd17d78e2010-08-23 12:55:18 +0200253 * Helper functions
254 */
255static void update_layout(ExplorerBrowserImpl *This)
256{
257 RECT rc;
258 TRACE("%p\n", This);
259
260 GetClientRect(This->hwnd_main, &rc);
261 CopyRect(&This->sv_rc, &rc);
262}
263
264static void size_panes(ExplorerBrowserImpl *This)
265{
266 MoveWindow(This->hwnd_sv,
267 This->sv_rc.left, This->sv_rc.top,
268 This->sv_rc.right - This->sv_rc.left, This->sv_rc.bottom - This->sv_rc.top,
269 TRUE);
270}
271
David Hedberg270845d2010-08-23 12:55:19 +0200272static HRESULT change_viewmode(ExplorerBrowserImpl *This, UINT viewmode)
273{
274 IFolderView *pfv;
275 HRESULT hr;
276
277 if(!This->psv)
278 return E_FAIL;
279
280 hr = IShellView_QueryInterface(This->psv, &IID_IFolderView, (void*)&pfv);
281 if(SUCCEEDED(hr))
282 {
283 hr = IFolderView_SetCurrentViewMode(pfv, This->fs.ViewMode);
284 IFolderView_Release(pfv);
285 }
286
287 return hr;
288}
289
David Hedberg73100ce2010-08-24 10:56:21 +0200290static HRESULT create_new_shellview(ExplorerBrowserImpl *This, IShellItem *psi)
291{
292 IShellBrowser *psb = (IShellBrowser*)&This->lpsbVtbl;
293 IShellFolder *psf;
294 IShellView *psv;
295 HWND hwnd_new;
296 HRESULT hr;
297
298 TRACE("%p, %p\n", This, psi);
299
300 hr = IShellItem_BindToHandler(psi, NULL, &BHID_SFObject, &IID_IShellFolder, (void**)&psf);
301 if(SUCCEEDED(hr))
302 {
303 hr = IShellFolder_CreateViewObject(psf, This->hwnd_main, &IID_IShellView, (void**)&psv);
304 if(SUCCEEDED(hr))
305 {
306 if(This->hwnd_sv)
307 {
308 IShellView_DestroyViewWindow(This->psv);
309 This->hwnd_sv = NULL;
310 }
311
312 hr = IShellView_CreateViewWindow(psv, This->psv, &This->fs, psb, &This->sv_rc, &hwnd_new);
313 if(SUCCEEDED(hr))
314 {
315 /* Replace the old shellview */
316 if(This->psv) IShellView_Release(This->psv);
317
318 This->psv = psv;
319 This->hwnd_sv = hwnd_new;
320 events_ViewCreated(This, psv);
321 }
322 else
323 {
324 ERR("CreateViewWindow failed (0x%x)\n", hr);
325 IShellView_Release(psv);
326 }
327 }
328 else
329 ERR("CreateViewObject failed (0x%x)\n", hr);
330
331 IShellFolder_Release(psf);
332 }
333 else
334 ERR("SI::BindToHandler failed (0x%x)\n", hr);
335
336 return hr;
337}
338
David Hedberg56b8d5d2010-08-25 15:24:36 +0200339static void get_interfaces_from_site(ExplorerBrowserImpl *This)
340{
341 IServiceProvider *psp;
342 HRESULT hr;
343
344 /* Calling this with This->punk_site set to NULL should properly
345 * release any previously fetched interfaces.
346 */
347
David Hedbergddcd6192010-08-26 13:58:16 +0200348 if(This->pcdb_site)
David Hedberg56b8d5d2010-08-25 15:24:36 +0200349 {
David Hedbergddcd6192010-08-26 13:58:16 +0200350 IUnknown_Release(This->pcdb_site);
351 if(This->pcdb2_site) IUnknown_Release(This->pcdb2_site);
352 if(This->pcdb3_site) IUnknown_Release(This->pcdb3_site);
353
354 This->pcdb_site = NULL;
355 This->pcdb2_site = NULL;
356 This->pcdb3_site = NULL;
David Hedberg56b8d5d2010-08-25 15:24:36 +0200357 }
David Hedbergddcd6192010-08-26 13:58:16 +0200358
David Hedberg555c5192010-08-26 13:58:17 +0200359 if(This->pepv_site)
360 {
361 IExplorerPaneVisibility_Release(This->pepv_site);
362 This->pepv_site = NULL;
363 }
364
David Hedbergddcd6192010-08-26 13:58:16 +0200365 if(!This->punk_site)
366 return;
367
368 hr = IUnknown_QueryInterface(This->punk_site, &IID_IServiceProvider, (void**)&psp);
369 if(FAILED(hr))
370 {
371 ERR("Failed to get IServiceProvider from site.\n");
372 return;
373 }
374
375 /* ICommDlgBrowser */
376 IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame, &IID_ICommDlgBrowser,
377 (void**)&This->pcdb_site);
378 IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame, &IID_ICommDlgBrowser2,
379 (void**)&This->pcdb2_site);
380 IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame, &IID_ICommDlgBrowser3,
381 (void**)&This->pcdb3_site);
382
David Hedberg555c5192010-08-26 13:58:17 +0200383 /* IExplorerPaneVisibility */
384 IServiceProvider_QueryService(psp, &SID_ExplorerPaneVisibility, &IID_IExplorerPaneVisibility,
385 (void**)&This->pepv_site);
386
David Hedbergddcd6192010-08-26 13:58:16 +0200387 IServiceProvider_Release(psp);
David Hedberg56b8d5d2010-08-25 15:24:36 +0200388}
389
David Hedbergddcd6192010-08-26 13:58:16 +0200390
David Hedbergd17d78e2010-08-23 12:55:18 +0200391/**************************************************************************
David Hedberge4e62e72010-08-20 07:45:59 +0200392 * Main window related functions.
393 */
394static LRESULT main_on_wm_create(HWND hWnd, CREATESTRUCTW *crs)
395{
396 ExplorerBrowserImpl *This = crs->lpCreateParams;
397 TRACE("%p\n", This);
398
399 SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LPARAM)This);
400 This->hwnd_main = hWnd;
401
402 return TRUE;
403}
404
David Hedbergd17d78e2010-08-23 12:55:18 +0200405static LRESULT main_on_wm_size(ExplorerBrowserImpl *This)
406{
407 update_layout(This);
408 size_panes(This);
409
410 return TRUE;
411}
412
David Hedberge4e62e72010-08-20 07:45:59 +0200413static LRESULT CALLBACK main_wndproc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
414{
David Hedbergd17d78e2010-08-23 12:55:18 +0200415 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
416
David Hedberge4e62e72010-08-20 07:45:59 +0200417 switch(uMessage)
418 {
419 case WM_CREATE: return main_on_wm_create(hWnd, (CREATESTRUCTW*)lParam);
David Hedbergd17d78e2010-08-23 12:55:18 +0200420 case WM_SIZE: return main_on_wm_size(This);
David Hedberge4e62e72010-08-20 07:45:59 +0200421 default: return DefWindowProcW(hWnd, uMessage, wParam, lParam);
422 }
423
424 return 0;
425}
426
427/**************************************************************************
David Hedbergd6626962010-08-20 07:45:56 +0200428 * IExplorerBrowser Implementation
429 */
430static HRESULT WINAPI IExplorerBrowser_fnQueryInterface(IExplorerBrowser *iface,
431 REFIID riid, void **ppvObject)
432{
433 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
434 TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvObject);
435
436 *ppvObject = NULL;
437 if(IsEqualIID(riid, &IID_IExplorerBrowser) ||
438 IsEqualIID(riid, &IID_IUnknown))
439 {
440 *ppvObject = This;
441 }
David Hedberg1efc5402010-08-20 07:45:58 +0200442 else if(IsEqualIID(riid, &IID_IShellBrowser))
443 {
444 *ppvObject = &This->lpsbVtbl;
445 }
David Hedberg59965f92010-08-25 15:24:34 +0200446 else if(IsEqualIID(riid, &IID_ICommDlgBrowser) ||
447 IsEqualIID(riid, &IID_ICommDlgBrowser2) ||
448 IsEqualIID(riid, &IID_ICommDlgBrowser3))
449 {
450 *ppvObject = &This->lpcdb3Vtbl;
451 }
David Hedberg56b8d5d2010-08-25 15:24:36 +0200452 else if(IsEqualIID(riid, &IID_IObjectWithSite))
453 {
454 *ppvObject = &This->lpowsVtbl;
455 }
David Hedbergd6626962010-08-20 07:45:56 +0200456
457 if(*ppvObject)
458 {
459 IUnknown_AddRef((IUnknown*)*ppvObject);
460 return S_OK;
461 }
462
463 return E_NOINTERFACE;
464}
465
466static ULONG WINAPI IExplorerBrowser_fnAddRef(IExplorerBrowser *iface)
467{
468 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
469 LONG ref = InterlockedIncrement(&This->ref);
470 TRACE("%p - ref %d\n", This, ref);
471
472 return ref;
473}
474
475static ULONG WINAPI IExplorerBrowser_fnRelease(IExplorerBrowser *iface)
476{
477 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
478 LONG ref = InterlockedDecrement(&This->ref);
479 TRACE("%p - ref %d\n", This, ref);
480
481 if(!ref)
482 {
483 TRACE("Freeing.\n");
484
485 if(!This->destroyed)
486 IExplorerBrowser_Destroy(iface);
487
David Hedberg56b8d5d2010-08-25 15:24:36 +0200488 IObjectWithSite_SetSite((IObjectWithSite*)&This->lpowsVtbl, NULL);
489
David Hedbergd6626962010-08-20 07:45:56 +0200490 HeapFree(GetProcessHeap(), 0, This);
491 return 0;
492 }
493
494 return ref;
495}
496
497static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface,
498 HWND hwndParent, const RECT *prc,
499 const FOLDERSETTINGS *pfs)
500{
501 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberge4e62e72010-08-20 07:45:59 +0200502 WNDCLASSW wc;
503 LONG style;
504 static const WCHAR EB_CLASS_NAME[] =
505 {'E','x','p','l','o','r','e','r','B','r','o','w','s','e','r','C','o','n','t','r','o','l',0};
506
David Hedbergd6626962010-08-20 07:45:56 +0200507 TRACE("%p (%p, %p, %p)\n", This, hwndParent, prc, pfs);
508
David Hedberge4e62e72010-08-20 07:45:59 +0200509 if(This->hwnd_main)
510 return E_UNEXPECTED;
511
512 if(!hwndParent)
513 return E_INVALIDARG;
514
515 if( !GetClassInfoW(shell32_hInstance, EB_CLASS_NAME, &wc) )
516 {
517 wc.style = CS_HREDRAW | CS_VREDRAW;
518 wc.lpfnWndProc = main_wndproc;
519 wc.cbClsExtra = 0;
520 wc.cbWndExtra = 0;
521 wc.hInstance = shell32_hInstance;
522 wc.hIcon = 0;
523 wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
524 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
525 wc.lpszMenuName = NULL;
526 wc.lpszClassName = EB_CLASS_NAME;
527
528 if (!RegisterClassW(&wc)) return E_FAIL;
529 }
530
531 style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER;
532 This->hwnd_main = CreateWindowExW(WS_EX_CONTROLPARENT, EB_CLASS_NAME, NULL, style,
533 prc->left, prc->top,
534 prc->right - prc->left, prc->bottom - prc->top,
535 hwndParent, 0, shell32_hInstance, This);
536
537 if(!This->hwnd_main)
538 {
539 ERR("Failed to create the window.\n");
540 return E_FAIL;
541 }
542
David Hedberg270845d2010-08-23 12:55:19 +0200543 This->fs.ViewMode = pfs ? pfs->ViewMode : FVM_DETAILS;
544 This->fs.fFlags = pfs ? (pfs->fFlags | FWF_NOCLIENTEDGE) : FWF_NOCLIENTEDGE;
545
David Hedbergd6626962010-08-20 07:45:56 +0200546 return S_OK;
547}
548
549static HRESULT WINAPI IExplorerBrowser_fnDestroy(IExplorerBrowser *iface)
550{
551 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
552 TRACE("%p\n", This);
553
David Hedbergd17d78e2010-08-23 12:55:18 +0200554 if(This->psv)
555 {
556 IShellView_DestroyViewWindow(This->psv);
557 IShellView_Release(This->psv);
558 This->psv = NULL;
559 This->hwnd_sv = NULL;
560 }
561
David Hedbergb88c3e22010-08-24 10:56:19 +0200562 events_unadvise_all(This);
David Hedbergfdccbd92010-08-25 15:24:33 +0200563 travellog_remove_all_entries(This);
David Hedbergb88c3e22010-08-24 10:56:19 +0200564
David Hedberg73100ce2010-08-24 10:56:21 +0200565 ILFree(This->current_pidl);
566 This->current_pidl = NULL;
567
David Hedberge4e62e72010-08-20 07:45:59 +0200568 DestroyWindow(This->hwnd_main);
David Hedbergd6626962010-08-20 07:45:56 +0200569 This->destroyed = TRUE;
570
571 return S_OK;
572}
573
574static HRESULT WINAPI IExplorerBrowser_fnSetRect(IExplorerBrowser *iface,
575 HDWP *phdwp, RECT rcBrowser)
576{
577 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedbergbee7d4b2010-08-20 07:46:00 +0200578 TRACE("%p (%p, %s)\n", This, phdwp, wine_dbgstr_rect(&rcBrowser));
David Hedbergd6626962010-08-20 07:45:56 +0200579
David Hedbergbee7d4b2010-08-20 07:46:00 +0200580 if(phdwp)
581 {
582 *phdwp = DeferWindowPos(*phdwp, This->hwnd_main, NULL, rcBrowser.left, rcBrowser.top,
583 rcBrowser.right - rcBrowser.left, rcBrowser.bottom - rcBrowser.top,
584 SWP_NOZORDER | SWP_NOACTIVATE);
585 }
586 else
587 {
588 MoveWindow(This->hwnd_main, rcBrowser.left, rcBrowser.top,
589 rcBrowser.right - rcBrowser.left, rcBrowser.bottom - rcBrowser.top, TRUE);
590 }
591
592 return S_OK;
David Hedbergd6626962010-08-20 07:45:56 +0200593}
594
595static HRESULT WINAPI IExplorerBrowser_fnSetPropertyBag(IExplorerBrowser *iface,
596 LPCWSTR pszPropertyBag)
597{
598 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
599 FIXME("stub, %p (%s)\n", This, debugstr_w(pszPropertyBag));
600
601 return E_NOTIMPL;
602}
603
604static HRESULT WINAPI IExplorerBrowser_fnSetEmptyText(IExplorerBrowser *iface,
605 LPCWSTR pszEmptyText)
606{
607 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
608 FIXME("stub, %p (%s)\n", This, debugstr_w(pszEmptyText));
609
610 return E_NOTIMPL;
611}
612
613static HRESULT WINAPI IExplorerBrowser_fnSetFolderSettings(IExplorerBrowser *iface,
614 const FOLDERSETTINGS *pfs)
615{
616 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberg270845d2010-08-23 12:55:19 +0200617 TRACE("%p (%p)\n", This, pfs);
David Hedbergd6626962010-08-20 07:45:56 +0200618
David Hedberg270845d2010-08-23 12:55:19 +0200619 if(!pfs)
620 return E_INVALIDARG;
621
622 This->fs.ViewMode = pfs->ViewMode;
623 This->fs.fFlags = pfs->fFlags | FWF_NOCLIENTEDGE;
624
625 /* Change the settings of the current view, if any. */
626 return change_viewmode(This, This->fs.ViewMode);
David Hedbergd6626962010-08-20 07:45:56 +0200627}
628
629static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface,
630 IExplorerBrowserEvents *psbe,
631 DWORD *pdwCookie)
632{
633 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedbergb88c3e22010-08-24 10:56:19 +0200634 event_client *client;
635 TRACE("%p (%p, %p)\n", This, psbe, pdwCookie);
David Hedbergd6626962010-08-20 07:45:56 +0200636
David Hedbergb88c3e22010-08-24 10:56:19 +0200637 client = HeapAlloc(GetProcessHeap(), 0, sizeof(event_client));
638 client->pebe = psbe;
639 client->cookie = ++This->events_next_cookie;
640
641 IExplorerBrowserEvents_AddRef(psbe);
642 *pdwCookie = client->cookie;
643
644 list_add_tail(&This->event_clients, &client->entry);
645
646 return S_OK;
David Hedbergd6626962010-08-20 07:45:56 +0200647}
648
649static HRESULT WINAPI IExplorerBrowser_fnUnadvise(IExplorerBrowser *iface,
650 DWORD dwCookie)
651{
652 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedbergb88c3e22010-08-24 10:56:19 +0200653 event_client *client;
654 TRACE("%p (0x%x)\n", This, dwCookie);
David Hedbergd6626962010-08-20 07:45:56 +0200655
David Hedbergb88c3e22010-08-24 10:56:19 +0200656 LIST_FOR_EACH_ENTRY(client, &This->event_clients, event_client, entry)
657 {
658 if(client->cookie == dwCookie)
659 {
660 list_remove(&client->entry);
661 IExplorerBrowserEvents_Release(client->pebe);
662 HeapFree(GetProcessHeap(), 0, client);
663 return S_OK;
664 }
665 }
666
667 return E_INVALIDARG;
David Hedbergd6626962010-08-20 07:45:56 +0200668}
669
670static HRESULT WINAPI IExplorerBrowser_fnSetOptions(IExplorerBrowser *iface,
671 EXPLORER_BROWSER_OPTIONS dwFlag)
672{
673 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberg9c0260f2010-08-23 12:55:17 +0200674 static const EXPLORER_BROWSER_OPTIONS unsupported_options =
675 EBO_SHOWFRAMES | EBO_ALWAYSNAVIGATE | EBO_NOWRAPPERWINDOW | EBO_HTMLSHAREPOINTVIEW;
David Hedbergd6626962010-08-20 07:45:56 +0200676
David Hedberg9c0260f2010-08-23 12:55:17 +0200677 TRACE("%p (0x%x)\n", This, dwFlag);
678
679 if(dwFlag & unsupported_options)
680 FIXME("Flags 0x%08x contains unsupported options.\n", dwFlag);
681
682 This->eb_options = dwFlag;
683
684 return S_OK;
David Hedbergd6626962010-08-20 07:45:56 +0200685}
686
687static HRESULT WINAPI IExplorerBrowser_fnGetOptions(IExplorerBrowser *iface,
688 EXPLORER_BROWSER_OPTIONS *pdwFlag)
689{
690 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberg9c0260f2010-08-23 12:55:17 +0200691 TRACE("%p (%p)\n", This, pdwFlag);
David Hedbergd6626962010-08-20 07:45:56 +0200692
David Hedberg9c0260f2010-08-23 12:55:17 +0200693 *pdwFlag = This->eb_options;
694
695 return S_OK;
David Hedbergd6626962010-08-20 07:45:56 +0200696}
697
698static HRESULT WINAPI IExplorerBrowser_fnBrowseToIDList(IExplorerBrowser *iface,
699 PCUIDLIST_RELATIVE pidl,
700 UINT uFlags)
701{
702 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberg73100ce2010-08-24 10:56:21 +0200703 LPITEMIDLIST absolute_pidl = NULL;
704 HRESULT hr;
David Hedbergfdccbd92010-08-25 15:24:33 +0200705 static const UINT unsupported_browse_flags =
706 SBSP_NEWBROWSER | EBF_SELECTFROMDATAOBJECT | EBF_NODROPTARGET;
David Hedberg73100ce2010-08-24 10:56:21 +0200707 TRACE("%p (%p, 0x%x)\n", This, pidl, uFlags);
David Hedbergd6626962010-08-20 07:45:56 +0200708
David Hedberg73100ce2010-08-24 10:56:21 +0200709 if(!This->hwnd_main)
710 return E_FAIL;
711
712 if(This->destroyed)
713 return HRESULT_FROM_WIN32(ERROR_BUSY);
714
715 if(This->current_pidl && (This->eb_options & EBO_NAVIGATEONCE))
716 return E_FAIL;
717
718 if(uFlags & SBSP_EXPLOREMODE)
719 return E_INVALIDARG;
720
721 if(uFlags & unsupported_browse_flags)
722 FIXME("Argument 0x%x contains unsupported flags.\n", uFlags);
723
David Hedbergfdccbd92010-08-25 15:24:33 +0200724 if(uFlags & SBSP_NAVIGATEBACK)
725 {
726 TRACE("SBSP_NAVIGATEBACK\n");
727 absolute_pidl = ILClone(travellog_go_back(This));
728 if(!absolute_pidl && !This->current_pidl)
729 return E_FAIL;
730 else if(!absolute_pidl)
731 return S_OK;
732
733 }
734 else if(uFlags & SBSP_NAVIGATEFORWARD)
735 {
736 TRACE("SBSP_NAVIGATEFORWARD\n");
737 absolute_pidl = ILClone(travellog_go_forward(This));
738 if(!absolute_pidl && !This->current_pidl)
739 return E_FAIL;
740 else if(!absolute_pidl)
741 return S_OK;
742
743 }
744 else if(uFlags & SBSP_PARENT)
David Hedberg73100ce2010-08-24 10:56:21 +0200745 {
746 if(This->current_pidl)
747 {
748 if(_ILIsPidlSimple(This->current_pidl))
749 {
750 absolute_pidl = _ILCreateDesktop();
751 }
752 else
753 {
754 absolute_pidl = ILClone(This->current_pidl);
755 ILRemoveLastID(absolute_pidl);
756 }
757 }
758 if(!absolute_pidl)
759 {
760 ERR("Failed to get parent pidl.\n");
761 return E_FAIL;
762 }
763
764 }
765 else if(uFlags & SBSP_RELATIVE)
766 {
767 /* SBSP_RELATIVE has precedence over SBSP_ABSOLUTE */
768 TRACE("SBSP_RELATIVE\n");
769 if(This->current_pidl)
770 {
771 absolute_pidl = ILCombine(This->current_pidl, pidl);
772 }
773 if(!absolute_pidl)
774 {
775 ERR("Failed to get absolute pidl.\n");
776 return E_FAIL;
777 }
778 }
779 else
780 {
781 TRACE("SBSP_ABSOLUTE\n");
782 absolute_pidl = ILClone(pidl);
783 if(!absolute_pidl && !This->current_pidl)
784 return E_INVALIDARG;
785 else if(!absolute_pidl)
786 return S_OK;
787 }
788
789 /* TODO: Asynchronous browsing. Return S_OK here and finish in
790 * another thread. */
791
792 hr = events_NavigationPending(This, absolute_pidl);
793 if(FAILED(hr))
794 {
795 TRACE("Browsing aborted.\n");
796 ILFree(absolute_pidl);
797 return E_FAIL;
798 }
799
David Hedberg56b8d5d2010-08-25 15:24:36 +0200800 get_interfaces_from_site(This);
801
David Hedberg73100ce2010-08-24 10:56:21 +0200802 /* Only browse if the new pidl differs from the old */
803 if(!ILIsEqual(This->current_pidl, absolute_pidl))
804 {
805 IShellItem *psi;
806 hr = SHCreateItemFromIDList(absolute_pidl, &IID_IShellItem, (void**)&psi);
807 if(SUCCEEDED(hr))
808 {
809 hr = create_new_shellview(This, psi);
810 if(FAILED(hr))
811 {
812 events_NavigationFailed(This, absolute_pidl);
813 ILFree(absolute_pidl);
814 IShellItem_Release(psi);
815 return E_FAIL;
816 }
David Hedbergfdccbd92010-08-25 15:24:33 +0200817
818 /* Add to travellog */
819 if( !(This->eb_options & EBO_NOTRAVELLOG) &&
820 !(uFlags & (SBSP_NAVIGATEFORWARD|SBSP_NAVIGATEBACK)) )
821 {
822 travellog_add_entry(This, absolute_pidl);
823 }
824
David Hedberg73100ce2010-08-24 10:56:21 +0200825 IShellItem_Release(psi);
826 }
827 }
828
829 events_NavigationComplete(This, absolute_pidl);
830 ILFree(This->current_pidl);
831 This->current_pidl = absolute_pidl;
832
833 return S_OK;
David Hedbergd6626962010-08-20 07:45:56 +0200834}
835
836static HRESULT WINAPI IExplorerBrowser_fnBrowseToObject(IExplorerBrowser *iface,
837 IUnknown *punk, UINT uFlags)
838{
839 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedberg00889f12010-08-25 15:24:32 +0200840 LPITEMIDLIST pidl;
841 HRESULT hr;
842 TRACE("%p (%p, 0x%x)\n", This, punk, uFlags);
David Hedbergd6626962010-08-20 07:45:56 +0200843
David Hedberg00889f12010-08-25 15:24:32 +0200844 if(!punk)
845 return IExplorerBrowser_fnBrowseToIDList(iface, NULL, uFlags);
846
847 hr = SHGetIDListFromObject(punk, &pidl);
848 if(SUCCEEDED(hr))
849 {
850 hr = IExplorerBrowser_BrowseToIDList(iface, pidl, uFlags);
851 ILFree(pidl);
852 }
853
854 return hr;
David Hedbergd6626962010-08-20 07:45:56 +0200855}
856
857static HRESULT WINAPI IExplorerBrowser_fnFillFromObject(IExplorerBrowser *iface,
858 IUnknown *punk,
859 EXPLORER_BROWSER_FILL_FLAGS dwFlags)
860{
861 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
862 FIXME("stub, %p (%p, 0x%x)\n", This, punk, dwFlags);
863
864 return E_NOTIMPL;
865}
866
867static HRESULT WINAPI IExplorerBrowser_fnRemoveAll(IExplorerBrowser *iface)
868{
869 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
870 FIXME("stub, %p\n", This);
871
872 return E_NOTIMPL;
873}
874
875static HRESULT WINAPI IExplorerBrowser_fnGetCurrentView(IExplorerBrowser *iface,
876 REFIID riid, void **ppv)
877{
878 ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
David Hedbergd17d78e2010-08-23 12:55:18 +0200879 TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppv);
David Hedbergd6626962010-08-20 07:45:56 +0200880
David Hedbergd17d78e2010-08-23 12:55:18 +0200881 if(!This->psv)
882 return E_FAIL;
883
884 return IShellView_QueryInterface(This->psv, riid, ppv);
David Hedbergd6626962010-08-20 07:45:56 +0200885}
886
887static const IExplorerBrowserVtbl vt_IExplorerBrowser =
888{
889 IExplorerBrowser_fnQueryInterface,
890 IExplorerBrowser_fnAddRef,
891 IExplorerBrowser_fnRelease,
892 IExplorerBrowser_fnInitialize,
893 IExplorerBrowser_fnDestroy,
894 IExplorerBrowser_fnSetRect,
895 IExplorerBrowser_fnSetPropertyBag,
896 IExplorerBrowser_fnSetEmptyText,
897 IExplorerBrowser_fnSetFolderSettings,
898 IExplorerBrowser_fnAdvise,
899 IExplorerBrowser_fnUnadvise,
900 IExplorerBrowser_fnSetOptions,
901 IExplorerBrowser_fnGetOptions,
902 IExplorerBrowser_fnBrowseToIDList,
903 IExplorerBrowser_fnBrowseToObject,
904 IExplorerBrowser_fnFillFromObject,
905 IExplorerBrowser_fnRemoveAll,
906 IExplorerBrowser_fnGetCurrentView
907};
908
David Hedberg1efc5402010-08-20 07:45:58 +0200909/**************************************************************************
910 * IShellBrowser Implementation
911 */
912
913static inline ExplorerBrowserImpl *impl_from_IShellBrowser(IShellBrowser *iface)
914{
915 return (ExplorerBrowserImpl *)((char*)iface - FIELD_OFFSET(ExplorerBrowserImpl, lpsbVtbl));
916}
917
918static HRESULT WINAPI IShellBrowser_fnQueryInterface(IShellBrowser *iface,
919 REFIID riid, void **ppvObject)
920{
921 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
922 TRACE("%p\n", This);
923 return IUnknown_QueryInterface((IUnknown*) This, riid, ppvObject);
924}
925
926static ULONG WINAPI IShellBrowser_fnAddRef(IShellBrowser *iface)
927{
928 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
929 TRACE("%p\n", This);
930 return IUnknown_AddRef((IUnknown*) This);
931}
932
933static ULONG WINAPI IShellBrowser_fnRelease(IShellBrowser *iface)
934{
935 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
936 TRACE("%p\n", This);
937 return IUnknown_Release((IUnknown*) This);
938}
939
940static HRESULT WINAPI IShellBrowser_fnGetWindow(IShellBrowser *iface, HWND *phwnd)
941{
942 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
David Hedberge4e62e72010-08-20 07:45:59 +0200943 TRACE("%p (%p)\n", This, phwnd);
David Hedberg1efc5402010-08-20 07:45:58 +0200944
David Hedberge4e62e72010-08-20 07:45:59 +0200945 if(!This->hwnd_main)
946 return E_FAIL;
947
948 *phwnd = This->hwnd_main;
949 return S_OK;
David Hedberg1efc5402010-08-20 07:45:58 +0200950}
951
952static HRESULT WINAPI IShellBrowser_fnContextSensitiveHelp(IShellBrowser *iface,
953 BOOL fEnterMode)
954{
955 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
956 FIXME("stub, %p (%d)\n", This, fEnterMode);
957
958 return E_NOTIMPL;
959}
960
961static HRESULT WINAPI IShellBrowser_fnInsertMenusSB(IShellBrowser *iface,
962 HMENU hmenuShared,
963 LPOLEMENUGROUPWIDTHS lpMenuWidths)
964{
965 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
966 TRACE("%p (%p, %p)\n", This, hmenuShared, lpMenuWidths);
967
968 /* Not implemented. */
969 return E_NOTIMPL;
970}
971
972static HRESULT WINAPI IShellBrowser_fnSetMenuSB(IShellBrowser *iface,
973 HMENU hmenuShared,
974 HOLEMENU holemenuReserved,
975 HWND hwndActiveObject)
976{
977 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
978 TRACE("%p (%p, %p, %p)\n", This, hmenuShared, holemenuReserved, hwndActiveObject);
979
980 /* Not implemented. */
981 return E_NOTIMPL;
982}
983
984static HRESULT WINAPI IShellBrowser_fnRemoveMenusSB(IShellBrowser *iface,
985 HMENU hmenuShared)
986{
987 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
988 TRACE("%p (%p)\n", This, hmenuShared);
989
990 /* Not implemented. */
991 return E_NOTIMPL;
992}
993
994static HRESULT WINAPI IShellBrowser_fnSetStatusTextSB(IShellBrowser *iface,
995 LPCOLESTR pszStatusText)
996{
997 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
998 FIXME("stub, %p (%s)\n", This, debugstr_w(pszStatusText));
999
1000 return E_NOTIMPL;
1001}
1002
1003static HRESULT WINAPI IShellBrowser_fnEnableModelessSB(IShellBrowser *iface,
1004 BOOL fEnable)
1005{
1006 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1007 FIXME("stub, %p (%d)\n", This, fEnable);
1008
1009 return E_NOTIMPL;
1010}
1011
1012static HRESULT WINAPI IShellBrowser_fnTranslateAcceleratorSB(IShellBrowser *iface,
1013 MSG *pmsg, WORD wID)
1014{
1015 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1016 FIXME("stub, %p (%p, 0x%x)\n", This, pmsg, wID);
1017
1018 return E_NOTIMPL;
1019}
1020
1021static HRESULT WINAPI IShellBrowser_fnBrowseObject(IShellBrowser *iface,
1022 LPCITEMIDLIST pidl, UINT wFlags)
1023{
1024 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
David Hedberg73100ce2010-08-24 10:56:21 +02001025 TRACE("%p (%p, %x)\n", This, pidl, wFlags);
David Hedberg1efc5402010-08-20 07:45:58 +02001026
David Hedberg73100ce2010-08-24 10:56:21 +02001027 return IExplorerBrowser_fnBrowseToIDList((IExplorerBrowser*)This, pidl, wFlags);
David Hedberg1efc5402010-08-20 07:45:58 +02001028}
1029
1030static HRESULT WINAPI IShellBrowser_fnGetViewStateStream(IShellBrowser *iface,
1031 DWORD grfMode,
1032 IStream **ppStrm)
1033{
1034 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1035 FIXME("stub, %p (0x%x, %p)\n", This, grfMode, ppStrm);
1036
1037 *ppStrm = NULL;
1038 return E_FAIL;
1039}
1040
1041static HRESULT WINAPI IShellBrowser_fnGetControlWindow(IShellBrowser *iface,
1042 UINT id, HWND *phwnd)
1043{
1044 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1045 TRACE("%p (%d, %p)\n", This, id, phwnd);
1046
1047 /* Not implemented. */
1048 return E_NOTIMPL;
1049}
1050
1051static HRESULT WINAPI IShellBrowser_fnSendControlMsg(IShellBrowser *iface,
1052 UINT id, UINT uMsg,
1053 WPARAM wParam, LPARAM lParam,
1054 LRESULT *pret)
1055{
1056 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1057 FIXME("stub, %p (%d, %d, %lx, %lx, %p)\n", This, id, uMsg, wParam, lParam, pret);
1058
1059 return E_NOTIMPL;
1060}
1061
1062static HRESULT WINAPI IShellBrowser_fnQueryActiveShellView(IShellBrowser *iface,
1063 IShellView **ppshv)
1064{
1065 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
David Hedbergd17d78e2010-08-23 12:55:18 +02001066 TRACE("%p (%p)\n", This, ppshv);
David Hedberg1efc5402010-08-20 07:45:58 +02001067
David Hedbergd17d78e2010-08-23 12:55:18 +02001068 if(!This->psv)
1069 return E_FAIL;
1070
1071 *ppshv = This->psv;
1072 IShellView_AddRef(This->psv);
1073
1074 return S_OK;
David Hedberg1efc5402010-08-20 07:45:58 +02001075}
1076
1077static HRESULT WINAPI IShellBrowser_fnOnViewWindowActive(IShellBrowser *iface,
1078 IShellView *pshv)
1079{
1080 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1081 FIXME("stub, %p (%p)\n", This, pshv);
1082
1083 return E_NOTIMPL;
1084}
1085
1086static HRESULT WINAPI IShellBrowser_fnSetToolbarItems(IShellBrowser *iface,
1087 LPTBBUTTONSB lpButtons,
1088 UINT nButtons, UINT uFlags)
1089{
1090 ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface);
1091 FIXME("stub, %p (%p, %d, 0x%x)\n", This, lpButtons, nButtons, uFlags);
1092
1093 return E_NOTIMPL;
1094}
1095
1096static const IShellBrowserVtbl vt_IShellBrowser = {
1097 IShellBrowser_fnQueryInterface,
1098 IShellBrowser_fnAddRef,
1099 IShellBrowser_fnRelease,
1100 IShellBrowser_fnGetWindow,
1101 IShellBrowser_fnContextSensitiveHelp,
1102 IShellBrowser_fnInsertMenusSB,
1103 IShellBrowser_fnSetMenuSB,
1104 IShellBrowser_fnRemoveMenusSB,
1105 IShellBrowser_fnSetStatusTextSB,
1106 IShellBrowser_fnEnableModelessSB,
1107 IShellBrowser_fnTranslateAcceleratorSB,
1108 IShellBrowser_fnBrowseObject,
1109 IShellBrowser_fnGetViewStateStream,
1110 IShellBrowser_fnGetControlWindow,
1111 IShellBrowser_fnSendControlMsg,
1112 IShellBrowser_fnQueryActiveShellView,
1113 IShellBrowser_fnOnViewWindowActive,
1114 IShellBrowser_fnSetToolbarItems
1115};
1116
David Hedberg59965f92010-08-25 15:24:34 +02001117/**************************************************************************
1118 * ICommDlgBrowser3 Implementation
1119 */
1120
1121static inline ExplorerBrowserImpl *impl_from_ICommDlgBrowser3(ICommDlgBrowser3 *iface)
1122{
1123 return (ExplorerBrowserImpl *)((char*)iface - FIELD_OFFSET(ExplorerBrowserImpl, lpcdb3Vtbl));
1124}
1125
1126static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface,
1127 REFIID riid,
1128 void **ppvObject)
1129{
1130 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
1131 TRACE("%p\n", This);
1132 return IUnknown_QueryInterface((IUnknown*) This, riid, ppvObject);
1133}
1134
1135static ULONG WINAPI ICommDlgBrowser3_fnAddRef(ICommDlgBrowser3 *iface)
1136{
1137 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
1138 TRACE("%p\n", This);
1139 return IUnknown_AddRef((IUnknown*) This);
1140}
1141
1142static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
1143{
1144 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
1145 TRACE("%p\n", This);
1146 return IUnknown_Release((IUnknown*) This);
1147}
1148
1149static HRESULT WINAPI ICommDlgBrowser3_fnOnDefaultCommand(ICommDlgBrowser3 *iface,
1150 IShellView *shv)
1151{
1152 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergf118c642010-08-25 15:24:35 +02001153 IDataObject *pdo;
1154 HRESULT hr;
1155 HRESULT ret = S_FALSE;
1156
1157 TRACE("%p (%p)\n", This, shv);
1158
1159 hr = IShellView_GetItemObject(shv, SVGIO_SELECTION, &IID_IDataObject, (void**)&pdo);
1160 if(SUCCEEDED(hr))
1161 {
1162 FORMATETC fmt;
1163 STGMEDIUM medium;
1164
1165 fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
1166 fmt.ptd = NULL;
1167 fmt.dwAspect = DVASPECT_CONTENT;
1168 fmt.lindex = -1;
1169 fmt.tymed = TYMED_HGLOBAL;
1170
1171 hr = IDataObject_GetData(pdo, &fmt ,&medium);
1172 IDataObject_Release(pdo);
1173 if(SUCCEEDED(hr))
1174 {
1175 LPIDA pida = GlobalLock(medium.u.hGlobal);
1176 LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]);
1177
1178 /* Handle folders by browsing to them. */
1179 if(_ILIsFolder(pidl_child) || _ILIsDrive(pidl_child) || _ILIsSpecialFolder(pidl_child))
1180 {
1181 IExplorerBrowser_BrowseToIDList((IExplorerBrowser*)This, pidl_child, SBSP_RELATIVE);
1182 ret = S_OK;
1183 }
1184 GlobalUnlock(medium.u.hGlobal);
1185 GlobalFree(medium.u.hGlobal);
1186 }
1187 else
1188 ERR("Failed to get data from IDataObject.\n");
1189 } else
1190 ERR("Failed to get IDataObject.\n");
1191
David Hedbergddcd6192010-08-26 13:58:16 +02001192 /* If we didn't handle the default command, check if we have a
1193 * client that does */
1194 if(ret == S_FALSE && This->pcdb_site)
1195 return ICommDlgBrowser_OnDefaultCommand(This->pcdb_site, shv);
1196
David Hedbergf118c642010-08-25 15:24:35 +02001197 return ret;
David Hedberg59965f92010-08-25 15:24:34 +02001198}
1199static HRESULT WINAPI ICommDlgBrowser3_fnOnStateChange(ICommDlgBrowser3 *iface,
1200 IShellView *shv, ULONG uChange)
1201{
1202 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001203 TRACE("%p (%p, %d)\n", This, shv, uChange);
1204
1205 if(This->pcdb_site)
1206 return ICommDlgBrowser_OnStateChange(This->pcdb_site, shv, uChange);
1207
David Hedberg59965f92010-08-25 15:24:34 +02001208 return E_NOTIMPL;
1209}
1210static HRESULT WINAPI ICommDlgBrowser3_fnIncludeObject(ICommDlgBrowser3 *iface,
1211 IShellView *pshv, LPCITEMIDLIST pidl)
1212{
1213 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001214 TRACE("%p (%p, %p)\n", This, pshv, pidl);
1215
1216 if(This->pcdb_site)
1217 return ICommDlgBrowser_IncludeObject(This->pcdb_site, pshv, pidl);
1218
David Hedberg59965f92010-08-25 15:24:34 +02001219 return S_OK;
1220}
1221
1222static HRESULT WINAPI ICommDlgBrowser3_fnNotify(ICommDlgBrowser3 *iface,
1223 IShellView *pshv,
1224 DWORD dwNotifyType)
1225{
1226 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001227 TRACE("%p (%p, 0x%x)\n", This, pshv, dwNotifyType);
1228
1229 if(This->pcdb2_site)
1230 return ICommDlgBrowser2_Notify(This->pcdb2_site, pshv, dwNotifyType);
1231
David Hedberg59965f92010-08-25 15:24:34 +02001232 return S_OK;
1233}
1234
1235static HRESULT WINAPI ICommDlgBrowser3_fnGetDefaultMenuText(ICommDlgBrowser3 *iface,
1236 IShellView *pshv,
1237 LPWSTR pszText, int cchMax)
1238{
1239 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001240 TRACE("%p (%p, %s, %d)\n", This, pshv, debugstr_w(pszText), cchMax);
1241
1242 if(This->pcdb2_site)
1243 return ICommDlgBrowser2_GetDefaultMenuText(This->pcdb2_site, pshv, pszText, cchMax);
1244
David Hedberg59965f92010-08-25 15:24:34 +02001245 return S_OK;
1246}
1247
1248static HRESULT WINAPI ICommDlgBrowser3_fnGetViewFlags(ICommDlgBrowser3 *iface,
1249 DWORD *pdwFlags)
1250{
1251 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001252 TRACE("%p (%p)\n", This, pdwFlags);
1253
1254 if(This->pcdb2_site)
1255 return ICommDlgBrowser2_GetViewFlags(This->pcdb2_site, pdwFlags);
1256
David Hedberg59965f92010-08-25 15:24:34 +02001257 return S_OK;
1258}
1259
1260static HRESULT WINAPI ICommDlgBrowser3_fnOnColumnClicked(ICommDlgBrowser3 *iface,
1261 IShellView *pshv, int iColumn)
1262{
1263 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001264 TRACE("%p (%p, %d)\n", This, pshv, iColumn);
1265
1266 if(This->pcdb3_site)
1267 return ICommDlgBrowser3_OnColumnClicked(This->pcdb3_site, pshv, iColumn);
1268
David Hedberg59965f92010-08-25 15:24:34 +02001269 return S_OK;
1270}
1271
1272static HRESULT WINAPI ICommDlgBrowser3_fnGetCurrentFilter(ICommDlgBrowser3 *iface,
1273 LPWSTR pszFileSpec,
1274 int cchFileSpec)
1275{
1276 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001277 TRACE("%p (%s, %d)\n", This, debugstr_w(pszFileSpec), cchFileSpec);
1278
1279 if(This->pcdb3_site)
1280 return ICommDlgBrowser3_GetCurrentFilter(This->pcdb3_site, pszFileSpec, cchFileSpec);
1281
David Hedberg59965f92010-08-25 15:24:34 +02001282 return S_OK;
1283}
1284
1285static HRESULT WINAPI ICommDlgBrowser3_fnOnPreviewCreated(ICommDlgBrowser3 *iface,
1286 IShellView *pshv)
1287{
1288 ExplorerBrowserImpl *This = impl_from_ICommDlgBrowser3(iface);
David Hedbergddcd6192010-08-26 13:58:16 +02001289 TRACE("%p (%p)\n", This, pshv);
1290
1291 if(This->pcdb3_site)
1292 return ICommDlgBrowser3_OnPreviewCreated(This->pcdb3_site, pshv);
1293
David Hedberg59965f92010-08-25 15:24:34 +02001294 return S_OK;
1295}
1296
1297static const ICommDlgBrowser3Vtbl vt_ICommDlgBrowser3 = {
1298 ICommDlgBrowser3_fnQueryInterface,
1299 ICommDlgBrowser3_fnAddRef,
1300 ICommDlgBrowser3_fnRelease,
1301 ICommDlgBrowser3_fnOnDefaultCommand,
1302 ICommDlgBrowser3_fnOnStateChange,
1303 ICommDlgBrowser3_fnIncludeObject,
1304 ICommDlgBrowser3_fnNotify,
1305 ICommDlgBrowser3_fnGetDefaultMenuText,
1306 ICommDlgBrowser3_fnGetViewFlags,
1307 ICommDlgBrowser3_fnOnColumnClicked,
1308 ICommDlgBrowser3_fnGetCurrentFilter,
1309 ICommDlgBrowser3_fnOnPreviewCreated
1310};
1311
David Hedberg56b8d5d2010-08-25 15:24:36 +02001312/**************************************************************************
1313 * IObjectWithSite Implementation
1314 */
1315
1316static inline ExplorerBrowserImpl *impl_from_IObjectWithSite(IObjectWithSite *iface)
1317{
1318 return (ExplorerBrowserImpl *)((char*)iface - FIELD_OFFSET(ExplorerBrowserImpl, lpowsVtbl));
1319}
1320
1321static HRESULT WINAPI IObjectWithSite_fnQueryInterface(IObjectWithSite *iface,
1322 REFIID riid, void **ppvObject)
1323{
1324 ExplorerBrowserImpl *This = impl_from_IObjectWithSite(iface);
1325 TRACE("%p\n", This);
1326 return IUnknown_QueryInterface((IUnknown*)This, riid, ppvObject);
1327}
1328
1329static ULONG WINAPI IObjectWithSite_fnAddRef(IObjectWithSite *iface)
1330{
1331 ExplorerBrowserImpl *This = impl_from_IObjectWithSite(iface);
1332 TRACE("%p\n", This);
1333 return IUnknown_AddRef((IUnknown*)This);
1334}
1335
1336static ULONG WINAPI IObjectWithSite_fnRelease(IObjectWithSite *iface)
1337{
1338 ExplorerBrowserImpl *This = impl_from_IObjectWithSite(iface);
1339 TRACE("%p\n", This);
1340 return IUnknown_Release((IUnknown*)This);
1341}
1342
1343static HRESULT WINAPI IObjectWithSite_fnSetSite(IObjectWithSite *iface, IUnknown *punk_site)
1344{
1345 ExplorerBrowserImpl *This = impl_from_IObjectWithSite(iface);
1346 TRACE("%p (%p)\n", This, punk_site);
1347
1348 if(This->punk_site)
1349 {
1350 IUnknown_Release(This->punk_site);
1351 This->punk_site = NULL;
1352 get_interfaces_from_site(This);
1353 }
1354
1355 This->punk_site = punk_site;
1356
1357 if(This->punk_site)
1358 IUnknown_AddRef(This->punk_site);
1359
1360 return S_OK;
1361}
1362
1363static HRESULT WINAPI IObjectWithSite_fnGetSite(IObjectWithSite *iface, REFIID riid, void **ppvSite)
1364{
1365 ExplorerBrowserImpl *This = impl_from_IObjectWithSite(iface);
1366 TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvSite);
1367
1368 if(!This->punk_site)
1369 return E_FAIL;
1370
1371 return IUnknown_QueryInterface(This->punk_site, riid, ppvSite);
1372}
1373
1374static const IObjectWithSiteVtbl vt_IObjectWithSite = {
1375 IObjectWithSite_fnQueryInterface,
1376 IObjectWithSite_fnAddRef,
1377 IObjectWithSite_fnRelease,
1378 IObjectWithSite_fnSetSite,
1379 IObjectWithSite_fnGetSite
1380};
1381
David Hedberg20952602010-08-26 13:58:19 +02001382/**************************************************************************
1383 * INameSpaceTreeControlEvents Implementation
1384 */
1385static inline ExplorerBrowserImpl *impl_from_INameSpaceTreeControlEvents(INameSpaceTreeControlEvents *iface)
1386{
1387 return (ExplorerBrowserImpl *)((char*)iface - FIELD_OFFSET(ExplorerBrowserImpl, lpnstceVtbl));
1388}
1389
1390static HRESULT WINAPI NSTCEvents_fnQueryInterface(INameSpaceTreeControlEvents *iface,
1391 REFIID riid, void **ppvObject)
1392{
1393 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1394 TRACE("%p (%s, %p)\n", This, shdebugstr_guid(riid), ppvObject);
1395
1396 *ppvObject = NULL;
1397 if(IsEqualIID(riid, &IID_INameSpaceTreeControlEvents) ||
1398 IsEqualIID(riid, &IID_IUnknown))
1399 {
1400 *ppvObject = iface;
1401 }
1402
1403 if(*ppvObject)
1404 {
1405 IUnknown_AddRef((IUnknown*)*ppvObject);
1406 return S_OK;
1407 }
1408
1409 return E_NOINTERFACE;
1410}
1411
1412static ULONG WINAPI NSTCEvents_fnAddRef(INameSpaceTreeControlEvents *iface)
1413{
1414 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1415 TRACE("%p\n", This);
1416 return IUnknown_AddRef((IUnknown*)This);
1417}
1418
1419static ULONG WINAPI NSTCEvents_fnRelease(INameSpaceTreeControlEvents *iface)
1420{
1421 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1422 TRACE("%p\n", This);
1423 return IUnknown_Release((IUnknown*)This);
1424}
1425
1426static HRESULT WINAPI NSTCEvents_fnOnItemClick(INameSpaceTreeControlEvents *iface,
1427 IShellItem *psi,
1428 NSTCEHITTEST nstceHitTest,
1429 NSTCECLICKTYPE nstceClickType)
1430{
1431 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1432 TRACE("%p (%p, 0x%x, 0x%x)\n", This, psi, nstceHitTest, nstceClickType);
1433 return S_OK;
1434}
1435
1436static HRESULT WINAPI NSTCEvents_fnOnPropertyItemCommit(INameSpaceTreeControlEvents *iface,
1437 IShellItem *psi)
1438{
1439 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1440 TRACE("%p (%p)\n", This, psi);
1441 return E_NOTIMPL;
1442}
1443
1444static HRESULT WINAPI NSTCEvents_fnOnItemStateChanging(INameSpaceTreeControlEvents *iface,
1445 IShellItem *psi,
1446 NSTCITEMSTATE nstcisMask,
1447 NSTCITEMSTATE nstcisState)
1448{
1449 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1450 TRACE("%p (%p, 0x%x, 0x%x)\n", This, psi, nstcisMask, nstcisState);
1451 return E_NOTIMPL;
1452}
1453
1454static HRESULT WINAPI NSTCEvents_fnOnItemStateChanged(INameSpaceTreeControlEvents *iface,
1455 IShellItem *psi,
1456 NSTCITEMSTATE nstcisMask,
1457 NSTCITEMSTATE nstcisState)
1458{
1459 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1460 TRACE("%p (%p, 0x%x, 0x%x)\n", This, psi, nstcisMask, nstcisState);
1461 return E_NOTIMPL;
1462}
1463
1464static HRESULT WINAPI NSTCEvents_fnOnSelectionChanged(INameSpaceTreeControlEvents *iface,
1465 IShellItemArray *psiaSelection)
1466{
1467 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1468 TRACE("%p (%p)\n", This, psiaSelection);
1469 return E_NOTIMPL;
1470}
1471
1472static HRESULT WINAPI NSTCEvents_fnOnKeyboardInput(INameSpaceTreeControlEvents *iface,
1473 UINT uMsg, WPARAM wParam, LPARAM lParam)
1474{
1475 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1476 TRACE("%p (%d, 0x%lx, 0x%lx)\n", This, uMsg, wParam, lParam);
1477 return S_OK;
1478}
1479
1480static HRESULT WINAPI NSTCEvents_fnOnBeforeExpand(INameSpaceTreeControlEvents *iface,
1481 IShellItem *psi)
1482{
1483 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1484 TRACE("%p (%p)\n", This, psi);
1485 return E_NOTIMPL;
1486}
1487
1488static HRESULT WINAPI NSTCEvents_fnOnAfterExpand(INameSpaceTreeControlEvents *iface,
1489 IShellItem *psi)
1490{
1491 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1492 TRACE("%p (%p)\n", This, psi);
1493 return E_NOTIMPL;
1494}
1495
1496static HRESULT WINAPI NSTCEvents_fnOnBeginLabelEdit(INameSpaceTreeControlEvents *iface,
1497 IShellItem *psi)
1498{
1499 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1500 TRACE("%p (%p)\n", This, psi);
1501 return E_NOTIMPL;
1502}
1503
1504static HRESULT WINAPI NSTCEvents_fnOnEndLabelEdit(INameSpaceTreeControlEvents *iface,
1505 IShellItem *psi)
1506{
1507 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1508 TRACE("%p (%p)\n", This, psi);
1509 return E_NOTIMPL;
1510}
1511
1512static HRESULT WINAPI NSTCEvents_fnOnGetToolTip(INameSpaceTreeControlEvents *iface,
1513 IShellItem *psi, LPWSTR pszTip, int cchTip)
1514{
1515 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1516 TRACE("%p (%p, %p, %d)\n", This, psi, pszTip, cchTip);
1517 return E_NOTIMPL;
1518}
1519
1520static HRESULT WINAPI NSTCEvents_fnOnBeforeItemDelete(INameSpaceTreeControlEvents *iface,
1521 IShellItem *psi)
1522{
1523 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1524 TRACE("%p (%p)\n", This, psi);
1525 return E_NOTIMPL;
1526}
1527
1528static HRESULT WINAPI NSTCEvents_fnOnItemAdded(INameSpaceTreeControlEvents *iface,
1529 IShellItem *psi, BOOL fIsRoot)
1530{
1531 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1532 TRACE("%p (%p, %d)\n", This, psi, fIsRoot);
1533 return E_NOTIMPL;
1534}
1535
1536static HRESULT WINAPI NSTCEvents_fnOnItemDeleted(INameSpaceTreeControlEvents *iface,
1537 IShellItem *psi, BOOL fIsRoot)
1538{
1539 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1540 TRACE("%p (%p, %d)\n", This, psi, fIsRoot);
1541 return E_NOTIMPL;
1542}
1543
1544static HRESULT WINAPI NSTCEvents_fnOnBeforeContextMenu(INameSpaceTreeControlEvents *iface,
1545 IShellItem *psi, REFIID riid, void **ppv)
1546{
1547 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1548 TRACE("%p (%p, %s, %p)\n", This, psi, shdebugstr_guid(riid), ppv);
1549 return E_NOTIMPL;
1550}
1551
1552static HRESULT WINAPI NSTCEvents_fnOnAfterContextMenu(INameSpaceTreeControlEvents *iface,
1553 IShellItem *psi, IContextMenu *pcmIn,
1554 REFIID riid, void **ppv)
1555{
1556 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1557 TRACE("%p (%p, %p, %s, %p)\n", This, psi, pcmIn, shdebugstr_guid(riid), ppv);
1558 return E_NOTIMPL;
1559}
1560
1561static HRESULT WINAPI NSTCEvents_fnOnBeforeStateImageChange(INameSpaceTreeControlEvents *iface,
1562 IShellItem *psi)
1563{
1564 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1565 TRACE("%p (%p)\n", This, psi);
1566 return E_NOTIMPL;
1567}
1568
1569static HRESULT WINAPI NSTCEvents_fnOnGetDefaultIconIndex(INameSpaceTreeControlEvents* iface,
1570 IShellItem *psi,
1571 int *piDefaultIcon, int *piOpenIcon)
1572{
1573 ExplorerBrowserImpl *This = impl_from_INameSpaceTreeControlEvents(iface);
1574 TRACE("%p (%p, %p, %p)\n", This, psi, piDefaultIcon, piOpenIcon);
1575 return E_NOTIMPL;
1576}
1577
1578
1579const INameSpaceTreeControlEventsVtbl vt_INameSpaceTreeControlEvents = {
1580 NSTCEvents_fnQueryInterface,
1581 NSTCEvents_fnAddRef,
1582 NSTCEvents_fnRelease,
1583 NSTCEvents_fnOnItemClick,
1584 NSTCEvents_fnOnPropertyItemCommit,
1585 NSTCEvents_fnOnItemStateChanging,
1586 NSTCEvents_fnOnItemStateChanged,
1587 NSTCEvents_fnOnSelectionChanged,
1588 NSTCEvents_fnOnKeyboardInput,
1589 NSTCEvents_fnOnBeforeExpand,
1590 NSTCEvents_fnOnAfterExpand,
1591 NSTCEvents_fnOnBeginLabelEdit,
1592 NSTCEvents_fnOnEndLabelEdit,
1593 NSTCEvents_fnOnGetToolTip,
1594 NSTCEvents_fnOnBeforeItemDelete,
1595 NSTCEvents_fnOnItemAdded,
1596 NSTCEvents_fnOnItemDeleted,
1597 NSTCEvents_fnOnBeforeContextMenu,
1598 NSTCEvents_fnOnAfterContextMenu,
1599 NSTCEvents_fnOnBeforeStateImageChange,
1600 NSTCEvents_fnOnGetDefaultIconIndex
1601};
1602
David Hedbergd6626962010-08-20 07:45:56 +02001603HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
1604{
1605 ExplorerBrowserImpl *eb;
1606 HRESULT ret;
1607
1608 TRACE("%p %s %p\n", pUnkOuter, shdebugstr_guid (riid), ppv);
1609
1610 if(!ppv)
1611 return E_POINTER;
1612 if(pUnkOuter)
1613 return CLASS_E_NOAGGREGATION;
1614
1615 eb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ExplorerBrowserImpl));
1616 eb->ref = 1;
1617 eb->lpVtbl = &vt_IExplorerBrowser;
David Hedberg1efc5402010-08-20 07:45:58 +02001618 eb->lpsbVtbl = &vt_IShellBrowser;
David Hedberg59965f92010-08-25 15:24:34 +02001619 eb->lpcdb3Vtbl = &vt_ICommDlgBrowser3;
David Hedberg56b8d5d2010-08-25 15:24:36 +02001620 eb->lpowsVtbl = &vt_IObjectWithSite;
David Hedberg20952602010-08-26 13:58:19 +02001621 eb->lpnstceVtbl = &vt_INameSpaceTreeControlEvents;
David Hedbergd6626962010-08-20 07:45:56 +02001622
David Hedbergb88c3e22010-08-24 10:56:19 +02001623 list_init(&eb->event_clients);
David Hedbergfdccbd92010-08-25 15:24:33 +02001624 list_init(&eb->travellog);
David Hedbergb88c3e22010-08-24 10:56:19 +02001625
David Hedbergd6626962010-08-20 07:45:56 +02001626 ret = IExplorerBrowser_QueryInterface((IExplorerBrowser*)eb, riid, ppv);
1627 IExplorerBrowser_Release((IExplorerBrowser*)eb);
1628
1629 TRACE("--(%p)\n", ppv);
1630 return ret;
1631}