d3d10core/tests: Remove dead code.
[wine.git] / dlls / shell32 / shlview.c
blobb763468259529f70c768dd3fdf23f11d8c4f7801
1 /*
2 * ShellView
4 * Copyright 1998,1999 <juergen.schmied@debitel.net>
6 * This is the view visualizing the data provided by the shellfolder.
7 * No direct access to data from pidls should be done from here.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * FIXME: The order by part of the background context menu should be
24 * built according to the columns shown.
26 * FIXME: Load/Save the view state from/into the stream provided by
27 * the ShellBrowser
29 * FIXME: CheckToolbar: handle the "new folder" and "folder up" button
31 * FIXME: ShellView_FillList: consider sort orders
33 * FIXME: implement the drag and drop in the old (msg-based) way
35 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
36 * Release() ???
39 #include "config.h"
40 #include "wine/port.h"
42 #include <stdarg.h>
43 #include <stdlib.h>
44 #include <string.h>
46 #define COBJMACROS
47 #define NONAMELESSUNION
49 #include "windef.h"
50 #include "winerror.h"
51 #include "winbase.h"
52 #include "winnls.h"
53 #include "objbase.h"
54 #include "servprov.h"
55 #include "shlguid.h"
56 #include "wingdi.h"
57 #include "winuser.h"
58 #include "shlobj.h"
59 #include "shobjidl.h"
60 #include "undocshell.h"
61 #include "shresdef.h"
62 #include "wine/debug.h"
64 #include "docobj.h"
65 #include "pidl.h"
66 #include "shell32_main.h"
67 #include "shellfolder.h"
69 WINE_DEFAULT_DEBUG_CHANNEL(shell);
71 static const WCHAR SV_CLASS_NAME[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0};
73 typedef struct
74 { BOOL bIsAscending;
75 INT nHeaderID;
76 INT nLastHeaderID;
77 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
79 typedef struct
81 IShellView3 IShellView3_iface;
82 IOleCommandTarget IOleCommandTarget_iface;
83 IDropTarget IDropTarget_iface;
84 IDropSource IDropSource_iface;
85 IViewObject IViewObject_iface;
86 IFolderView2 IFolderView2_iface;
87 IShellFolderView IShellFolderView_iface;
88 IShellFolderViewDual3 IShellFolderViewDual3_iface;
89 LONG ref;
90 IShellFolder* pSFParent;
91 IShellFolder2* pSF2Parent;
92 IShellBrowser* pShellBrowser;
93 ICommDlgBrowser* pCommDlgBrowser;
94 HWND hWnd; /* SHELLDLL_DefView */
95 HWND hWndList; /* ListView control */
96 HWND hWndParent;
97 FOLDERSETTINGS FolderSettings;
98 HMENU hMenu;
99 UINT uState;
100 UINT cidl;
101 LPITEMIDLIST *apidl;
102 LISTVIEW_SORT_INFO ListViewSortInfo;
103 ULONG hNotify; /* change notification handle */
104 HANDLE hAccel;
105 DWORD dwAspects;
106 DWORD dwAdvf;
107 IAdviseSink *pAdvSink;
108 IDropTarget* pCurDropTarget; /* The sub-item, which is currently dragged over */
109 IDataObject* pCurDataObject; /* The dragged data-object */
110 LONG iDragOverItem; /* Dragged over item's index, iff pCurDropTarget != NULL */
111 UINT cScrollDelay; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
112 POINT ptLastMousePos; /* Mouse position at last DragOver call */
113 } IShellViewImpl;
115 static inline IShellViewImpl *impl_from_IShellView3(IShellView3 *iface)
117 return CONTAINING_RECORD(iface, IShellViewImpl, IShellView3_iface);
120 static inline IShellViewImpl *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
122 return CONTAINING_RECORD(iface, IShellViewImpl, IOleCommandTarget_iface);
125 static inline IShellViewImpl *impl_from_IDropTarget(IDropTarget *iface)
127 return CONTAINING_RECORD(iface, IShellViewImpl, IDropTarget_iface);
130 static inline IShellViewImpl *impl_from_IDropSource(IDropSource *iface)
132 return CONTAINING_RECORD(iface, IShellViewImpl, IDropSource_iface);
135 static inline IShellViewImpl *impl_from_IViewObject(IViewObject *iface)
137 return CONTAINING_RECORD(iface, IShellViewImpl, IViewObject_iface);
140 static inline IShellViewImpl *impl_from_IFolderView2(IFolderView2 *iface)
142 return CONTAINING_RECORD(iface, IShellViewImpl, IFolderView2_iface);
145 static inline IShellViewImpl *impl_from_IShellFolderView(IShellFolderView *iface)
147 return CONTAINING_RECORD(iface, IShellViewImpl, IShellFolderView_iface);
150 static inline IShellViewImpl *impl_from_IShellFolderViewDual3(IShellFolderViewDual3 *iface)
152 return CONTAINING_RECORD(iface, IShellViewImpl, IShellFolderViewDual3_iface);
155 /* ListView Header IDs */
156 #define LISTVIEW_COLUMN_NAME 0
157 #define LISTVIEW_COLUMN_SIZE 1
158 #define LISTVIEW_COLUMN_TYPE 2
159 #define LISTVIEW_COLUMN_TIME 3
160 #define LISTVIEW_COLUMN_ATTRIB 4
162 /*menu items */
163 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
164 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
165 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
167 #define ID_LISTVIEW 1
169 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
171 /*windowsx.h */
172 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
173 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
174 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
177 Items merged into the toolbar and the filemenu
179 typedef struct
180 { int idCommand;
181 int iImage;
182 int idButtonString;
183 int idMenuString;
184 BYTE bState;
185 BYTE bStyle;
186 } MYTOOLINFO, *LPMYTOOLINFO;
188 static const MYTOOLINFO Tools[] =
190 { FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, BTNS_BUTTON },
191 { FCIDM_SHVIEW_SMALLICON, 0, 0, IDS_VIEW_SMALL, TBSTATE_ENABLED, BTNS_BUTTON },
192 { FCIDM_SHVIEW_LISTVIEW, 0, 0, IDS_VIEW_LIST, TBSTATE_ENABLED, BTNS_BUTTON },
193 { FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, BTNS_BUTTON },
194 { -1, 0, 0, 0, 0, 0}
197 typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
199 /**********************************************************
201 * ##### helperfunctions for communication with ICommDlgBrowser #####
203 static BOOL IsInCommDlg(IShellViewImpl * This)
204 { return(This->pCommDlgBrowser != NULL);
207 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
209 HRESULT ret = S_OK;
211 if ( IsInCommDlg(This) )
213 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
214 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl);
215 TRACE("--0x%08x\n", ret);
217 return ret;
220 static HRESULT OnDefaultCommand(IShellViewImpl * This)
222 HRESULT ret = S_FALSE;
224 if (IsInCommDlg(This))
226 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
227 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);
228 TRACE("-- returns %08x\n", ret);
230 return ret;
233 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
235 HRESULT ret = S_FALSE;
237 if (IsInCommDlg(This))
239 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
240 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags);
241 TRACE("--\n");
243 return ret;
245 /**********************************************************
246 * set the toolbar of the filedialog buttons
248 * - activates the buttons from the shellbrowser according to
249 * the view state
251 static void CheckToolbar(IShellViewImpl * This)
253 LRESULT result;
255 TRACE("\n");
257 if (IsInCommDlg(This))
259 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
260 FCIDM_TB_SMALLICON, This->FolderSettings.ViewMode == FVM_LIST, &result);
261 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
262 FCIDM_TB_REPORTVIEW, This->FolderSettings.ViewMode == FVM_DETAILS, &result);
263 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
264 FCIDM_TB_SMALLICON, TRUE, &result);
265 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
266 FCIDM_TB_REPORTVIEW, TRUE, &result);
270 /**********************************************************
272 * ##### helperfunctions for initializing the view #####
274 /**********************************************************
275 * change the style of the listview control
277 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
279 DWORD tmpstyle;
281 TRACE("(%p)\n", This);
283 tmpstyle = GetWindowLongW(This->hWndList, GWL_STYLE);
284 SetWindowLongW(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
287 static DWORD ViewModeToListStyle(UINT ViewMode)
289 DWORD dwStyle;
291 TRACE("%d\n", ViewMode);
293 switch (ViewMode)
295 case FVM_ICON: dwStyle = LVS_ICON; break;
296 case FVM_DETAILS: dwStyle = LVS_REPORT; break;
297 case FVM_SMALLICON: dwStyle = LVS_SMALLICON; break;
298 case FVM_LIST: dwStyle = LVS_LIST; break;
299 default:
301 FIXME("ViewMode %d not implemented\n", ViewMode);
302 dwStyle = LVS_LIST;
303 break;
307 return dwStyle;
310 /**********************************************************
311 * ShellView_CreateList()
313 * - creates the list view window
315 static BOOL ShellView_CreateList (IShellViewImpl * This)
316 { DWORD dwStyle, dwExStyle;
318 TRACE("%p\n",This);
320 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
321 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
322 dwExStyle = WS_EX_CLIENTEDGE;
324 dwStyle |= ViewModeToListStyle(This->FolderSettings.ViewMode);
326 if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
327 if (This->FolderSettings.fFlags & FWF_DESKTOP)
328 This->FolderSettings.fFlags |= FWF_NOCLIENTEDGE | FWF_NOSCROLL;
329 if (This->FolderSettings.fFlags & FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
330 if (This->FolderSettings.fFlags & FWF_NOCLIENTEDGE)
331 dwExStyle &= ~WS_EX_CLIENTEDGE;
333 This->hWndList=CreateWindowExW( dwExStyle,
334 WC_LISTVIEWW,
335 NULL,
336 dwStyle,
337 0,0,0,0,
338 This->hWnd,
339 (HMENU)ID_LISTVIEW,
340 shell32_hInstance,
341 NULL);
343 if(!This->hWndList)
344 return FALSE;
346 This->ListViewSortInfo.bIsAscending = TRUE;
347 This->ListViewSortInfo.nHeaderID = -1;
348 This->ListViewSortInfo.nLastHeaderID = -1;
350 if (This->FolderSettings.fFlags & FWF_DESKTOP) {
352 * FIXME: look at the registry value
353 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
354 * and activate drop shadows if necessary
356 if (0)
357 SendMessageW(This->hWndList, LVM_SETTEXTBKCOLOR, 0, CLR_NONE);
358 else
359 SendMessageW(This->hWndList, LVM_SETTEXTBKCOLOR, 0, GetSysColor(COLOR_DESKTOP));
361 SendMessageW(This->hWndList, LVM_SETTEXTCOLOR, 0, RGB(255,255,255));
364 /* UpdateShellSettings(); */
365 return TRUE;
368 /**********************************************************
369 * ShellView_InitList()
371 * - adds all needed columns to the shellview
373 static void ShellView_InitList(IShellViewImpl *This)
375 IShellDetails *details = NULL;
376 HIMAGELIST big_icons, small_icons;
377 LVCOLUMNW lvColumn;
378 SHELLDETAILS sd;
379 WCHAR nameW[50];
380 HRESULT hr;
381 INT i;
383 TRACE("(%p)\n", This);
385 Shell_GetImageLists( &big_icons, &small_icons );
386 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
387 SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)small_icons);
388 SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)big_icons);
390 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
391 lvColumn.pszText = nameW;
393 if (!This->pSF2Parent)
395 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
396 if (hr != S_OK)
398 WARN("IShellFolder2/IShellDetails not supported\n");
399 return;
403 for (i = 0; 1; i++)
405 if (This->pSF2Parent)
406 hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
407 else
408 hr = IShellDetails_GetDetailsOf(details, NULL, i, &sd);
409 if (FAILED(hr)) break;
411 lvColumn.fmt = sd.fmt;
412 lvColumn.cx = sd.cxChar*8; /* chars->pixel */
413 StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
414 SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
417 if (details) IShellDetails_Release(details);
420 /**********************************************************
421 * ShellView_CompareItems()
423 * NOTES
424 * internal, CALLBACK for DSA_Sort
426 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
428 int ret;
429 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
431 if(!lpData) return 0;
433 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
434 TRACE("ret=%i\n",ret);
435 return ret;
438 /*************************************************************************
439 * ShellView_ListViewCompareItems
441 * Compare Function for the Listview (FileOpen Dialog)
443 * PARAMS
444 * lParam1 [I] the first ItemIdList to compare with
445 * lParam2 [I] the second ItemIdList to compare with
446 * lpData [I] The column ID for the header Ctrl to process
448 * RETURNS
449 * A negative value if the first item should precede the second,
450 * a positive value if the first item should follow the second,
451 * or zero if the two items are equivalent
453 * NOTES
454 * FIXME: function does what ShellView_CompareItems is supposed to do.
455 * unify it and figure out how to use the undocumented first parameter
456 * of IShellFolder_CompareIDs to do the job this function does and
457 * move this code to IShellFolder.
458 * make LISTVIEW_SORT_INFO obsolete
459 * the way this function works is only usable if we had only
460 * filesystemfolders (25/10/99 jsch)
462 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
464 INT nDiff=0;
465 FILETIME fd1, fd2;
466 char strName1[MAX_PATH], strName2[MAX_PATH];
467 BOOL bIsFolder1, bIsFolder2,bIsBothFolder;
468 LPITEMIDLIST pItemIdList1 = lParam1;
469 LPITEMIDLIST pItemIdList2 = lParam2;
470 LISTVIEW_SORT_INFO *pSortInfo = (LPLISTVIEW_SORT_INFO) lpData;
473 bIsFolder1 = _ILIsFolder(pItemIdList1);
474 bIsFolder2 = _ILIsFolder(pItemIdList2);
475 bIsBothFolder = bIsFolder1 && bIsFolder2;
477 /* When sorting between a File and a Folder, the Folder gets sorted first */
478 if( (bIsFolder1 || bIsFolder2) && !bIsBothFolder)
480 nDiff = bIsFolder1 ? -1 : 1;
482 else
484 /* Sort by Time: Folders or Files can be sorted */
486 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME)
488 _ILGetFileDateTime(pItemIdList1, &fd1);
489 _ILGetFileDateTime(pItemIdList2, &fd2);
490 nDiff = CompareFileTime(&fd2, &fd1);
492 /* Sort by Attribute: Folder or Files can be sorted */
493 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB)
495 _ILGetFileAttributes(pItemIdList1, strName1, MAX_PATH);
496 _ILGetFileAttributes(pItemIdList2, strName2, MAX_PATH);
497 nDiff = lstrcmpiA(strName1, strName2);
499 /* Sort by FileName: Folder or Files can be sorted */
500 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder)
502 /* Sort by Text */
503 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
504 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
505 nDiff = lstrcmpiA(strName1, strName2);
507 /* Sort by File Size, Only valid for Files */
508 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE)
510 nDiff = (INT)(_ILGetFileSize(pItemIdList1, NULL, 0) - _ILGetFileSize(pItemIdList2, NULL, 0));
512 /* Sort by File Type, Only valid for Files */
513 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TYPE)
515 /* Sort by Type */
516 _ILGetFileType(pItemIdList1, strName1, MAX_PATH);
517 _ILGetFileType(pItemIdList2, strName2, MAX_PATH);
518 nDiff = lstrcmpiA(strName1, strName2);
521 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
523 if(nDiff == 0)
525 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
526 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
527 nDiff = lstrcmpiA(strName1, strName2);
530 if(!pSortInfo->bIsAscending)
532 nDiff = -nDiff;
535 return nDiff;
539 /**********************************************************
540 * LV_FindItemByPidl()
542 static int LV_FindItemByPidl(
543 IShellViewImpl * This,
544 LPCITEMIDLIST pidl)
546 LVITEMW lvItem;
547 lvItem.iSubItem = 0;
548 lvItem.mask = LVIF_PARAM;
549 for(lvItem.iItem = 0;
550 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
551 lvItem.iItem++)
553 LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam;
554 HRESULT hr = IShellFolder_CompareIDs(This->pSFParent, 0, pidl, currentpidl);
555 if(SUCCEEDED(hr) && !HRESULT_CODE(hr))
557 return lvItem.iItem;
560 return -1;
563 /**********************************************************
564 * LV_AddItem()
566 static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl)
568 LVITEMW lvItem;
570 TRACE("(%p)(pidl=%p)\n", This, pidl);
572 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
573 lvItem.iItem = SendMessageW(This->hWndList, LVM_GETITEMCOUNT, 0, 0); /*add the item to the end of the list*/
574 lvItem.iSubItem = 0;
575 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/
576 lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/
577 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
578 return ListView_InsertItemW(This->hWndList, &lvItem) != -1;
581 /**********************************************************
582 * LV_RenameItem()
584 static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew )
586 int nItem;
587 LVITEMW lvItem;
589 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew);
591 nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld));
592 if ( -1 != nItem )
594 lvItem.mask = LVIF_PARAM; /* only the pidl */
595 lvItem.iItem = nItem;
596 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
598 SHFree((LPITEMIDLIST)lvItem.lParam);
599 lvItem.mask = LVIF_PARAM;
600 lvItem.iItem = nItem;
601 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */
602 SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
603 SendMessageW(This->hWndList, LVM_UPDATE, nItem, 0);
604 return TRUE; /* FIXME: better handling */
606 return FALSE;
608 /**********************************************************
609 * ShellView_FillList()
611 * - gets the objectlist from the shellfolder
612 * - sorts the list
613 * - fills the list into the view
616 static INT CALLBACK fill_list( LPVOID ptr, LPVOID arg )
618 LPITEMIDLIST pidl = ptr;
619 IShellViewImpl *This = arg;
620 /* in a commdlg This works as a filemask*/
621 if ( IncludeObject(This, pidl)==S_OK ) LV_AddItem(This, pidl);
622 SHFree(pidl);
623 return TRUE;
626 static HRESULT ShellView_FillList(IShellViewImpl *This)
628 IFolderView2 *folderview = &This->IFolderView2_iface;
629 LPENUMIDLIST pEnumIDList;
630 LPITEMIDLIST pidl;
631 DWORD fetched;
632 HRESULT hr;
633 HDPA hdpa;
635 TRACE("(%p)\n", This);
637 /* get the itemlist from the shfolder*/
638 hr = IShellFolder_EnumObjects(This->pSFParent, This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
639 if (hr != S_OK) return hr;
641 /* create a pointer array */
642 hdpa = DPA_Create(16);
643 if (!hdpa)
645 IEnumIDList_Release(pEnumIDList);
646 return E_OUTOFMEMORY;
649 /* copy the items into the array*/
650 while((S_OK == IEnumIDList_Next(pEnumIDList, 1, &pidl, &fetched)) && fetched)
652 if (DPA_InsertPtr(hdpa, DPA_GetPtrCount(hdpa), pidl) == -1)
654 SHFree(pidl);
658 /* sort the array */
659 DPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
661 IFolderView2_SetRedraw(folderview, FALSE);
662 DPA_DestroyCallback(hdpa, fill_list, This);
663 IFolderView2_SetRedraw(folderview, TRUE);
665 IEnumIDList_Release(pEnumIDList);
667 return S_OK;
670 /**********************************************************
671 * ShellView_OnCreate()
673 static LRESULT ShellView_OnCreate(IShellViewImpl *This)
675 IShellView3 *iface = &This->IShellView3_iface;
676 static const WCHAR accel_nameW[] = {'s','h','v','_','a','c','c','e','l',0};
677 IPersistFolder2 *ppf2;
678 IDropTarget* pdt;
679 HRESULT hr;
681 TRACE("(%p)\n", This);
683 if (ShellView_CreateList(This))
685 ShellView_InitList(This);
686 ShellView_FillList(This);
689 hr = IShellView3_QueryInterface(iface, &IID_IDropTarget, (void**)&pdt);
690 if (hr == S_OK)
692 RegisterDragDrop(This->hWnd, pdt);
693 IDropTarget_Release(pdt);
696 /* register for receiving notifications */
697 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);
698 if (hr == S_OK)
700 LPITEMIDLIST raw_pidl;
701 SHChangeNotifyEntry ntreg;
703 hr = IPersistFolder2_GetCurFolder(ppf2, &raw_pidl);
704 if(SUCCEEDED(hr))
706 LPITEMIDLIST computer_pidl;
707 SHGetFolderLocation(NULL,CSIDL_DRIVES,NULL,0,&computer_pidl);
708 if(ILIsParent(computer_pidl,raw_pidl,FALSE))
710 /* Normalize the pidl to unixfs to workaround an issue with
711 * sending notifications on dos paths
713 WCHAR path[MAX_PATH];
714 SHGetPathFromIDListW(raw_pidl,path);
715 SHParseDisplayName(path,NULL,(LPITEMIDLIST*)&ntreg.pidl,0,NULL);
716 SHFree(raw_pidl);
718 else
719 ntreg.pidl = raw_pidl;
720 ntreg.fRecursive = TRUE;
721 This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNRF_InterruptLevel, SHCNE_ALLEVENTS,
722 SHV_CHANGE_NOTIFY, 1, &ntreg);
723 SHFree((LPITEMIDLIST)ntreg.pidl);
724 SHFree(computer_pidl);
726 IPersistFolder2_Release(ppf2);
729 This->hAccel = LoadAcceleratorsW(shell32_hInstance, accel_nameW);
731 return S_OK;
734 /**********************************************************
735 * #### Handling of the menus ####
738 /**********************************************************
739 * ShellView_BuildFileMenu()
741 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
742 { WCHAR szText[MAX_PATH];
743 MENUITEMINFOW mii;
744 int nTools,i;
745 HMENU hSubMenu;
747 TRACE("(%p)\n",This);
749 hSubMenu = CreatePopupMenu();
750 if(hSubMenu)
751 { /*get the number of items in our global array*/
752 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){}
754 /*add the menu items*/
755 for(i = 0; i < nTools; i++)
757 LoadStringW(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
759 ZeroMemory(&mii, sizeof(mii));
760 mii.cbSize = sizeof(mii);
761 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
763 if(BTNS_SEP != Tools[i].bStyle) /* no separator*/
765 mii.fType = MFT_STRING;
766 mii.fState = MFS_ENABLED;
767 mii.dwTypeData = szText;
768 mii.wID = Tools[i].idCommand;
770 else
772 mii.fType = MFT_SEPARATOR;
774 /* tack This item onto the end of the menu */
775 InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &mii);
778 TRACE("-- return (menu=%p)\n",hSubMenu);
779 return hSubMenu;
781 /**********************************************************
782 * ShellView_MergeFileMenu()
784 static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu)
786 TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
788 if (hSubMenu)
790 static const WCHAR dummyW[] = {'d','u','m','m','y','4','5',0};
791 MENUITEMINFOW mii;
793 /* insert This item at the beginning of the menu */
795 mii.cbSize = sizeof(mii);
796 mii.fMask = MIIM_ID | MIIM_TYPE;
797 mii.wID = 0;
798 mii.fType = MFT_SEPARATOR;
799 InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
801 mii.cbSize = sizeof(mii);
802 mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
803 mii.dwTypeData = (LPWSTR)dummyW;
804 mii.fState = MFS_ENABLED;
805 mii.wID = IDM_MYFILEITEM;
806 mii.fType = MFT_STRING;
807 InsertMenuItemW(hSubMenu, 0, TRUE, &mii);
810 TRACE("--\n");
813 /**********************************************************
814 * ShellView_MergeViewMenu()
817 static void ShellView_MergeViewMenu(IShellViewImpl *This, HMENU hSubMenu)
819 TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
821 /* add a separator at the correct position in the menu */
822 if (hSubMenu)
824 static const WCHAR menuW[] = {'M','E','N','U','_','0','0','1',0};
825 static const WCHAR viewW[] = {'V','i','e','w',0};
826 MENUITEMINFOW mii;
828 memset(&mii, 0, sizeof(mii));
829 mii.cbSize = sizeof(mii);
830 mii.fMask = MIIM_ID | MIIM_TYPE;
831 mii.wID = 0;
832 mii.fType = MFT_SEPARATOR;
833 InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
835 mii.cbSize = sizeof(mii);
836 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
837 mii.fType = MFT_STRING;
838 mii.dwTypeData = (LPWSTR)viewW;
839 mii.hSubMenu = LoadMenuW(shell32_hInstance, menuW);
840 InsertMenuItemW(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
844 /**********************************************************
845 * ShellView_GetSelections()
847 * - fills the this->apidl list with the selected objects
849 * RETURNS
850 * number of selected items
852 static UINT ShellView_GetSelections(IShellViewImpl * This)
854 LVITEMW lvItem;
855 UINT i = 0;
857 SHFree(This->apidl);
859 This->cidl = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
860 This->apidl = SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
862 TRACE("selected=%i\n", This->cidl);
864 if(This->apidl)
866 TRACE("-- Items selected =%u\n", This->cidl);
868 lvItem.mask = LVIF_STATE | LVIF_PARAM;
869 lvItem.stateMask = LVIS_SELECTED;
870 lvItem.iItem = 0;
871 lvItem.iSubItem = 0;
873 while(ListView_GetItemW(This->hWndList, &lvItem) && (i < This->cidl))
875 if(lvItem.state & LVIS_SELECTED)
877 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;
878 i++;
879 TRACE("-- selected Item found\n");
881 lvItem.iItem++;
884 return This->cidl;
888 /**********************************************************
889 * ShellView_OpenSelectedItems()
891 static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
893 static UINT CF_IDLIST = 0;
894 HRESULT hr;
895 IDataObject* selection;
896 FORMATETC fetc;
897 STGMEDIUM stgm;
898 LPIDA pIDList;
899 LPCITEMIDLIST parent_pidl;
900 WCHAR parent_path[MAX_PATH];
901 LPCWSTR parent_dir = NULL;
902 SFGAOF attribs;
903 int i;
905 if (0 == ShellView_GetSelections(This))
907 return S_OK;
909 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
910 (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
911 0, (LPVOID *)&selection);
912 if (FAILED(hr))
913 return hr;
915 if (0 == CF_IDLIST)
917 CF_IDLIST = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
919 fetc.cfFormat = CF_IDLIST;
920 fetc.ptd = NULL;
921 fetc.dwAspect = DVASPECT_CONTENT;
922 fetc.lindex = -1;
923 fetc.tymed = TYMED_HGLOBAL;
925 hr = IDataObject_QueryGetData(selection, &fetc);
926 if (FAILED(hr))
927 return hr;
929 hr = IDataObject_GetData(selection, &fetc, &stgm);
930 if (FAILED(hr))
931 return hr;
933 pIDList = GlobalLock(stgm.u.hGlobal);
935 parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
936 hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &parent_pidl, &attribs);
937 if (SUCCEEDED(hr) && (attribs & SFGAO_FILESYSTEM) &&
938 SHGetPathFromIDListW(parent_pidl, parent_path))
940 parent_dir = parent_path;
943 for (i = pIDList->cidl; i > 0; --i)
945 LPCITEMIDLIST pidl;
947 pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
949 attribs = SFGAO_FOLDER;
950 hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &attribs);
952 if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
954 SHELLEXECUTEINFOW shexinfo;
956 shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
957 shexinfo.fMask = SEE_MASK_INVOKEIDLIST; /* SEE_MASK_IDLIST is also possible. */
958 shexinfo.hwnd = NULL;
959 shexinfo.lpVerb = NULL;
960 shexinfo.lpFile = NULL;
961 shexinfo.lpParameters = NULL;
962 shexinfo.lpDirectory = parent_dir;
963 shexinfo.nShow = SW_NORMAL;
964 shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
966 ShellExecuteExW(&shexinfo); /* Discard error/success info */
968 ILFree(shexinfo.lpIDList);
972 GlobalUnlock(stgm.u.hGlobal);
973 ReleaseStgMedium(&stgm);
975 IDataObject_Release(selection);
977 return S_OK;
980 /**********************************************************
981 * ShellView_DoContextMenu()
983 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault)
984 { UINT uCommand;
985 DWORD wFlags;
986 HMENU hMenu;
987 BOOL fExplore = FALSE;
988 HWND hwndTree = 0;
989 LPCONTEXTMENU pContextMenu = NULL;
990 CMINVOKECOMMANDINFO cmi;
992 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
994 /* look, what's selected and create a context menu object of it*/
995 if( ShellView_GetSelections(This) )
997 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, (LPCITEMIDLIST*)This->apidl,
998 &IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);
1000 if(pContextMenu)
1002 TRACE("-- pContextMenu\n");
1003 hMenu = CreatePopupMenu();
1005 if( hMenu )
1007 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
1008 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
1010 TRACE("-- explore mode\n");
1011 fExplore = TRUE;
1014 /* build the flags depending on what we can do with the selected item */
1015 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
1017 /* let the ContextMenu merge its items in */
1018 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))
1020 if (This->FolderSettings.fFlags & FWF_DESKTOP)
1021 SetMenuDefaultItem(hMenu, FCIDM_SHVIEW_OPEN, MF_BYCOMMAND);
1023 if( bDefault )
1025 TRACE("-- get menu default command\n");
1026 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS);
1028 else
1030 TRACE("-- track popup\n");
1031 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
1034 if(uCommand > 0)
1036 TRACE("-- uCommand=%u\n", uCommand);
1037 if (uCommand==FCIDM_SHVIEW_OPEN && IsInCommDlg(This))
1039 TRACE("-- dlg: OnDefaultCommand\n");
1040 if (OnDefaultCommand(This) != S_OK)
1042 ShellView_OpenSelectedItems(This);
1045 else
1047 TRACE("-- explore -- invoke command\n");
1048 ZeroMemory(&cmi, sizeof(cmi));
1049 cmi.cbSize = sizeof(cmi);
1050 cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */
1051 cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1052 IContextMenu_InvokeCommand(pContextMenu, &cmi);
1055 DestroyMenu(hMenu);
1058 if (pContextMenu)
1059 IContextMenu_Release(pContextMenu);
1062 else /* background context menu */
1064 IContextMenu2 *pCM;
1066 hMenu = CreatePopupMenu();
1068 BackgroundMenu_Constructor(This->pSFParent, FALSE, &IID_IContextMenu2, (void**)&pCM);
1069 IContextMenu2_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
1071 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
1072 DestroyMenu(hMenu);
1074 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand);
1076 ZeroMemory(&cmi, sizeof(cmi));
1077 cmi.cbSize = sizeof(cmi);
1078 cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1079 cmi.hwnd = This->hWndParent;
1080 IContextMenu2_InvokeCommand(pCM, &cmi);
1082 IContextMenu2_Release(pCM);
1086 /**********************************************************
1087 * ##### message handling #####
1090 /**********************************************************
1091 * ShellView_OnSize()
1093 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight)
1095 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight);
1097 /*resize the ListView to fit our window*/
1098 if(This->hWndList)
1100 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);
1103 return S_OK;
1105 /**********************************************************
1106 * ShellView_OnDeactivate()
1108 * NOTES
1109 * internal
1111 static void ShellView_OnDeactivate(IShellViewImpl * This)
1113 TRACE("%p\n",This);
1115 if(This->uState != SVUIA_DEACTIVATE)
1117 if(This->hMenu)
1119 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);
1120 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);
1121 DestroyMenu(This->hMenu);
1122 This->hMenu = 0;
1125 This->uState = SVUIA_DEACTIVATE;
1129 /**********************************************************
1130 * ShellView_OnActivate()
1132 static LRESULT ShellView_OnActivate(IShellViewImpl *This, UINT uState)
1134 OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
1135 MENUITEMINFOW mii;
1137 TRACE("(%p) uState=%x\n",This,uState);
1139 /* don't do anything if the state isn't really changing */
1140 if (This->uState == uState) return S_OK;
1142 ShellView_OnDeactivate(This);
1144 /* only do This if we are active */
1145 if (uState != SVUIA_DEACTIVATE)
1147 /* merge the menus */
1148 This->hMenu = CreateMenu();
1150 if (This->hMenu)
1152 static const WCHAR dummyW[] = {'d','u','m','m','y',' ','3','1',0};
1154 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
1155 TRACE("-- after fnInsertMenusSB\n");
1157 mii.cbSize = sizeof(mii);
1158 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
1159 mii.fType = MFT_STRING;
1160 mii.fState = MFS_ENABLED;
1161 mii.wID = 0;
1162 mii.hSubMenu = ShellView_BuildFileMenu(This);
1163 mii.hbmpChecked = NULL;
1164 mii.hbmpUnchecked = NULL;
1165 mii.dwItemData = 0;
1166 /* build the top level menu get the menu item's text */
1167 mii.dwTypeData = (LPWSTR)dummyW;
1168 mii.cch = 0;
1169 mii.hbmpItem = NULL;
1171 /* insert our menu into the menu bar */
1172 if (mii.hSubMenu)
1173 InsertMenuItemW(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
1175 /* get the view menu so we can merge with it */
1176 memset(&mii, 0, sizeof(mii));
1177 mii.cbSize = sizeof(mii);
1178 mii.fMask = MIIM_SUBMENU;
1180 if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
1181 ShellView_MergeViewMenu(This, mii.hSubMenu);
1183 /* add the items that should only be added if we have the focus */
1184 if (SVUIA_ACTIVATE_FOCUS == uState)
1186 /* get the file menu so we can merge with it */
1187 memset(&mii, 0, sizeof(mii));
1188 mii.cbSize = sizeof(mii);
1189 mii.fMask = MIIM_SUBMENU;
1191 if (GetMenuItemInfoW(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
1192 ShellView_MergeFileMenu(This, mii.hSubMenu);
1195 TRACE("-- before fnSetMenuSB\n");
1196 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
1199 This->uState = uState;
1200 TRACE("--\n");
1201 return S_OK;
1204 /**********************************************************
1205 * ShellView_OnSetFocus()
1208 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
1210 TRACE("%p\n",This);
1212 /* Tell the browser one of our windows has received the focus. This
1213 should always be done before merging menus (OnActivate merges the
1214 menus) if one of our windows has the focus.*/
1216 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
1217 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
1219 /* Set the focus to the listview */
1220 SetFocus(This->hWndList);
1222 /* Notify the ICommDlgBrowser interface */
1223 OnStateChange(This,CDBOSC_SETFOCUS);
1225 return 0;
1228 /**********************************************************
1229 * ShellView_OnKillFocus()
1231 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
1233 TRACE("(%p) stub\n",This);
1235 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
1236 /* Notify the ICommDlgBrowser */
1237 OnStateChange(This,CDBOSC_KILLFOCUS);
1239 return 0;
1242 /**********************************************************
1243 * ShellView_OnCommand()
1245 * NOTES
1246 * the CmdIDs are the ones from the context menu
1248 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
1250 TRACE("(%p)->(0x%08x 0x%08x %p) stub\n",This, dwCmdID, dwCmd, hwndCmd);
1252 switch(dwCmdID)
1254 case FCIDM_SHVIEW_SMALLICON:
1255 This->FolderSettings.ViewMode = FVM_SMALLICON;
1256 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
1257 CheckToolbar(This);
1258 break;
1260 case FCIDM_SHVIEW_BIGICON:
1261 This->FolderSettings.ViewMode = FVM_ICON;
1262 SetStyle (This, LVS_ICON, LVS_TYPEMASK);
1263 CheckToolbar(This);
1264 break;
1266 case FCIDM_SHVIEW_LISTVIEW:
1267 This->FolderSettings.ViewMode = FVM_LIST;
1268 SetStyle (This, LVS_LIST, LVS_TYPEMASK);
1269 CheckToolbar(This);
1270 break;
1272 case FCIDM_SHVIEW_REPORTVIEW:
1273 This->FolderSettings.ViewMode = FVM_DETAILS;
1274 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
1275 CheckToolbar(This);
1276 break;
1278 /* the menu IDs for sorting are 0x30... see shell32.rc */
1279 case 0x30:
1280 case 0x31:
1281 case 0x32:
1282 case 0x33:
1283 This->ListViewSortInfo.nHeaderID = dwCmdID - 0x30;
1284 This->ListViewSortInfo.bIsAscending = TRUE;
1285 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1286 SendMessageW(This->hWndList, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems);
1287 break;
1289 default:
1290 TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID);
1292 return 0;
1295 /**********************************************************
1296 * ShellView_OnNotify()
1299 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
1300 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;
1301 NMLVDISPINFOW *lpdi = (NMLVDISPINFOW *)lpnmh;
1302 LPITEMIDLIST pidl;
1304 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);
1306 switch(lpnmh->code)
1308 case NM_SETFOCUS:
1309 TRACE("-- NM_SETFOCUS %p\n",This);
1310 ShellView_OnSetFocus(This);
1311 break;
1313 case NM_KILLFOCUS:
1314 TRACE("-- NM_KILLFOCUS %p\n",This);
1315 ShellView_OnDeactivate(This);
1316 /* Notify the ICommDlgBrowser interface */
1317 OnStateChange(This,CDBOSC_KILLFOCUS);
1318 break;
1320 case NM_CUSTOMDRAW:
1321 TRACE("-- NM_CUSTOMDRAW %p\n",This);
1322 return CDRF_DODEFAULT;
1324 case NM_RELEASEDCAPTURE:
1325 TRACE("-- NM_RELEASEDCAPTURE %p\n",This);
1326 break;
1328 case NM_CLICK:
1329 TRACE("-- NM_CLICK %p\n",This);
1330 break;
1332 case NM_RCLICK:
1333 TRACE("-- NM_RCLICK %p\n",This);
1334 break;
1336 case NM_DBLCLK:
1337 TRACE("-- NM_DBLCLK %p\n",This);
1338 if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
1339 break;
1341 case NM_RETURN:
1342 TRACE("-- NM_RETURN %p\n",This);
1343 if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This);
1344 break;
1346 case HDN_ENDTRACKW:
1347 TRACE("-- HDN_ENDTRACKW %p\n",This);
1348 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1349 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1350 break;
1352 case LVN_DELETEITEM:
1353 TRACE("-- LVN_DELETEITEM %p\n",This);
1354 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
1355 break;
1357 case LVN_DELETEALLITEMS:
1358 TRACE("-- LVN_DELETEALLITEMS %p\n",This);
1359 return FALSE;
1361 case LVN_INSERTITEM:
1362 TRACE("-- LVN_INSERTITEM (STUB)%p\n",This);
1363 break;
1365 case LVN_ITEMACTIVATE:
1366 TRACE("-- LVN_ITEMACTIVATE %p\n",This);
1367 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1368 break;
1370 case LVN_COLUMNCLICK:
1371 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem;
1372 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID)
1374 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending;
1376 else
1378 This->ListViewSortInfo.bIsAscending = TRUE;
1380 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1382 SendMessageW(lpnmlv->hdr.hwndFrom, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems);
1383 break;
1385 case LVN_GETDISPINFOA:
1386 case LVN_GETDISPINFOW:
1387 TRACE("-- LVN_GETDISPINFO %p\n",This);
1388 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1390 if(lpdi->item.mask & LVIF_TEXT) /* text requested */
1392 static WCHAR emptyW[] = { 0 };
1393 SHELLDETAILS sd;
1394 HRESULT hr;
1396 if (This->pSF2Parent)
1398 hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
1400 else
1402 IShellDetails *details;
1404 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
1405 if (hr == S_OK)
1407 hr = IShellDetails_GetDetailsOf(details, pidl, lpdi->item.iSubItem, &sd);
1408 IShellDetails_Release(details);
1410 else
1411 WARN("IShellFolder2/IShellDetails not supported\n");
1414 if (hr != S_OK)
1416 /* set to empty on failure */
1417 sd.str.uType = STRRET_WSTR;
1418 sd.str.u.pOleStr = emptyW;
1421 if (lpnmh->code == LVN_GETDISPINFOW)
1423 StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1424 TRACE("-- text=%s\n", debugstr_w(lpdi->item.pszText));
1426 else
1428 /* LVN_GETDISPINFOA - shouldn't happen */
1429 NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh;
1430 StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL);
1431 TRACE("-- text=%s\n", lpdiA->item.pszText);
1435 if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1437 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
1439 break;
1441 case LVN_ITEMCHANGED:
1442 TRACE("-- LVN_ITEMCHANGED %p\n",This);
1443 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1444 break;
1446 case LVN_BEGINDRAG:
1447 case LVN_BEGINRDRAG:
1448 TRACE("-- LVN_BEGINDRAG\n");
1450 if (ShellView_GetSelections(This))
1452 IDataObject * pda;
1453 DWORD dwAttributes = SFGAO_CANLINK;
1454 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
1456 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
1458 IDropSource *pds = &This->IDropSource_iface; /* own DropSource interface */
1460 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, (LPCITEMIDLIST*)This->apidl, &dwAttributes)))
1462 if (dwAttributes & SFGAO_CANLINK)
1464 dwEffect |= DROPEFFECT_LINK;
1468 if (pds)
1470 DWORD dwEffect2;
1471 DoDragDrop(pda, pds, dwEffect, &dwEffect2);
1473 IDataObject_Release(pda);
1476 break;
1478 case LVN_BEGINLABELEDITW:
1480 DWORD dwAttr = SFGAO_CANRENAME;
1481 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1483 TRACE("-- LVN_BEGINLABELEDITW %p\n",This);
1485 IShellFolder_GetAttributesOf(This->pSFParent, 1, (LPCITEMIDLIST*)&pidl, &dwAttr);
1486 if (SFGAO_CANRENAME & dwAttr)
1488 return FALSE;
1490 return TRUE;
1493 case LVN_ENDLABELEDITW:
1495 TRACE("-- LVN_ENDLABELEDITA %p\n",This);
1496 if (lpdi->item.pszText)
1498 HRESULT hr;
1499 LVITEMW lvItem;
1501 lvItem.iItem = lpdi->item.iItem;
1502 lvItem.iSubItem = 0;
1503 lvItem.mask = LVIF_PARAM;
1504 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
1506 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1507 hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidl);
1509 if(SUCCEEDED(hr) && pidl)
1511 lvItem.mask = LVIF_PARAM;
1512 lvItem.lParam = (LPARAM)pidl;
1513 SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem);
1514 return TRUE;
1517 return FALSE;
1520 case LVN_KEYDOWN:
1522 LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
1524 /* initiate a rename of the selected file or directory */
1525 switch (plvKeyDown->wVKey)
1527 case VK_F2:
1529 INT i = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
1531 if (i == 1)
1533 /* get selected item */
1534 i = SendMessageW(This->hWndList, LVM_GETNEXTITEM, -1, MAKELPARAM (LVNI_SELECTED, 0));
1536 SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, i, 0);
1537 SendMessageW(This->hWndList, LVM_EDITLABELW, i, 0);
1540 break;
1541 case VK_DELETE:
1543 UINT i, count;
1544 int item_index;
1545 LVITEMW item;
1546 LPITEMIDLIST* pItems;
1547 ISFHelper *psfhlp;
1548 HRESULT hr;
1550 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (void**)&psfhlp);
1551 if (hr != S_OK) return 0;
1553 if(!(count = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0)))
1555 ISFHelper_Release(psfhlp);
1556 return 0;
1559 /* allocate memory for the pidl array */
1560 pItems = HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST) * count);
1562 /* retrieve all selected items */
1563 i = 0;
1564 item_index = -1;
1566 while (count > i)
1568 /* get selected item */
1569 item_index = SendMessageW(This->hWndList, LVM_GETNEXTITEM, item_index,
1570 MAKELPARAM (LVNI_SELECTED, 0));
1571 item.iItem = item_index;
1572 item.mask = LVIF_PARAM;
1573 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM)&item);
1575 /* get item pidl */
1576 pItems[i] = (LPITEMIDLIST)item.lParam;
1578 i++;
1581 /* perform the item deletion */
1582 ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
1583 ISFHelper_Release(psfhlp);
1585 /* free pidl array memory */
1586 HeapFree(GetProcessHeap(), 0, pItems);
1588 break;
1590 case VK_F5:
1591 /* Initiate a refresh */
1592 IShellView_Refresh((IShellView*)This);
1593 break;
1595 case VK_BACK:
1597 LPSHELLBROWSER lpSb;
1598 if((lpSb = (LPSHELLBROWSER)SendMessageW(This->hWndParent, CWM_GETISHELLBROWSER, 0, 0)))
1600 IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT);
1603 break;
1605 default:
1606 FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown->wVKey);
1609 break;
1611 default:
1612 TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);
1613 break;
1615 return 0;
1618 /**********************************************************
1619 * ShellView_OnChange()
1622 static LRESULT ShellView_OnChange(IShellViewImpl * This, const LPCITEMIDLIST *pidls, LONG event)
1624 BOOL ret = TRUE;
1626 TRACE("(%p)->(%p, %p, 0x%08x)\n", This, pidls[0], pidls[1], event);
1628 switch (event)
1630 case SHCNE_MKDIR:
1631 case SHCNE_CREATE:
1632 LV_AddItem(This, pidls[0]);
1633 break;
1634 case SHCNE_RMDIR:
1635 case SHCNE_DELETE:
1637 INT i = LV_FindItemByPidl(This, ILFindLastID(pidls[0]));
1638 ret = SendMessageW(This->hWndList, LVM_DELETEITEM, i, 0);
1639 break;
1641 case SHCNE_RENAMEFOLDER:
1642 case SHCNE_RENAMEITEM:
1643 LV_RenameItem(This, pidls[0], pidls[1]);
1644 break;
1645 case SHCNE_UPDATEITEM:
1646 break;
1648 return ret;
1650 /**********************************************************
1651 * ShellView_WndProc
1654 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
1656 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
1657 LPCREATESTRUCTW lpcs;
1659 TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
1661 switch (uMessage)
1663 case WM_NCCREATE:
1664 lpcs = (LPCREATESTRUCTW)lParam;
1665 pThis = lpcs->lpCreateParams;
1666 SetWindowLongPtrW(hWnd, GWLP_USERDATA, (ULONG_PTR)pThis);
1667 pThis->hWnd = hWnd; /*set the window handle*/
1668 break;
1670 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
1671 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis);
1672 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis);
1673 case WM_CREATE: return ShellView_OnCreate(pThis);
1674 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1675 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
1676 case WM_COMMAND: return ShellView_OnCommand(pThis,
1677 GET_WM_COMMAND_ID(wParam, lParam),
1678 GET_WM_COMMAND_CMD(wParam, lParam),
1679 GET_WM_COMMAND_HWND(wParam, lParam));
1680 case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (const LPCITEMIDLIST*)wParam, (LONG)lParam);
1682 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE);
1683 return 0;
1685 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList);
1686 break;
1688 case WM_GETDLGCODE: return SendMessageW(pThis->hWndList, uMessage, 0, 0);
1689 case WM_SETFONT: return SendMessageW(pThis->hWndList, WM_SETFONT, wParam, lParam);
1690 case WM_GETFONT: return SendMessageW(pThis->hWndList, WM_GETFONT, wParam, lParam);
1692 case WM_DESTROY:
1693 RevokeDragDrop(pThis->hWnd);
1694 SHChangeNotifyDeregister(pThis->hNotify);
1695 break;
1697 case WM_ERASEBKGND:
1698 if ((pThis->FolderSettings.fFlags & FWF_DESKTOP) ||
1699 (pThis->FolderSettings.fFlags & FWF_TRANSPARENT))
1700 return 1;
1701 break;
1704 return DefWindowProcW(hWnd, uMessage, wParam, lParam);
1706 /**********************************************************
1709 * The INTERFACE of the IShellView object
1712 **********************************************************
1713 * IShellView_QueryInterface
1715 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView3 *iface, REFIID riid, void **ppvObj)
1717 IShellViewImpl *This = impl_from_IShellView3(iface);
1719 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
1721 *ppvObj = NULL;
1723 if(IsEqualIID(riid, &IID_IUnknown) ||
1724 IsEqualIID(riid, &IID_IShellView) ||
1725 IsEqualIID(riid, &IID_IShellView2) ||
1726 IsEqualIID(riid, &IID_IShellView3))
1728 *ppvObj = &This->IShellView3_iface;
1730 else if(IsEqualIID(riid, &IID_IShellFolderView))
1732 *ppvObj = &This->IShellFolderView_iface;
1734 else if(IsEqualIID(riid, &IID_IFolderView) ||
1735 IsEqualIID(riid, &IID_IFolderView2))
1737 *ppvObj = &This->IFolderView2_iface;
1739 else if(IsEqualIID(riid, &IID_IOleCommandTarget))
1741 *ppvObj = &This->IOleCommandTarget_iface;
1743 else if(IsEqualIID(riid, &IID_IDropTarget))
1745 *ppvObj = &This->IDropTarget_iface;
1747 else if(IsEqualIID(riid, &IID_IDropSource))
1749 *ppvObj = &This->IDropSource_iface;
1751 else if(IsEqualIID(riid, &IID_IViewObject))
1753 *ppvObj = &This->IViewObject_iface;
1756 if(*ppvObj)
1758 IUnknown_AddRef( (IUnknown*)*ppvObj );
1759 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1760 return S_OK;
1762 TRACE("-- Interface: E_NOINTERFACE\n");
1763 return E_NOINTERFACE;
1766 /**********************************************************
1767 * IShellView_AddRef
1769 static ULONG WINAPI IShellView_fnAddRef(IShellView3 *iface)
1771 IShellViewImpl *This = impl_from_IShellView3(iface);
1772 ULONG refCount = InterlockedIncrement(&This->ref);
1774 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
1776 return refCount;
1778 /**********************************************************
1779 * IShellView_Release
1781 static ULONG WINAPI IShellView_fnRelease(IShellView3 *iface)
1783 IShellViewImpl *This = impl_from_IShellView3(iface);
1784 ULONG refCount = InterlockedDecrement(&This->ref);
1786 TRACE("(%p)->(count=%i)\n", This, refCount + 1);
1788 if (!refCount)
1790 TRACE(" destroying IShellView(%p)\n",This);
1792 DestroyWindow(This->hWndList);
1794 if(This->pSFParent)
1795 IShellFolder_Release(This->pSFParent);
1797 if(This->pSF2Parent)
1798 IShellFolder2_Release(This->pSF2Parent);
1800 SHFree(This->apidl);
1802 if(This->pAdvSink)
1803 IAdviseSink_Release(This->pAdvSink);
1805 HeapFree(GetProcessHeap(),0,This);
1807 return refCount;
1810 /**********************************************************
1811 * ShellView_GetWindow
1813 static HRESULT WINAPI IShellView_fnGetWindow(IShellView3 *iface, HWND *phWnd)
1815 IShellViewImpl *This = impl_from_IShellView3(iface);
1817 TRACE("(%p)\n", This);
1819 *phWnd = This->hWnd;
1820 return S_OK;
1823 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView3 *iface, BOOL mode)
1825 IShellViewImpl *This = impl_from_IShellView3(iface);
1826 TRACE("(%p)->(%d)\n", This, mode);
1827 return E_NOTIMPL;
1830 /**********************************************************
1831 * IShellView_TranslateAccelerator
1833 * FIXME:
1834 * use the accel functions
1836 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView3 *iface, MSG *lpmsg)
1838 #if 0
1839 IShellViewImpl *This = (IShellViewImpl *)iface;
1841 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%x wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1842 #endif
1844 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST))
1846 TRACE("-- key=0x04%lx\n",lpmsg->wParam) ;
1848 return S_FALSE; /* not handled */
1851 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView3 *iface, BOOL fEnable)
1853 IShellViewImpl *This = impl_from_IShellView3(iface);
1855 FIXME("(%p) stub\n", This);
1857 return E_NOTIMPL;
1860 static HRESULT WINAPI IShellView_fnUIActivate(IShellView3 *iface, UINT uState)
1862 IShellViewImpl *This = impl_from_IShellView3(iface);
1865 CHAR szName[MAX_PATH];
1867 LRESULT lResult;
1868 int nPartArray[1] = {-1};
1870 TRACE("(%p)->(state=%x) stub\n",This, uState);
1872 /*don't do anything if the state isn't really changing*/
1873 if(This->uState == uState)
1875 return S_OK;
1878 /*OnActivate handles the menu merging and internal state*/
1879 ShellView_OnActivate(This, uState);
1881 /*only do This if we are active*/
1882 if(uState != SVUIA_DEACTIVATE)
1886 GetFolderPath is not a method of IShellFolder
1887 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1889 /* set the number of parts */
1890 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1891 (LPARAM)nPartArray, &lResult);
1893 /* set the text for the parts */
1895 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1896 0, (LPARAM)szName, &lResult);
1900 return S_OK;
1903 static HRESULT WINAPI IShellView_fnRefresh(IShellView3 *iface)
1905 IShellViewImpl *This = impl_from_IShellView3(iface);
1907 TRACE("(%p)\n", This);
1909 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
1910 ShellView_FillList(This);
1912 return S_OK;
1915 static HRESULT WINAPI IShellView_fnCreateViewWindow(IShellView3 *iface, IShellView *prev_view,
1916 const FOLDERSETTINGS *settings, IShellBrowser *owner, RECT *rect, HWND *hWnd)
1918 IShellViewImpl *This = impl_from_IShellView3(iface);
1919 TRACE("(%p)->(%p %p %p %p %p)\n", This, prev_view, settings, owner, rect, hWnd);
1920 return IShellView3_CreateViewWindow3(iface, owner, prev_view, SV3CVW3_DEFAULT,
1921 settings->fFlags, settings->fFlags, settings->ViewMode, NULL, rect, hWnd);
1924 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView3 *iface)
1926 IShellViewImpl *This = impl_from_IShellView3(iface);
1928 TRACE("(%p)\n", This);
1930 if (!This->hWnd)
1931 return S_OK;
1933 /* Make absolutely sure all our UI is cleaned up. */
1934 IShellView3_UIActivate(iface, SVUIA_DEACTIVATE);
1936 if (This->hMenu)
1937 DestroyMenu(This->hMenu);
1939 DestroyWindow(This->hWnd);
1940 if (This->pShellBrowser) IShellBrowser_Release(This->pShellBrowser);
1941 if (This->pCommDlgBrowser) ICommDlgBrowser_Release(This->pCommDlgBrowser);
1943 This->hMenu = NULL;
1944 This->hWnd = NULL;
1945 This->pShellBrowser = NULL;
1946 This->pCommDlgBrowser = NULL;
1948 return S_OK;
1951 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView3 *iface, LPFOLDERSETTINGS lpfs)
1953 IShellViewImpl *This = impl_from_IShellView3(iface);
1955 TRACE("(%p)->(%p) vmode=%x flags=%x\n", This, lpfs,
1956 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
1958 if (!lpfs) return E_INVALIDARG;
1959 *lpfs = This->FolderSettings;
1960 return S_OK;
1963 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView3 *iface, DWORD dwReserved,
1964 LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1966 IShellViewImpl *This = impl_from_IShellView3(iface);
1967 FIXME("(%p) stub\n", This);
1968 return E_NOTIMPL;
1971 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView3 *iface)
1973 IShellViewImpl *This = impl_from_IShellView3(iface);
1974 FIXME("(%p) stub\n", This);
1975 return S_OK;
1978 static HRESULT WINAPI IShellView_fnSelectItem(IShellView3 *iface, LPCITEMIDLIST pidl, UINT flags)
1980 IShellViewImpl *This = impl_from_IShellView3(iface);
1981 int i;
1983 TRACE("(%p)->(pidl=%p, 0x%08x)\n",This, pidl, flags);
1985 i = LV_FindItemByPidl(This, pidl);
1986 if (i == -1) return S_OK;
1988 return IFolderView2_SelectItem(&This->IFolderView2_iface, i, flags);
1991 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView3 *iface, UINT uItem, REFIID riid,
1992 void **ppvOut)
1994 IShellViewImpl *This = impl_from_IShellView3(iface);
1995 HRESULT hr = E_NOINTERFACE;
1997 TRACE("(%p)->(0x%08x, %s, %p)\n",This, uItem, debugstr_guid(riid), ppvOut);
1999 *ppvOut = NULL;
2001 switch(uItem)
2003 case SVGIO_BACKGROUND:
2005 if (IsEqualIID(&IID_IContextMenu, riid))
2006 return BackgroundMenu_Constructor(This->pSFParent, FALSE, riid, ppvOut);
2007 else if (IsEqualIID(&IID_IDispatch, riid)) {
2008 *ppvOut = &This->IShellFolderViewDual3_iface;
2009 IShellFolderViewDual3_AddRef(&This->IShellFolderViewDual3_iface);
2010 return S_OK;
2012 else
2013 FIXME("unsupported interface requested %s\n", debugstr_guid(riid));
2015 break;
2017 case SVGIO_SELECTION:
2018 ShellView_GetSelections(This);
2019 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, (LPCITEMIDLIST*)This->apidl, riid, 0, ppvOut);
2020 break;
2022 default:
2023 FIXME("unimplemented for uItem = 0x%08x\n", uItem);
2025 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
2027 return hr;
2030 static HRESULT WINAPI IShellView2_fnGetView(IShellView3 *iface, SHELLVIEWID *view_guid, ULONG view_type)
2032 FIXME("(%p)->(%s, %#x) stub!\n", iface, debugstr_guid(view_guid), view_type);
2033 return E_NOTIMPL;
2036 static HRESULT WINAPI IShellView2_fnCreateViewWindow2(IShellView3 *iface, SV2CVW2_PARAMS *view_params)
2038 IShellViewImpl *This = impl_from_IShellView3(iface);
2039 TRACE("(%p)->(%p)\n", This, view_params);
2040 return IShellView3_CreateViewWindow3(iface, view_params->psbOwner, view_params->psvPrev,
2041 SV3CVW3_DEFAULT, view_params->pfs->fFlags, view_params->pfs->fFlags,
2042 view_params->pfs->ViewMode, view_params->pvid, view_params->prcView, &view_params->hwndView);
2045 static HRESULT WINAPI IShellView2_fnHandleRename(IShellView3 *iface, LPCITEMIDLIST new_pidl)
2047 FIXME("(%p)->(new_pidl %p) stub!\n", iface, new_pidl);
2048 return E_NOTIMPL;
2051 static HRESULT WINAPI IShellView2_fnSelectAndPositionItem(IShellView3 *iface, LPCITEMIDLIST item,
2052 UINT flags, POINT *point)
2054 IShellViewImpl *This = impl_from_IShellView3(iface);
2055 TRACE("(%p)->(item %p, flags %#x, point %p)\n", This, item, flags, point);
2056 return IFolderView2_SelectAndPositionItems(&This->IFolderView2_iface, 1, &item, point, flags);
2059 static HRESULT WINAPI IShellView3_fnCreateViewWindow3(IShellView3 *iface, IShellBrowser *owner,
2060 IShellView *prev_view, SV3CVW3_FLAGS view_flags, FOLDERFLAGS mask, FOLDERFLAGS flags,
2061 FOLDERVIEWMODE mode, const SHELLVIEWID *view_id, const RECT *rect, HWND *hwnd)
2063 IShellViewImpl *This = impl_from_IShellView3(iface);
2064 INITCOMMONCONTROLSEX icex;
2065 WNDCLASSW wc;
2066 HRESULT hr;
2067 HWND wnd;
2069 TRACE("(%p)->(%p %p 0x%08x 0x%08x 0x%08x %d %s %s %p)\n", This, owner, prev_view, view_flags,
2070 mask, flags, mode, debugstr_guid(view_id), wine_dbgstr_rect(rect), hwnd);
2072 icex.dwSize = sizeof(icex);
2073 icex.dwICC = ICC_LISTVIEW_CLASSES;
2074 InitCommonControlsEx(&icex);
2076 *hwnd = NULL;
2078 if (!owner || This->hWnd)
2079 return E_UNEXPECTED;
2081 if (view_flags != SV3CVW3_DEFAULT)
2082 FIXME("unsupported view flags 0x%08x\n", view_flags);
2084 /* Set up the member variables */
2085 This->pShellBrowser = owner;
2086 This->FolderSettings.ViewMode = mode;
2087 This->FolderSettings.fFlags = mask & flags;
2089 if (view_id)
2091 if (IsEqualGUID(view_id, &VID_LargeIcons))
2092 This->FolderSettings.ViewMode = FVM_ICON;
2093 else if (IsEqualGUID(view_id, &VID_SmallIcons))
2094 This->FolderSettings.ViewMode = FVM_SMALLICON;
2095 else if (IsEqualGUID(view_id, &VID_List))
2096 This->FolderSettings.ViewMode = FVM_LIST;
2097 else if (IsEqualGUID(view_id, &VID_Details))
2098 This->FolderSettings.ViewMode = FVM_DETAILS;
2099 else if (IsEqualGUID(view_id, &VID_Thumbnails))
2100 This->FolderSettings.ViewMode = FVM_THUMBNAIL;
2101 else if (IsEqualGUID(view_id, &VID_Tile))
2102 This->FolderSettings.ViewMode = FVM_TILE;
2103 else if (IsEqualGUID(view_id, &VID_ThumbStrip))
2104 This->FolderSettings.ViewMode = FVM_THUMBSTRIP;
2105 else
2106 FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id));
2109 /* Get our parent window */
2110 IShellBrowser_AddRef(This->pShellBrowser);
2111 IShellBrowser_GetWindow(This->pShellBrowser, &This->hWndParent);
2113 /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2114 This->pCommDlgBrowser = NULL;
2115 hr = IShellBrowser_QueryInterface(This->pShellBrowser, &IID_ICommDlgBrowser, (void **)&This->pCommDlgBrowser);
2116 if (hr == S_OK)
2117 TRACE("-- CommDlgBrowser %p\n", This->pCommDlgBrowser);
2119 /* If our window class has not been registered, then do so */
2120 if (!GetClassInfoW(shell32_hInstance, SV_CLASS_NAME, &wc))
2122 wc.style = CS_HREDRAW | CS_VREDRAW;
2123 wc.lpfnWndProc = ShellView_WndProc;
2124 wc.cbClsExtra = 0;
2125 wc.cbWndExtra = 0;
2126 wc.hInstance = shell32_hInstance;
2127 wc.hIcon = 0;
2128 wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2129 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2130 wc.lpszMenuName = NULL;
2131 wc.lpszClassName = SV_CLASS_NAME;
2133 if (!RegisterClassW(&wc)) return E_FAIL;
2136 wnd = CreateWindowExW(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_TABSTOP,
2137 rect->left, rect->top,
2138 rect->right - rect->left,
2139 rect->bottom - rect->top,
2140 This->hWndParent, 0, shell32_hInstance, This);
2142 CheckToolbar(This);
2144 if (!wnd)
2146 IShellBrowser_Release(This->pShellBrowser);
2147 return E_FAIL;
2150 SetWindowPos(wnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
2151 UpdateWindow(wnd);
2153 *hwnd = wnd;
2155 return S_OK;
2158 static const IShellView3Vtbl shellviewvtbl =
2160 IShellView_fnQueryInterface,
2161 IShellView_fnAddRef,
2162 IShellView_fnRelease,
2163 IShellView_fnGetWindow,
2164 IShellView_fnContextSensitiveHelp,
2165 IShellView_fnTranslateAccelerator,
2166 IShellView_fnEnableModeless,
2167 IShellView_fnUIActivate,
2168 IShellView_fnRefresh,
2169 IShellView_fnCreateViewWindow,
2170 IShellView_fnDestroyViewWindow,
2171 IShellView_fnGetCurrentInfo,
2172 IShellView_fnAddPropertySheetPages,
2173 IShellView_fnSaveViewState,
2174 IShellView_fnSelectItem,
2175 IShellView_fnGetItemObject,
2176 IShellView2_fnGetView,
2177 IShellView2_fnCreateViewWindow2,
2178 IShellView2_fnHandleRename,
2179 IShellView2_fnSelectAndPositionItem,
2180 IShellView3_fnCreateViewWindow3
2184 /**********************************************************
2185 * ISVOleCmdTarget_QueryInterface (IUnknown)
2187 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(IOleCommandTarget *iface, REFIID iid, void **ppvObj)
2189 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2190 return IShellView3_QueryInterface(&This->IShellView3_iface, iid, ppvObj);
2193 /**********************************************************
2194 * ISVOleCmdTarget_AddRef (IUnknown)
2196 static ULONG WINAPI ISVOleCmdTarget_AddRef(IOleCommandTarget *iface)
2198 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2199 return IShellView3_AddRef(&This->IShellView3_iface);
2202 /**********************************************************
2203 * ISVOleCmdTarget_Release (IUnknown)
2205 static ULONG WINAPI ISVOleCmdTarget_Release(IOleCommandTarget *iface)
2207 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2208 return IShellView3_Release(&This->IShellView3_iface);
2211 /**********************************************************
2212 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2214 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
2215 IOleCommandTarget *iface,
2216 const GUID *pguidCmdGroup,
2217 ULONG cCmds,
2218 OLECMD *prgCmds,
2219 OLECMDTEXT *pCmdText)
2221 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2222 UINT i;
2224 FIXME("(%p)->(%s %d %p %p)\n",
2225 This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
2227 if (!prgCmds)
2228 return E_INVALIDARG;
2229 for (i = 0; i < cCmds; i++)
2231 FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
2232 prgCmds[i].cmdf = 0;
2234 return OLECMDERR_E_UNKNOWNGROUP;
2237 /**********************************************************
2238 * ISVOleCmdTarget_Exec (IOleCommandTarget)
2240 * nCmdID is the OLECMDID_* enumeration
2242 static HRESULT WINAPI ISVOleCmdTarget_Exec(
2243 IOleCommandTarget *iface,
2244 const GUID* pguidCmdGroup,
2245 DWORD nCmdID,
2246 DWORD nCmdexecopt,
2247 VARIANT* pvaIn,
2248 VARIANT* pvaOut)
2250 IShellViewImpl *This = impl_from_IOleCommandTarget(iface);
2252 FIXME("(%p)->(%s %d 0x%08x %s %p)\n",
2253 This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, debugstr_variant(pvaIn), pvaOut);
2255 if (!pguidCmdGroup)
2256 return OLECMDERR_E_UNKNOWNGROUP;
2258 if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) &&
2259 (nCmdID == OLECMDID_SHOWMESSAGE) &&
2260 (nCmdexecopt == 4) && pvaOut)
2261 return S_OK;
2262 if (IsEqualIID(pguidCmdGroup, &CGID_ShellDocView) &&
2263 (nCmdID == OLECMDID_SPELL) &&
2264 (nCmdexecopt == OLECMDEXECOPT_DODEFAULT))
2265 return S_FALSE;
2267 return OLECMDERR_E_UNKNOWNGROUP;
2270 static const IOleCommandTargetVtbl olecommandtargetvtbl =
2272 ISVOleCmdTarget_QueryInterface,
2273 ISVOleCmdTarget_AddRef,
2274 ISVOleCmdTarget_Release,
2275 ISVOleCmdTarget_QueryStatus,
2276 ISVOleCmdTarget_Exec
2279 /**********************************************************
2280 * ISVDropTarget implementation
2283 static HRESULT WINAPI ISVDropTarget_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObj)
2285 IShellViewImpl *This = impl_from_IDropTarget(iface);
2286 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2289 static ULONG WINAPI ISVDropTarget_AddRef(IDropTarget *iface)
2291 IShellViewImpl *This = impl_from_IDropTarget(iface);
2292 return IShellView3_AddRef(&This->IShellView3_iface);
2295 static ULONG WINAPI ISVDropTarget_Release(IDropTarget *iface)
2297 IShellViewImpl *This = impl_from_IDropTarget(iface);
2298 return IShellView3_Release(&This->IShellView3_iface);
2301 /******************************************************************************
2302 * drag_notify_subitem [Internal]
2304 * Figure out the shellfolder object, which is currently under the mouse cursor
2305 * and notify it via the IDropTarget interface.
2308 #define SCROLLAREAWIDTH 20
2310 static HRESULT drag_notify_subitem(IShellViewImpl *This, DWORD grfKeyState, POINTL pt,
2311 DWORD *pdwEffect)
2313 LVHITTESTINFO htinfo;
2314 LVITEMW lvItem;
2315 LONG lResult;
2316 HRESULT hr;
2317 RECT clientRect;
2319 /* Map from global to client coordinates and query the index of the listview-item, which is
2320 * currently under the mouse cursor. */
2321 htinfo.pt.x = pt.x;
2322 htinfo.pt.y = pt.y;
2323 htinfo.flags = LVHT_ONITEM;
2324 ScreenToClient(This->hWndList, &htinfo.pt);
2325 lResult = SendMessageW(This->hWndList, LVM_HITTEST, 0, (LPARAM)&htinfo);
2327 /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
2328 GetClientRect(This->hWndList, &clientRect);
2329 if (htinfo.pt.x == This->ptLastMousePos.x && htinfo.pt.y == This->ptLastMousePos.y &&
2330 (htinfo.pt.x < SCROLLAREAWIDTH || htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH ||
2331 htinfo.pt.y < SCROLLAREAWIDTH || htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH ))
2333 This->cScrollDelay = (This->cScrollDelay + 1) % 5; /* DragOver is called every 50 ms */
2334 if (This->cScrollDelay == 0) { /* Mouse did hover another 250 ms over the scroll-area */
2335 if (htinfo.pt.x < SCROLLAREAWIDTH)
2336 SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEUP, 0);
2337 if (htinfo.pt.x > clientRect.right - SCROLLAREAWIDTH)
2338 SendMessageW(This->hWndList, WM_HSCROLL, SB_LINEDOWN, 0);
2339 if (htinfo.pt.y < SCROLLAREAWIDTH)
2340 SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEUP, 0);
2341 if (htinfo.pt.y > clientRect.bottom - SCROLLAREAWIDTH)
2342 SendMessageW(This->hWndList, WM_VSCROLL, SB_LINEDOWN, 0);
2344 } else {
2345 This->cScrollDelay = 0; /* Reset, if the cursor is not over the listview's scroll-area */
2347 This->ptLastMousePos = htinfo.pt;
2349 /* If we are still over the previous sub-item, notify it via DragOver and return. */
2350 if (This->pCurDropTarget && lResult == This->iDragOverItem)
2351 return IDropTarget_DragOver(This->pCurDropTarget, grfKeyState, pt, pdwEffect);
2353 /* We've left the previous sub-item, notify it via DragLeave and Release it. */
2354 if (This->pCurDropTarget) {
2355 IDropTarget_DragLeave(This->pCurDropTarget);
2356 IDropTarget_Release(This->pCurDropTarget);
2357 This->pCurDropTarget = NULL;
2360 This->iDragOverItem = lResult;
2361 if (lResult == -1) {
2362 /* We are not above one of the listview's subitems. Bind to the parent folder's
2363 * DropTarget interface. */
2364 hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IDropTarget,
2365 (LPVOID*)&This->pCurDropTarget);
2366 } else {
2367 /* Query the relative PIDL of the shellfolder object represented by the currently
2368 * dragged over listview-item ... */
2369 lvItem.mask = LVIF_PARAM;
2370 lvItem.iItem = lResult;
2371 lvItem.iSubItem = 0;
2372 SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
2374 /* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */
2375 hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWndList, 1,
2376 (LPCITEMIDLIST*)&lvItem.lParam, &IID_IDropTarget, NULL, (LPVOID*)&This->pCurDropTarget);
2379 /* If anything failed, pCurDropTarget should be NULL now, which ought to be a save state. */
2380 if (FAILED(hr))
2381 return hr;
2383 /* Notify the item just entered via DragEnter. */
2384 return IDropTarget_DragEnter(This->pCurDropTarget, This->pCurDataObject, grfKeyState, pt, pdwEffect);
2387 static HRESULT WINAPI ISVDropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObject,
2388 DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2390 IShellViewImpl *This = impl_from_IDropTarget(iface);
2392 /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
2393 This->pCurDataObject = pDataObject;
2394 IDataObject_AddRef(pDataObject);
2396 return drag_notify_subitem(This, grfKeyState, pt, pdwEffect);
2399 static HRESULT WINAPI ISVDropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt,
2400 DWORD *pdwEffect)
2402 IShellViewImpl *This = impl_from_IDropTarget(iface);
2403 return drag_notify_subitem(This, grfKeyState, pt, pdwEffect);
2406 static HRESULT WINAPI ISVDropTarget_DragLeave(IDropTarget *iface)
2408 IShellViewImpl *This = impl_from_IDropTarget(iface);
2410 if (This->pCurDropTarget)
2412 IDropTarget_DragLeave(This->pCurDropTarget);
2413 IDropTarget_Release(This->pCurDropTarget);
2414 This->pCurDropTarget = NULL;
2417 if (This->pCurDataObject)
2419 IDataObject_Release(This->pCurDataObject);
2420 This->pCurDataObject = NULL;
2423 This->iDragOverItem = 0;
2425 return S_OK;
2428 static HRESULT WINAPI ISVDropTarget_Drop(IDropTarget *iface, IDataObject* pDataObject,
2429 DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
2431 IShellViewImpl *This = impl_from_IDropTarget(iface);
2433 if (!This->pCurDropTarget) return DRAGDROP_E_INVALIDHWND;
2435 IDropTarget_Drop(This->pCurDropTarget, pDataObject, grfKeyState, pt, pdwEffect);
2437 IDropTarget_Release(This->pCurDropTarget);
2438 IDataObject_Release(This->pCurDataObject);
2439 This->pCurDataObject = NULL;
2440 This->pCurDropTarget = NULL;
2441 This->iDragOverItem = 0;
2443 return S_OK;
2446 static const IDropTargetVtbl droptargetvtbl =
2448 ISVDropTarget_QueryInterface,
2449 ISVDropTarget_AddRef,
2450 ISVDropTarget_Release,
2451 ISVDropTarget_DragEnter,
2452 ISVDropTarget_DragOver,
2453 ISVDropTarget_DragLeave,
2454 ISVDropTarget_Drop
2457 /**********************************************************
2458 * ISVDropSource implementation
2461 static HRESULT WINAPI ISVDropSource_QueryInterface(IDropSource *iface, REFIID riid, void **ppvObj)
2463 IShellViewImpl *This = impl_from_IDropSource(iface);
2464 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2467 static ULONG WINAPI ISVDropSource_AddRef(IDropSource *iface)
2469 IShellViewImpl *This = impl_from_IDropSource(iface);
2470 return IShellView3_AddRef(&This->IShellView3_iface);
2473 static ULONG WINAPI ISVDropSource_Release(IDropSource *iface)
2475 IShellViewImpl *This = impl_from_IDropSource(iface);
2476 return IShellView3_Release(&This->IShellView3_iface);
2479 static HRESULT WINAPI ISVDropSource_QueryContinueDrag(
2480 IDropSource *iface,
2481 BOOL fEscapePressed,
2482 DWORD grfKeyState)
2484 IShellViewImpl *This = impl_from_IDropSource(iface);
2485 TRACE("(%p)\n",This);
2487 if (fEscapePressed)
2488 return DRAGDROP_S_CANCEL;
2489 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
2490 return DRAGDROP_S_DROP;
2491 else
2492 return S_OK;
2495 static HRESULT WINAPI ISVDropSource_GiveFeedback(
2496 IDropSource *iface,
2497 DWORD dwEffect)
2499 IShellViewImpl *This = impl_from_IDropSource(iface);
2500 TRACE("(%p)\n",This);
2502 return DRAGDROP_S_USEDEFAULTCURSORS;
2505 static const IDropSourceVtbl dropsourcevtbl =
2507 ISVDropSource_QueryInterface,
2508 ISVDropSource_AddRef,
2509 ISVDropSource_Release,
2510 ISVDropSource_QueryContinueDrag,
2511 ISVDropSource_GiveFeedback
2513 /**********************************************************
2514 * ISVViewObject implementation
2517 static HRESULT WINAPI ISVViewObject_QueryInterface(IViewObject *iface, REFIID riid, void **ppvObj)
2519 IShellViewImpl *This = impl_from_IViewObject(iface);
2520 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2523 static ULONG WINAPI ISVViewObject_AddRef(IViewObject *iface)
2525 IShellViewImpl *This = impl_from_IViewObject(iface);
2526 return IShellView3_AddRef(&This->IShellView3_iface);
2529 static ULONG WINAPI ISVViewObject_Release(IViewObject *iface)
2531 IShellViewImpl *This = impl_from_IViewObject(iface);
2532 return IShellView3_Release(&This->IShellView3_iface);
2535 static HRESULT WINAPI ISVViewObject_Draw(
2536 IViewObject *iface,
2537 DWORD dwDrawAspect,
2538 LONG lindex,
2539 void* pvAspect,
2540 DVTARGETDEVICE* ptd,
2541 HDC hdcTargetDev,
2542 HDC hdcDraw,
2543 LPCRECTL lprcBounds,
2544 LPCRECTL lprcWBounds,
2545 BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
2546 ULONG_PTR dwContinue)
2549 IShellViewImpl *This = impl_from_IViewObject(iface);
2551 FIXME("Stub: This=%p\n",This);
2553 return E_NOTIMPL;
2555 static HRESULT WINAPI ISVViewObject_GetColorSet(
2556 IViewObject *iface,
2557 DWORD dwDrawAspect,
2558 LONG lindex,
2559 void *pvAspect,
2560 DVTARGETDEVICE* ptd,
2561 HDC hicTargetDevice,
2562 LOGPALETTE** ppColorSet)
2565 IShellViewImpl *This = impl_from_IViewObject(iface);
2567 FIXME("Stub: This=%p\n",This);
2569 return E_NOTIMPL;
2571 static HRESULT WINAPI ISVViewObject_Freeze(
2572 IViewObject *iface,
2573 DWORD dwDrawAspect,
2574 LONG lindex,
2575 void* pvAspect,
2576 DWORD* pdwFreeze)
2579 IShellViewImpl *This = impl_from_IViewObject(iface);
2581 FIXME("Stub: This=%p\n",This);
2583 return E_NOTIMPL;
2585 static HRESULT WINAPI ISVViewObject_Unfreeze(
2586 IViewObject *iface,
2587 DWORD dwFreeze)
2590 IShellViewImpl *This = impl_from_IViewObject(iface);
2592 FIXME("Stub: This=%p\n",This);
2594 return E_NOTIMPL;
2596 static HRESULT WINAPI ISVViewObject_SetAdvise(
2597 IViewObject *iface,
2598 DWORD aspects,
2599 DWORD advf,
2600 IAdviseSink* pAdvSink)
2603 IShellViewImpl *This = impl_from_IViewObject(iface);
2605 FIXME("partial stub: %p %08x %08x %p\n",
2606 This, aspects, advf, pAdvSink);
2608 /* FIXME: we set the AdviseSink, but never use it to send any advice */
2609 This->pAdvSink = pAdvSink;
2610 This->dwAspects = aspects;
2611 This->dwAdvf = advf;
2613 return S_OK;
2616 static HRESULT WINAPI ISVViewObject_GetAdvise(
2617 IViewObject *iface,
2618 DWORD* pAspects,
2619 DWORD* pAdvf,
2620 IAdviseSink** ppAdvSink)
2623 IShellViewImpl *This = impl_from_IViewObject(iface);
2625 TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
2626 This, pAspects, pAdvf, ppAdvSink);
2628 if( ppAdvSink )
2630 IAdviseSink_AddRef( This->pAdvSink );
2631 *ppAdvSink = This->pAdvSink;
2633 if( pAspects )
2634 *pAspects = This->dwAspects;
2635 if( pAdvf )
2636 *pAdvf = This->dwAdvf;
2638 return S_OK;
2642 static const IViewObjectVtbl viewobjectvtbl =
2644 ISVViewObject_QueryInterface,
2645 ISVViewObject_AddRef,
2646 ISVViewObject_Release,
2647 ISVViewObject_Draw,
2648 ISVViewObject_GetColorSet,
2649 ISVViewObject_Freeze,
2650 ISVViewObject_Unfreeze,
2651 ISVViewObject_SetAdvise,
2652 ISVViewObject_GetAdvise
2655 /* IFolderView2 */
2656 static HRESULT WINAPI FolderView_QueryInterface(IFolderView2 *iface, REFIID riid, void **ppvObj)
2658 IShellViewImpl *This = impl_from_IFolderView2(iface);
2659 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
2662 static ULONG WINAPI FolderView_AddRef(IFolderView2 *iface)
2664 IShellViewImpl *This = impl_from_IFolderView2(iface);
2665 return IShellView3_AddRef(&This->IShellView3_iface);
2668 static ULONG WINAPI FolderView_Release(IFolderView2 *iface)
2670 IShellViewImpl *This = impl_from_IFolderView2(iface);
2671 return IShellView3_Release(&This->IShellView3_iface);
2674 static HRESULT WINAPI FolderView_GetCurrentViewMode(IFolderView2 *iface, UINT *mode)
2676 IShellViewImpl *This = impl_from_IFolderView2(iface);
2677 TRACE("(%p)->(%p), stub\n", This, mode);
2679 if(!mode)
2680 return E_INVALIDARG;
2682 *mode = This->FolderSettings.ViewMode;
2683 return S_OK;
2686 static HRESULT WINAPI FolderView_SetCurrentViewMode(IFolderView2 *iface, UINT mode)
2688 IShellViewImpl *This = impl_from_IFolderView2(iface);
2689 DWORD dwStyle;
2690 TRACE("(%p)->(%u), stub\n", This, mode);
2692 if((mode < FVM_FIRST || mode > FVM_LAST) &&
2693 (mode != FVM_AUTO))
2694 return E_INVALIDARG;
2696 /* Windows before Vista uses LVM_SETVIEW and possibly
2697 LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2698 while later versions seem to accomplish this through other
2699 means. */
2700 dwStyle = ViewModeToListStyle(mode);
2701 SetStyle(This, dwStyle, LVS_TYPEMASK);
2703 /* This will not necessarily be the actual mode set above.
2704 This mimics the behavior of Windows XP. */
2705 This->FolderSettings.ViewMode = mode;
2707 return S_OK;
2710 static HRESULT WINAPI FolderView_GetFolder(IFolderView2 *iface, REFIID riid, void **ppv)
2712 IShellViewImpl *This = impl_from_IFolderView2(iface);
2714 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
2716 return IShellFolder_QueryInterface(This->pSFParent, riid, ppv);
2719 static HRESULT WINAPI FolderView_Item(IFolderView2 *iface, int index, PITEMID_CHILD *ppidl)
2721 IShellViewImpl *This = impl_from_IFolderView2(iface);
2722 LVITEMW item;
2724 TRACE("(%p)->(%d %p)\n", This, index, ppidl);
2726 item.mask = LVIF_PARAM;
2727 item.iItem = index;
2729 if (SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM)&item))
2731 *ppidl = ILClone((PITEMID_CHILD)item.lParam);
2732 return S_OK;
2734 else
2736 *ppidl = 0;
2737 return E_INVALIDARG;
2741 static HRESULT WINAPI FolderView_ItemCount(IFolderView2 *iface, UINT flags, int *items)
2743 IShellViewImpl *This = impl_from_IFolderView2(iface);
2745 TRACE("(%p)->(%u %p)\n", This, flags, items);
2747 if (flags != SVGIO_ALLVIEW)
2748 FIXME("some flags unsupported, %x\n", flags & ~SVGIO_ALLVIEW);
2750 *items = SendMessageW(This->hWndList, LVM_GETITEMCOUNT, 0, 0);
2752 return S_OK;
2755 static HRESULT WINAPI FolderView_Items(IFolderView2 *iface, UINT flags, REFIID riid, void **ppv)
2757 IShellViewImpl *This = impl_from_IFolderView2(iface);
2758 FIXME("(%p)->(%u %s %p), stub\n", This, flags, debugstr_guid(riid), ppv);
2759 return E_NOTIMPL;
2762 static HRESULT WINAPI FolderView_GetSelectionMarkedItem(IFolderView2 *iface, int *item)
2764 IShellViewImpl *This = impl_from_IFolderView2(iface);
2766 TRACE("(%p)->(%p)\n", This, item);
2768 *item = SendMessageW(This->hWndList, LVM_GETSELECTIONMARK, 0, 0);
2770 return S_OK;
2773 static HRESULT WINAPI FolderView_GetFocusedItem(IFolderView2 *iface, int *item)
2775 IShellViewImpl *This = impl_from_IFolderView2(iface);
2777 TRACE("(%p)->(%p)\n", This, item);
2779 *item = SendMessageW(This->hWndList, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
2781 return S_OK;
2784 static HRESULT WINAPI FolderView_GetItemPosition(IFolderView2 *iface, PCUITEMID_CHILD pidl, POINT *ppt)
2786 IShellViewImpl *This = impl_from_IFolderView2(iface);
2787 FIXME("(%p)->(%p %p), stub\n", This, pidl, ppt);
2788 return E_NOTIMPL;
2791 static HRESULT WINAPI FolderView_GetSpacing(IFolderView2 *iface, POINT *pt)
2793 IShellViewImpl *This = impl_from_IFolderView2(iface);
2795 TRACE("(%p)->(%p)\n", This, pt);
2797 if (!This->hWndList) return S_FALSE;
2799 if (pt)
2801 DWORD ret;
2802 ret = SendMessageW(This->hWndList, LVM_GETITEMSPACING, 0, 0);
2804 pt->x = LOWORD(ret);
2805 pt->y = HIWORD(ret);
2808 return S_OK;
2811 static HRESULT WINAPI FolderView_GetDefaultSpacing(IFolderView2 *iface, POINT *pt)
2813 IShellViewImpl *This = impl_from_IFolderView2(iface);
2814 FIXME("(%p)->(%p), stub\n", This, pt);
2815 return E_NOTIMPL;
2818 static HRESULT WINAPI FolderView_GetAutoArrange(IFolderView2 *iface)
2820 IShellViewImpl *This = impl_from_IFolderView2(iface);
2821 FIXME("(%p), stub\n", This);
2822 return E_NOTIMPL;
2825 static HRESULT WINAPI FolderView_SelectItem(IFolderView2 *iface, int item, DWORD flags)
2827 IShellViewImpl *This = impl_from_IFolderView2(iface);
2828 LVITEMW lvItem;
2830 TRACE("(%p)->(%d, %x)\n", This, item, flags);
2832 lvItem.state = 0;
2833 lvItem.stateMask = LVIS_SELECTED;
2835 if (flags & SVSI_ENSUREVISIBLE)
2836 SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, item, 0);
2838 /* all items */
2839 if (flags & SVSI_DESELECTOTHERS)
2840 SendMessageW(This->hWndList, LVM_SETITEMSTATE, -1, (LPARAM)&lvItem);
2842 /* this item */
2843 if (flags & SVSI_SELECT)
2844 lvItem.state |= LVIS_SELECTED;
2846 if (flags & SVSI_FOCUSED)
2847 lvItem.stateMask |= LVIS_FOCUSED;
2849 SendMessageW(This->hWndList, LVM_SETITEMSTATE, item, (LPARAM)&lvItem);
2851 if (flags & SVSI_EDIT)
2852 SendMessageW(This->hWndList, LVM_EDITLABELW, item, 0);
2854 return S_OK;
2857 static HRESULT WINAPI FolderView_SelectAndPositionItems(IFolderView2 *iface, UINT cidl,
2858 PCUITEMID_CHILD_ARRAY apidl, POINT *apt, DWORD flags)
2860 IShellViewImpl *This = impl_from_IFolderView2(iface);
2861 FIXME("(%p)->(%u %p %p %x), stub\n", This, cidl, apidl, apt, flags);
2862 return E_NOTIMPL;
2865 static HRESULT WINAPI FolderView2_SetGroupBy(IFolderView2 *iface, REFPROPERTYKEY key, BOOL ascending)
2867 IShellViewImpl *This = impl_from_IFolderView2(iface);
2868 FIXME("(%p)->(%p %d), stub\n", This, key, ascending);
2869 return E_NOTIMPL;
2872 static HRESULT WINAPI FolderView2_GetGroupBy(IFolderView2 *iface, PROPERTYKEY *pkey, BOOL *ascending)
2874 IShellViewImpl *This = impl_from_IFolderView2(iface);
2875 FIXME("(%p)->(%p %p), stub\n", This, pkey, ascending);
2876 return E_NOTIMPL;
2879 static HRESULT WINAPI FolderView2_SetViewProperty(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2880 REFPROPERTYKEY propkey, REFPROPVARIANT propvar)
2882 IShellViewImpl *This = impl_from_IFolderView2(iface);
2883 FIXME("(%p)->(%p %p %p), stub\n", This, pidl, propkey, propvar);
2884 return E_NOTIMPL;
2887 static HRESULT WINAPI FolderView2_GetViewProperty(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2888 REFPROPERTYKEY propkey, PROPVARIANT *propvar)
2890 IShellViewImpl *This = impl_from_IFolderView2(iface);
2891 FIXME("(%p)->(%p %p %p), stub\n", This, pidl, propkey, propvar);
2892 return E_NOTIMPL;
2895 static HRESULT WINAPI FolderView2_SetTileViewProperties(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2896 LPCWSTR prop_list)
2898 IShellViewImpl *This = impl_from_IFolderView2(iface);
2899 FIXME("(%p)->(%p %s), stub\n", This, pidl, debugstr_w(prop_list));
2900 return E_NOTIMPL;
2903 static HRESULT WINAPI FolderView2_SetExtendedTileViewProperties(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2904 LPCWSTR prop_list)
2906 IShellViewImpl *This = impl_from_IFolderView2(iface);
2907 FIXME("(%p)->(%p %s), stub\n", This, pidl, debugstr_w(prop_list));
2908 return E_NOTIMPL;
2911 static HRESULT WINAPI FolderView2_SetText(IFolderView2 *iface, FVTEXTTYPE type, LPCWSTR text)
2913 IShellViewImpl *This = impl_from_IFolderView2(iface);
2914 FIXME("(%p)->(%d %s), stub\n", This, type, debugstr_w(text));
2915 return E_NOTIMPL;
2918 static HRESULT WINAPI FolderView2_SetCurrentFolderFlags(IFolderView2 *iface, DWORD mask, DWORD flags)
2920 IShellViewImpl *This = impl_from_IFolderView2(iface);
2921 FIXME("(%p)->(0x%08x 0x%08x), stub\n", This, mask, flags);
2922 return E_NOTIMPL;
2925 static HRESULT WINAPI FolderView2_GetCurrentFolderFlags(IFolderView2 *iface, DWORD *flags)
2927 IShellViewImpl *This = impl_from_IFolderView2(iface);
2928 FIXME("(%p)->(%p), stub\n", This, flags);
2929 return E_NOTIMPL;
2932 static HRESULT WINAPI FolderView2_GetSortColumnCount(IFolderView2 *iface, int *columns)
2934 IShellViewImpl *This = impl_from_IFolderView2(iface);
2935 FIXME("(%p)->(%p), stub\n", This, columns);
2936 return E_NOTIMPL;
2939 static HRESULT WINAPI FolderView2_SetSortColumns(IFolderView2 *iface, const SORTCOLUMN *columns,
2940 int count)
2942 IShellViewImpl *This = impl_from_IFolderView2(iface);
2943 FIXME("(%p)->(%p %d), stub\n", This, columns, count);
2944 return E_NOTIMPL;
2947 static HRESULT WINAPI FolderView2_GetSortColumns(IFolderView2 *iface, SORTCOLUMN *columns,
2948 int count)
2950 IShellViewImpl *This = impl_from_IFolderView2(iface);
2951 FIXME("(%p)->(%p %d), stub\n", This, columns, count);
2952 return E_NOTIMPL;
2955 static HRESULT WINAPI FolderView2_GetItem(IFolderView2 *iface, int item, REFIID riid, void **ppv)
2957 IShellViewImpl *This = impl_from_IFolderView2(iface);
2958 FIXME("(%p)->(%d %s %p), stub\n", This, item, debugstr_guid(riid), ppv);
2959 return E_NOTIMPL;
2962 static HRESULT WINAPI FolderView2_GetVisibleItem(IFolderView2 *iface, int start, BOOL previous,
2963 int *item)
2965 IShellViewImpl *This = impl_from_IFolderView2(iface);
2966 FIXME("(%p)->(%d %d %p), stub\n", This, start, previous, item);
2967 return E_NOTIMPL;
2970 static HRESULT WINAPI FolderView2_GetSelectedItem(IFolderView2 *iface, int start, int *item)
2972 IShellViewImpl *This = impl_from_IFolderView2(iface);
2973 FIXME("(%p)->(%d %p), stub\n", This, start, item);
2974 return E_NOTIMPL;
2977 static HRESULT WINAPI FolderView2_GetSelection(IFolderView2 *iface, BOOL none_implies_folder,
2978 IShellItemArray **array)
2980 IShellViewImpl *This = impl_from_IFolderView2(iface);
2981 FIXME("(%p)->(%d %p), stub\n", This, none_implies_folder, array);
2982 return E_NOTIMPL;
2985 static HRESULT WINAPI FolderView2_GetSelectionState(IFolderView2 *iface, PCUITEMID_CHILD pidl,
2986 DWORD *flags)
2988 IShellViewImpl *This = impl_from_IFolderView2(iface);
2989 FIXME("(%p)->(%p %p), stub\n", This, pidl, flags);
2990 return E_NOTIMPL;
2993 static HRESULT WINAPI FolderView2_InvokeVerbOnSelection(IFolderView2 *iface, LPCSTR verb)
2995 IShellViewImpl *This = impl_from_IFolderView2(iface);
2996 FIXME("(%p)->(%s), stub\n", This, debugstr_a(verb));
2997 return E_NOTIMPL;
3000 static HRESULT WINAPI FolderView2_SetViewModeAndIconSize(IFolderView2 *iface, FOLDERVIEWMODE mode,
3001 int size)
3003 IShellViewImpl *This = impl_from_IFolderView2(iface);
3004 FIXME("(%p)->(%d %d), stub\n", This, mode, size);
3005 return E_NOTIMPL;
3008 static HRESULT WINAPI FolderView2_GetViewModeAndIconSize(IFolderView2 *iface, FOLDERVIEWMODE *mode,
3009 int *size)
3011 IShellViewImpl *This = impl_from_IFolderView2(iface);
3012 FIXME("(%p)->(%p %p), stub\n", This, mode, size);
3013 return E_NOTIMPL;
3016 static HRESULT WINAPI FolderView2_SetGroupSubsetCount(IFolderView2 *iface, UINT visible_rows)
3018 IShellViewImpl *This = impl_from_IFolderView2(iface);
3019 FIXME("(%p)->(%u), stub\n", This, visible_rows);
3020 return E_NOTIMPL;
3023 static HRESULT WINAPI FolderView2_GetGroupSubsetCount(IFolderView2 *iface, UINT *visible_rows)
3025 IShellViewImpl *This = impl_from_IFolderView2(iface);
3026 FIXME("(%p)->(%p), stub\n", This, visible_rows);
3027 return E_NOTIMPL;
3030 static HRESULT WINAPI FolderView2_SetRedraw(IFolderView2 *iface, BOOL redraw)
3032 IShellViewImpl *This = impl_from_IFolderView2(iface);
3033 TRACE("(%p)->(%d)\n", This, redraw);
3034 SendMessageW(This->hWndList, WM_SETREDRAW, redraw, 0);
3035 return S_OK;
3038 static HRESULT WINAPI FolderView2_IsMoveInSameFolder(IFolderView2 *iface)
3040 IShellViewImpl *This = impl_from_IFolderView2(iface);
3041 FIXME("(%p), stub\n", This);
3042 return E_NOTIMPL;
3045 static HRESULT WINAPI FolderView2_DoRename(IFolderView2 *iface)
3047 IShellViewImpl *This = impl_from_IFolderView2(iface);
3048 FIXME("(%p), stub\n", This);
3049 return E_NOTIMPL;
3052 static const IFolderView2Vtbl folderviewvtbl =
3054 FolderView_QueryInterface,
3055 FolderView_AddRef,
3056 FolderView_Release,
3057 FolderView_GetCurrentViewMode,
3058 FolderView_SetCurrentViewMode,
3059 FolderView_GetFolder,
3060 FolderView_Item,
3061 FolderView_ItemCount,
3062 FolderView_Items,
3063 FolderView_GetSelectionMarkedItem,
3064 FolderView_GetFocusedItem,
3065 FolderView_GetItemPosition,
3066 FolderView_GetSpacing,
3067 FolderView_GetDefaultSpacing,
3068 FolderView_GetAutoArrange,
3069 FolderView_SelectItem,
3070 FolderView_SelectAndPositionItems,
3071 FolderView2_SetGroupBy,
3072 FolderView2_GetGroupBy,
3073 FolderView2_SetViewProperty,
3074 FolderView2_GetViewProperty,
3075 FolderView2_SetTileViewProperties,
3076 FolderView2_SetExtendedTileViewProperties,
3077 FolderView2_SetText,
3078 FolderView2_SetCurrentFolderFlags,
3079 FolderView2_GetCurrentFolderFlags,
3080 FolderView2_GetSortColumnCount,
3081 FolderView2_SetSortColumns,
3082 FolderView2_GetSortColumns,
3083 FolderView2_GetItem,
3084 FolderView2_GetVisibleItem,
3085 FolderView2_GetSelectedItem,
3086 FolderView2_GetSelection,
3087 FolderView2_GetSelectionState,
3088 FolderView2_InvokeVerbOnSelection,
3089 FolderView2_SetViewModeAndIconSize,
3090 FolderView2_GetViewModeAndIconSize,
3091 FolderView2_SetGroupSubsetCount,
3092 FolderView2_GetGroupSubsetCount,
3093 FolderView2_SetRedraw,
3094 FolderView2_IsMoveInSameFolder,
3095 FolderView2_DoRename
3098 /* IShellFolderView */
3099 static HRESULT WINAPI IShellFolderView_fnQueryInterface(IShellFolderView *iface, REFIID riid, void **ppvObj)
3101 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3102 return IShellView3_QueryInterface(&This->IShellView3_iface, riid, ppvObj);
3105 static ULONG WINAPI IShellFolderView_fnAddRef(IShellFolderView *iface)
3107 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3108 return IShellView3_AddRef(&This->IShellView3_iface);
3111 static ULONG WINAPI IShellFolderView_fnRelease(IShellFolderView *iface)
3113 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3114 return IShellView3_Release(&This->IShellView3_iface);
3117 static HRESULT WINAPI IShellFolderView_fnRearrange(IShellFolderView *iface, LPARAM sort)
3119 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3120 FIXME("(%p)->(%ld) stub\n", This, sort);
3121 return E_NOTIMPL;
3124 static HRESULT WINAPI IShellFolderView_fnGetArrangeParam(IShellFolderView *iface, LPARAM *sort)
3126 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3127 FIXME("(%p)->(%p) stub\n", This, sort);
3128 return E_NOTIMPL;
3131 static HRESULT WINAPI IShellFolderView_fnArrangeGrid(IShellFolderView *iface)
3133 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3134 FIXME("(%p) stub\n", This);
3135 return E_NOTIMPL;
3138 static HRESULT WINAPI IShellFolderView_fnAutoArrange(IShellFolderView *iface)
3140 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3141 TRACE("(%p)\n", This);
3142 return IFolderView2_SetCurrentFolderFlags(&This->IFolderView2_iface, FWF_AUTOARRANGE, FWF_AUTOARRANGE);
3145 static HRESULT WINAPI IShellFolderView_fnGetAutoArrange(IShellFolderView *iface)
3147 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3148 TRACE("(%p)\n", This);
3149 return IFolderView2_GetAutoArrange(&This->IFolderView2_iface);
3152 static HRESULT WINAPI IShellFolderView_fnAddObject(
3153 IShellFolderView *iface,
3154 PITEMID_CHILD pidl,
3155 UINT *item)
3157 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3158 FIXME("(%p)->(%p %p) stub\n", This, pidl, item);
3159 return E_NOTIMPL;
3162 static HRESULT WINAPI IShellFolderView_fnGetObject(
3163 IShellFolderView *iface,
3164 PITEMID_CHILD *pidl,
3165 UINT item)
3167 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3168 TRACE("(%p)->(%p %d)\n", This, pidl, item);
3169 return IFolderView2_Item(&This->IFolderView2_iface, item, pidl);
3172 static HRESULT WINAPI IShellFolderView_fnRemoveObject(
3173 IShellFolderView *iface,
3174 PITEMID_CHILD pidl,
3175 UINT *item)
3177 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3179 TRACE("(%p)->(%p %p)\n", This, pidl, item);
3181 if (pidl)
3183 *item = LV_FindItemByPidl(This, ILFindLastID(pidl));
3184 SendMessageW(This->hWndList, LVM_DELETEITEM, *item, 0);
3186 else
3188 *item = 0;
3189 SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
3192 return S_OK;
3195 static HRESULT WINAPI IShellFolderView_fnGetObjectCount(
3196 IShellFolderView *iface,
3197 UINT *count)
3199 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3200 TRACE("(%p)->(%p)\n", This, count);
3201 return IFolderView2_ItemCount(&This->IFolderView2_iface, SVGIO_ALLVIEW, (INT*)count);
3204 static HRESULT WINAPI IShellFolderView_fnSetObjectCount(
3205 IShellFolderView *iface,
3206 UINT count,
3207 UINT flags)
3209 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3210 FIXME("(%p)->(%d %x) stub\n", This, count, flags);
3211 return E_NOTIMPL;
3214 static HRESULT WINAPI IShellFolderView_fnUpdateObject(
3215 IShellFolderView *iface,
3216 PITEMID_CHILD pidl_old,
3217 PITEMID_CHILD pidl_new,
3218 UINT *item)
3220 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3221 FIXME("(%p)->(%p %p %p) stub\n", This, pidl_old, pidl_new, item);
3222 return E_NOTIMPL;
3225 static HRESULT WINAPI IShellFolderView_fnRefreshObject(
3226 IShellFolderView *iface,
3227 PITEMID_CHILD pidl,
3228 UINT *item)
3230 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3231 FIXME("(%p)->(%p %p) stub\n", This, pidl, item);
3232 return E_NOTIMPL;
3235 static HRESULT WINAPI IShellFolderView_fnSetRedraw(
3236 IShellFolderView *iface,
3237 BOOL redraw)
3239 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3240 TRACE("(%p)->(%d)\n", This, redraw);
3241 return IFolderView2_SetRedraw(&This->IFolderView2_iface, redraw);
3244 static HRESULT WINAPI IShellFolderView_fnGetSelectedCount(
3245 IShellFolderView *iface,
3246 UINT *count)
3248 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3249 IShellItemArray *selection;
3250 HRESULT hr;
3252 TRACE("(%p)->(%p)\n", This, count);
3254 *count = 0;
3255 hr = IFolderView2_GetSelection(&This->IFolderView2_iface, FALSE, &selection);
3256 if (FAILED(hr))
3257 return hr;
3259 hr = IShellItemArray_GetCount(selection, count);
3260 IShellItemArray_Release(selection);
3261 return hr;
3264 static HRESULT WINAPI IShellFolderView_fnGetSelectedObjects(
3265 IShellFolderView *iface,
3266 PCITEMID_CHILD **pidl,
3267 UINT *items)
3269 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3271 TRACE("(%p)->(%p %p)\n", This, pidl, items);
3273 *items = ShellView_GetSelections( This );
3275 if (*items)
3277 *pidl = LocalAlloc(0, *items*sizeof(LPITEMIDLIST));
3278 if (!*pidl) return E_OUTOFMEMORY;
3280 /* it's documented that caller shouldn't free PIDLs, only array itself */
3281 memcpy((PITEMID_CHILD*)*pidl, This->apidl, *items*sizeof(LPITEMIDLIST));
3284 return S_OK;
3287 static HRESULT WINAPI IShellFolderView_fnIsDropOnSource(
3288 IShellFolderView *iface,
3289 IDropTarget *drop_target)
3291 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3292 FIXME("(%p)->(%p) stub\n", This, drop_target);
3293 return E_NOTIMPL;
3296 static HRESULT WINAPI IShellFolderView_fnGetDragPoint(
3297 IShellFolderView *iface,
3298 POINT *pt)
3300 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3301 FIXME("(%p)->(%p) stub\n", This, pt);
3302 return E_NOTIMPL;
3305 static HRESULT WINAPI IShellFolderView_fnGetDropPoint(
3306 IShellFolderView *iface,
3307 POINT *pt)
3309 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3310 FIXME("(%p)->(%p) stub\n", This, pt);
3311 return E_NOTIMPL;
3314 static HRESULT WINAPI IShellFolderView_fnMoveIcons(
3315 IShellFolderView *iface,
3316 IDataObject *obj)
3318 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3319 TRACE("(%p)->(%p)\n", This, obj);
3320 return E_NOTIMPL;
3323 static HRESULT WINAPI IShellFolderView_fnSetItemPos(
3324 IShellFolderView *iface,
3325 PCUITEMID_CHILD pidl,
3326 POINT *pt)
3328 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3329 FIXME("(%p)->(%p %p) stub\n", This, pidl, pt);
3330 return E_NOTIMPL;
3333 static HRESULT WINAPI IShellFolderView_fnIsBkDropTarget(
3334 IShellFolderView *iface,
3335 IDropTarget *drop_target)
3337 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3338 FIXME("(%p)->(%p) stub\n", This, drop_target);
3339 return E_NOTIMPL;
3342 static HRESULT WINAPI IShellFolderView_fnSetClipboard(
3343 IShellFolderView *iface,
3344 BOOL move)
3346 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3347 FIXME("(%p)->(%d) stub\n", This, move);
3348 return E_NOTIMPL;
3351 static HRESULT WINAPI IShellFolderView_fnSetPoints(
3352 IShellFolderView *iface,
3353 IDataObject *obj)
3355 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3356 FIXME("(%p)->(%p) stub\n", This, obj);
3357 return E_NOTIMPL;
3360 static HRESULT WINAPI IShellFolderView_fnGetItemSpacing(
3361 IShellFolderView *iface,
3362 ITEMSPACING *spacing)
3364 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3365 FIXME("(%p)->(%p) stub\n", This, spacing);
3366 return E_NOTIMPL;
3369 static HRESULT WINAPI IShellFolderView_fnSetCallback(
3370 IShellFolderView *iface,
3371 IShellFolderViewCB *new_cb,
3372 IShellFolderViewCB **old_cb)
3375 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3376 FIXME("(%p)->(%p %p) stub\n", This, new_cb, old_cb);
3377 return E_NOTIMPL;
3380 static HRESULT WINAPI IShellFolderView_fnSelect(
3381 IShellFolderView *iface,
3382 UINT flags)
3384 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3385 FIXME("(%p)->(%d) stub\n", This, flags);
3386 return E_NOTIMPL;
3389 static HRESULT WINAPI IShellFolderView_fnQuerySupport(
3390 IShellFolderView *iface,
3391 UINT *support)
3393 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3394 TRACE("(%p)->(%p)\n", This, support);
3395 return S_OK;
3398 static HRESULT WINAPI IShellFolderView_fnSetAutomationObject(
3399 IShellFolderView *iface,
3400 IDispatch *disp)
3402 IShellViewImpl *This = impl_from_IShellFolderView(iface);
3403 FIXME("(%p)->(%p) stub\n", This, disp);
3404 return E_NOTIMPL;
3407 static const IShellFolderViewVtbl shellfolderviewvtbl =
3409 IShellFolderView_fnQueryInterface,
3410 IShellFolderView_fnAddRef,
3411 IShellFolderView_fnRelease,
3412 IShellFolderView_fnRearrange,
3413 IShellFolderView_fnGetArrangeParam,
3414 IShellFolderView_fnArrangeGrid,
3415 IShellFolderView_fnAutoArrange,
3416 IShellFolderView_fnGetAutoArrange,
3417 IShellFolderView_fnAddObject,
3418 IShellFolderView_fnGetObject,
3419 IShellFolderView_fnRemoveObject,
3420 IShellFolderView_fnGetObjectCount,
3421 IShellFolderView_fnSetObjectCount,
3422 IShellFolderView_fnUpdateObject,
3423 IShellFolderView_fnRefreshObject,
3424 IShellFolderView_fnSetRedraw,
3425 IShellFolderView_fnGetSelectedCount,
3426 IShellFolderView_fnGetSelectedObjects,
3427 IShellFolderView_fnIsDropOnSource,
3428 IShellFolderView_fnGetDragPoint,
3429 IShellFolderView_fnGetDropPoint,
3430 IShellFolderView_fnMoveIcons,
3431 IShellFolderView_fnSetItemPos,
3432 IShellFolderView_fnIsBkDropTarget,
3433 IShellFolderView_fnSetClipboard,
3434 IShellFolderView_fnSetPoints,
3435 IShellFolderView_fnGetItemSpacing,
3436 IShellFolderView_fnSetCallback,
3437 IShellFolderView_fnSelect,
3438 IShellFolderView_fnQuerySupport,
3439 IShellFolderView_fnSetAutomationObject
3442 static HRESULT WINAPI shellfolderviewdual_QueryInterface(IShellFolderViewDual3 *iface, REFIID riid, void **ppvObj)
3444 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3446 TRACE("(%p)->(IID:%s,%p)\n", This, debugstr_guid(riid), ppvObj);
3448 if (IsEqualIID(riid, &IID_IShellFolderViewDual3) ||
3449 IsEqualIID(riid, &IID_IShellFolderViewDual2) ||
3450 IsEqualIID(riid, &IID_IShellFolderViewDual) ||
3451 IsEqualIID(riid, &IID_IDispatch) ||
3452 IsEqualIID(riid, &IID_IUnknown))
3454 *ppvObj = iface;
3455 IShellFolderViewDual3_AddRef(iface);
3456 return S_OK;
3459 WARN("unsupported interface %s\n", debugstr_guid(riid));
3460 return E_NOINTERFACE;
3463 static ULONG WINAPI shellfolderviewdual_AddRef(IShellFolderViewDual3 *iface)
3465 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3466 return IShellView3_AddRef(&This->IShellView3_iface);
3469 static ULONG WINAPI shellfolderviewdual_Release(IShellFolderViewDual3 *iface)
3471 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3472 return IShellView3_Release(&This->IShellView3_iface);
3475 static HRESULT WINAPI shellfolderviewdual_GetTypeInfoCount(IShellFolderViewDual3 *iface, UINT *pctinfo)
3477 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3478 TRACE("%p %p\n", This, pctinfo);
3479 *pctinfo = 1;
3480 return S_OK;
3483 static HRESULT WINAPI shellfolderviewdual_GetTypeInfo(IShellFolderViewDual3 *iface,
3484 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
3486 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3487 HRESULT hr;
3489 TRACE("(%p,%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
3491 hr = get_typeinfo(IShellFolderViewDual3_tid, ppTInfo);
3492 if (SUCCEEDED(hr))
3493 ITypeInfo_AddRef(*ppTInfo);
3494 return hr;
3497 static HRESULT WINAPI shellfolderviewdual_GetIDsOfNames(
3498 IShellFolderViewDual3 *iface, REFIID riid, LPOLESTR *rgszNames, UINT
3499 cNames, LCID lcid, DISPID *rgDispId)
3501 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3502 ITypeInfo *ti;
3503 HRESULT hr;
3505 TRACE("(%p,%p,%p,%u,%d,%p)\n", This, riid, rgszNames, cNames, lcid,
3506 rgDispId);
3508 hr = get_typeinfo(IShellFolderViewDual3_tid, &ti);
3509 if (SUCCEEDED(hr))
3510 hr = ITypeInfo_GetIDsOfNames(ti, rgszNames, cNames, rgDispId);
3511 return hr;
3514 static HRESULT WINAPI shellfolderviewdual_Invoke(IShellFolderViewDual3 *iface,
3515 DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,
3516 DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
3517 UINT *puArgErr)
3519 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3520 ITypeInfo *ti;
3521 HRESULT hr;
3523 TRACE("(%p,%d,%p,%d,%u,%p,%p,%p,%p)\n", This, dispIdMember, riid, lcid,
3524 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
3526 hr = get_typeinfo(IShellFolderViewDual3_tid, &ti);
3527 if (SUCCEEDED(hr))
3528 hr = ITypeInfo_Invoke(ti, &This->IShellFolderViewDual3_iface, dispIdMember, wFlags, pDispParams,
3529 pVarResult, pExcepInfo, puArgErr);
3530 return hr;
3534 static HRESULT WINAPI shellfolderviewdual_get_Application(IShellFolderViewDual3 *iface,
3535 IDispatch **disp)
3537 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3539 TRACE("%p %p\n", This, disp);
3541 if (!disp)
3542 return E_INVALIDARG;
3544 return IShellDispatch_Constructor(NULL, &IID_IDispatch, (void**)disp);
3547 static HRESULT WINAPI shellfolderviewdual_get_Parent(IShellFolderViewDual3 *iface, IDispatch **disp)
3549 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3550 FIXME("%p %p\n", This, disp);
3551 return E_NOTIMPL;
3554 static HRESULT WINAPI shellfolderviewdual_get_Folder(IShellFolderViewDual3 *iface, Folder **folder)
3556 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3557 FIXME("%p %p\n", This, folder);
3558 return E_NOTIMPL;
3561 static HRESULT WINAPI shellfolderviewdual_SelectedItems(IShellFolderViewDual3 *iface, FolderItems **items)
3563 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3564 FIXME("%p %p\n", This, items);
3565 return E_NOTIMPL;
3568 static HRESULT WINAPI shellfolderviewdual_get_FocusedItem(IShellFolderViewDual3 *iface,
3569 FolderItem **item)
3571 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3572 FIXME("%p %p\n", This, item);
3573 return E_NOTIMPL;
3576 static HRESULT WINAPI shellfolderviewdual_SelectItem(IShellFolderViewDual3 *iface,
3577 VARIANT *v, int flags)
3579 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3580 FIXME("%p %s %x\n", This, debugstr_variant(v), flags);
3581 return E_NOTIMPL;
3584 static HRESULT WINAPI shellfolderviewdual_PopupItemMenu(IShellFolderViewDual3 *iface,
3585 FolderItem *item, VARIANT vx, VARIANT vy, BSTR *command)
3587 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3588 FIXME("%p %p %s %s %p\n", This, item, debugstr_variant(&vx), debugstr_variant(&vy), command);
3589 return E_NOTIMPL;
3592 static HRESULT WINAPI shellfolderviewdual_get_Script(IShellFolderViewDual3 *iface, IDispatch **disp)
3594 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3595 FIXME("%p %p\n", This, disp);
3596 return E_NOTIMPL;
3599 static HRESULT WINAPI shellfolderviewdual_get_ViewOptions(IShellFolderViewDual3 *iface, LONG *options)
3601 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3602 FIXME("%p %p\n", This, options);
3603 return E_NOTIMPL;
3606 static HRESULT WINAPI shellfolderviewdual_get_CurrentViewMode(IShellFolderViewDual3 *iface, UINT *mode)
3608 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3609 FIXME("%p %p\n", This, mode);
3610 return E_NOTIMPL;
3613 static HRESULT WINAPI shellfolderviewdual_put_CurrentViewMode(IShellFolderViewDual3 *iface, UINT mode)
3615 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3616 FIXME("%p %u\n", This, mode);
3617 return E_NOTIMPL;
3620 static HRESULT WINAPI shellfolderviewdual_SelectItemRelative(IShellFolderViewDual3 *iface, int relative)
3622 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3623 FIXME("%p %d\n", This, relative);
3624 return E_NOTIMPL;
3627 static HRESULT WINAPI shellfolderviewdual_get_GroupBy(IShellFolderViewDual3 *iface, BSTR *groupby)
3629 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3630 FIXME("%p %p\n", This, groupby);
3631 return E_NOTIMPL;
3634 static HRESULT WINAPI shellfolderviewdual_put_GroupBy(IShellFolderViewDual3 *iface, BSTR groupby)
3636 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3637 FIXME("%p %s\n", This, debugstr_w(groupby));
3638 return E_NOTIMPL;
3641 static HRESULT WINAPI shellfolderviewdual_get_FolderFlags(IShellFolderViewDual3 *iface, DWORD *flags)
3643 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3644 FIXME("%p %p\n", This, flags);
3645 return E_NOTIMPL;
3648 static HRESULT WINAPI shellfolderviewdual_put_FolderFlags(IShellFolderViewDual3 *iface, DWORD flags)
3650 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3651 FIXME("%p 0x%08x\n", This, flags);
3652 return E_NOTIMPL;
3655 static HRESULT WINAPI shellfolderviewdual_get_SortColumns(IShellFolderViewDual3 *iface, BSTR *sortcolumns)
3657 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3658 FIXME("%p %p\n", This, sortcolumns);
3659 return E_NOTIMPL;
3662 static HRESULT WINAPI shellfolderviewdual_put_SortColumns(IShellFolderViewDual3 *iface, BSTR sortcolumns)
3664 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3665 FIXME("%p %s\n", This, debugstr_w(sortcolumns));
3666 return E_NOTIMPL;
3669 static HRESULT WINAPI shellfolderviewdual_put_IconSize(IShellFolderViewDual3 *iface, int icon_size)
3671 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3672 FIXME("%p %d\n", This, icon_size);
3673 return E_NOTIMPL;
3676 static HRESULT WINAPI shellfolderviewdual_get_IconSize(IShellFolderViewDual3 *iface, int *icon_size)
3678 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3679 FIXME("%p %p\n", This, icon_size);
3680 return E_NOTIMPL;
3683 static HRESULT WINAPI shellfolderviewdual_FilterView(IShellFolderViewDual3 *iface, BSTR filter_text)
3685 IShellViewImpl *This = impl_from_IShellFolderViewDual3(iface);
3686 FIXME("%p %s\n", This, debugstr_w(filter_text));
3687 return E_NOTIMPL;
3690 static const IShellFolderViewDual3Vtbl shellfolderviewdualvtbl =
3692 shellfolderviewdual_QueryInterface,
3693 shellfolderviewdual_AddRef,
3694 shellfolderviewdual_Release,
3695 shellfolderviewdual_GetTypeInfoCount,
3696 shellfolderviewdual_GetTypeInfo,
3697 shellfolderviewdual_GetIDsOfNames,
3698 shellfolderviewdual_Invoke,
3699 shellfolderviewdual_get_Application,
3700 shellfolderviewdual_get_Parent,
3701 shellfolderviewdual_get_Folder,
3702 shellfolderviewdual_SelectedItems,
3703 shellfolderviewdual_get_FocusedItem,
3704 shellfolderviewdual_SelectItem,
3705 shellfolderviewdual_PopupItemMenu,
3706 shellfolderviewdual_get_Script,
3707 shellfolderviewdual_get_ViewOptions,
3708 shellfolderviewdual_get_CurrentViewMode,
3709 shellfolderviewdual_put_CurrentViewMode,
3710 shellfolderviewdual_SelectItemRelative,
3711 shellfolderviewdual_get_GroupBy,
3712 shellfolderviewdual_put_GroupBy,
3713 shellfolderviewdual_get_FolderFlags,
3714 shellfolderviewdual_put_FolderFlags,
3715 shellfolderviewdual_get_SortColumns,
3716 shellfolderviewdual_put_SortColumns,
3717 shellfolderviewdual_put_IconSize,
3718 shellfolderviewdual_get_IconSize,
3719 shellfolderviewdual_FilterView
3722 /**********************************************************
3723 * IShellView_Constructor
3725 IShellView *IShellView_Constructor(IShellFolder *folder)
3727 IShellViewImpl *sv;
3729 sv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
3730 if (!sv)
3731 return NULL;
3733 sv->ref = 1;
3734 sv->IShellView3_iface.lpVtbl = &shellviewvtbl;
3735 sv->IOleCommandTarget_iface.lpVtbl = &olecommandtargetvtbl;
3736 sv->IDropTarget_iface.lpVtbl = &droptargetvtbl;
3737 sv->IDropSource_iface.lpVtbl = &dropsourcevtbl;
3738 sv->IViewObject_iface.lpVtbl = &viewobjectvtbl;
3739 sv->IFolderView2_iface.lpVtbl = &folderviewvtbl;
3740 sv->IShellFolderView_iface.lpVtbl = &shellfolderviewvtbl;
3741 sv->IShellFolderViewDual3_iface.lpVtbl = &shellfolderviewdualvtbl;
3743 sv->pSFParent = folder;
3744 if (folder) IShellFolder_AddRef(folder);
3745 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (void**)&sv->pSF2Parent);
3747 sv->pCurDropTarget = NULL;
3748 sv->pCurDataObject = NULL;
3749 sv->iDragOverItem = 0;
3750 sv->cScrollDelay = 0;
3751 sv->ptLastMousePos.x = 0;
3752 sv->ptLastMousePos.y = 0;
3754 TRACE("(%p)->(%p)\n", sv, folder);
3755 return (IShellView*)&sv->IShellView3_iface;