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
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
40 #include "wine/port.h"
48 #define NONAMELESSUNION
61 #include "undocshell.h"
63 #include "wine/debug.h"
67 #include "shell32_main.h"
68 #include "shellfolder.h"
70 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
72 static const WCHAR SV_CLASS_NAME
[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0};
78 }LISTVIEW_SORT_INFO
, *LPLISTVIEW_SORT_INFO
;
82 IShellView3 IShellView3_iface
;
83 IOleCommandTarget IOleCommandTarget_iface
;
84 IDropTarget IDropTarget_iface
;
85 IDropSource IDropSource_iface
;
86 IViewObject IViewObject_iface
;
87 IFolderView2 IFolderView2_iface
;
88 IShellFolderView IShellFolderView_iface
;
89 IShellFolderViewDual3 IShellFolderViewDual3_iface
;
91 IShellFolder
* pSFParent
;
92 IShellFolder2
* pSF2Parent
;
93 IShellBrowser
* pShellBrowser
;
94 ICommDlgBrowser
* pCommDlgBrowser
;
95 HWND hWnd
; /* SHELLDLL_DefView */
96 HWND hWndList
; /* ListView control */
98 FOLDERSETTINGS FolderSettings
;
103 LISTVIEW_SORT_INFO ListViewSortInfo
;
104 ULONG hNotify
; /* change notification handle */
108 IAdviseSink
*pAdvSink
;
109 IDropTarget
* pCurDropTarget
; /* The sub-item, which is currently dragged over */
110 IDataObject
* pCurDataObject
; /* The dragged data-object */
111 LONG iDragOverItem
; /* Dragged over item's index, iff pCurDropTarget != NULL */
112 UINT cScrollDelay
; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
113 POINT ptLastMousePos
; /* Mouse position at last DragOver call */
114 UINT columns
; /* Number of shell folder columns */
117 static inline IShellViewImpl
*impl_from_IShellView3(IShellView3
*iface
)
119 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellView3_iface
);
122 static inline IShellViewImpl
*impl_from_IOleCommandTarget(IOleCommandTarget
*iface
)
124 return CONTAINING_RECORD(iface
, IShellViewImpl
, IOleCommandTarget_iface
);
127 static inline IShellViewImpl
*impl_from_IDropTarget(IDropTarget
*iface
)
129 return CONTAINING_RECORD(iface
, IShellViewImpl
, IDropTarget_iface
);
132 static inline IShellViewImpl
*impl_from_IDropSource(IDropSource
*iface
)
134 return CONTAINING_RECORD(iface
, IShellViewImpl
, IDropSource_iface
);
137 static inline IShellViewImpl
*impl_from_IViewObject(IViewObject
*iface
)
139 return CONTAINING_RECORD(iface
, IShellViewImpl
, IViewObject_iface
);
142 static inline IShellViewImpl
*impl_from_IFolderView2(IFolderView2
*iface
)
144 return CONTAINING_RECORD(iface
, IShellViewImpl
, IFolderView2_iface
);
147 static inline IShellViewImpl
*impl_from_IShellFolderView(IShellFolderView
*iface
)
149 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellFolderView_iface
);
152 static inline IShellViewImpl
*impl_from_IShellFolderViewDual3(IShellFolderViewDual3
*iface
)
154 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellFolderViewDual3_iface
);
157 /* ListView Header IDs */
158 #define LISTVIEW_COLUMN_NAME 0
159 #define LISTVIEW_COLUMN_SIZE 1
160 #define LISTVIEW_COLUMN_TYPE 2
161 #define LISTVIEW_COLUMN_TIME 3
162 #define LISTVIEW_COLUMN_ATTRIB 4
165 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
166 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
167 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
169 #define ID_LISTVIEW 1
171 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
174 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
175 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
176 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
179 Items merged into the toolbar and the filemenu
188 } MYTOOLINFO
, *LPMYTOOLINFO
;
190 static const MYTOOLINFO Tools
[] =
192 { FCIDM_SHVIEW_BIGICON
, 0, 0, IDS_VIEW_LARGE
, TBSTATE_ENABLED
, BTNS_BUTTON
},
193 { FCIDM_SHVIEW_SMALLICON
, 0, 0, IDS_VIEW_SMALL
, TBSTATE_ENABLED
, BTNS_BUTTON
},
194 { FCIDM_SHVIEW_LISTVIEW
, 0, 0, IDS_VIEW_LIST
, TBSTATE_ENABLED
, BTNS_BUTTON
},
195 { FCIDM_SHVIEW_REPORTVIEW
, 0, 0, IDS_VIEW_DETAILS
, TBSTATE_ENABLED
, BTNS_BUTTON
},
199 typedef void (CALLBACK
*PFNSHGETSETTINGSPROC
)(LPSHELLFLAGSTATE lpsfs
, DWORD dwMask
);
201 /**********************************************************
203 * ##### helperfunctions for communication with ICommDlgBrowser #####
205 static BOOL
IsInCommDlg(IShellViewImpl
* This
)
207 return This
->pCommDlgBrowser
!= NULL
;
210 static HRESULT
IncludeObject(IShellViewImpl
* This
, LPCITEMIDLIST pidl
)
214 if (IsInCommDlg(This
))
216 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl
);
217 ret
= ICommDlgBrowser_IncludeObject(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
, pidl
);
218 TRACE("-- returns 0x%08x\n", ret
);
224 static HRESULT
OnDefaultCommand(IShellViewImpl
* This
)
226 HRESULT ret
= S_FALSE
;
228 if (IsInCommDlg(This
))
230 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
231 ret
= ICommDlgBrowser_OnDefaultCommand(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
);
232 TRACE("-- returns 0x%08x\n", ret
);
238 static HRESULT
OnStateChange(IShellViewImpl
* This
, UINT change
)
240 HRESULT ret
= S_FALSE
;
242 if (IsInCommDlg(This
))
244 TRACE("ICommDlgBrowser::OnStateChange change=%d\n", change
);
245 ret
= ICommDlgBrowser_OnStateChange(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
, change
);
246 TRACE("-- returns 0x%08x\n", ret
);
252 /**********************************************************
253 * set the toolbar of the filedialog buttons
255 * - activates the buttons from the shellbrowser according to
258 static void CheckToolbar(IShellViewImpl
* This
)
264 if (IsInCommDlg(This
))
266 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
267 FCIDM_TB_SMALLICON
, This
->FolderSettings
.ViewMode
== FVM_LIST
, &result
);
268 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
269 FCIDM_TB_REPORTVIEW
, This
->FolderSettings
.ViewMode
== FVM_DETAILS
, &result
);
270 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
271 FCIDM_TB_SMALLICON
, TRUE
, &result
);
272 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
273 FCIDM_TB_REPORTVIEW
, TRUE
, &result
);
277 /**********************************************************
279 * ##### helperfunctions for initializing the view #####
281 /**********************************************************
282 * change the style of the listview control
284 static void SetStyle(IShellViewImpl
* This
, DWORD dwAdd
, DWORD dwRemove
)
288 TRACE("(%p)\n", This
);
290 tmpstyle
= GetWindowLongW(This
->hWndList
, GWL_STYLE
);
291 SetWindowLongW(This
->hWndList
, GWL_STYLE
, dwAdd
| (tmpstyle
& ~dwRemove
));
294 static DWORD
ViewModeToListStyle(UINT ViewMode
)
298 TRACE("%d\n", ViewMode
);
302 case FVM_ICON
: dwStyle
= LVS_ICON
; break;
303 case FVM_DETAILS
: dwStyle
= LVS_REPORT
; break;
304 case FVM_SMALLICON
: dwStyle
= LVS_SMALLICON
; break;
305 case FVM_LIST
: dwStyle
= LVS_LIST
; break;
308 FIXME("ViewMode %d not implemented\n", ViewMode
);
317 /**********************************************************
318 * ShellView_CreateList()
320 * - creates the list view window
322 static BOOL
ShellView_CreateList (IShellViewImpl
* This
)
323 { DWORD dwStyle
, dwExStyle
;
327 dwStyle
= WS_TABSTOP
| WS_VISIBLE
| WS_CHILDWINDOW
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
|
328 LVS_SHAREIMAGELISTS
| LVS_EDITLABELS
| LVS_ALIGNLEFT
| LVS_AUTOARRANGE
;
329 dwExStyle
= WS_EX_CLIENTEDGE
;
331 dwStyle
|= ViewModeToListStyle(This
->FolderSettings
.ViewMode
);
333 if (This
->FolderSettings
.fFlags
& FWF_AUTOARRANGE
) dwStyle
|= LVS_AUTOARRANGE
;
334 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
335 This
->FolderSettings
.fFlags
|= FWF_NOCLIENTEDGE
| FWF_NOSCROLL
;
336 if (This
->FolderSettings
.fFlags
& FWF_SINGLESEL
) dwStyle
|= LVS_SINGLESEL
;
337 if (This
->FolderSettings
.fFlags
& FWF_NOCLIENTEDGE
)
338 dwExStyle
&= ~WS_EX_CLIENTEDGE
;
340 This
->hWndList
=CreateWindowExW( dwExStyle
,
353 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
354 This
->ListViewSortInfo
.nHeaderID
= -1;
355 This
->ListViewSortInfo
.nLastHeaderID
= -1;
357 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
) {
359 * FIXME: look at the registry value
360 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
361 * and activate drop shadows if necessary
364 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, CLR_NONE
);
366 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, GetSysColor(COLOR_DESKTOP
));
368 SendMessageW(This
->hWndList
, LVM_SETTEXTCOLOR
, 0, RGB(255,255,255));
371 /* UpdateShellSettings(); */
375 /**********************************************************
376 * ShellView_InitList()
378 * - adds all needed columns to the shellview
380 static void ShellView_InitList(IShellViewImpl
*This
)
382 IShellDetails
*details
= NULL
;
383 HIMAGELIST big_icons
, small_icons
;
389 TRACE("(%p)\n", This
);
391 Shell_GetImageLists( &big_icons
, &small_icons
);
392 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
393 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_SMALL
, (LPARAM
)small_icons
);
394 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_NORMAL
, (LPARAM
)big_icons
);
396 lvColumn
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_TEXT
;
397 lvColumn
.pszText
= nameW
;
399 if (!This
->pSF2Parent
)
401 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
404 WARN("IShellFolder2/IShellDetails not supported\n");
409 for (This
->columns
= 0;; This
->columns
++)
411 if (This
->pSF2Parent
)
412 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, NULL
, This
->columns
, &sd
);
414 hr
= IShellDetails_GetDetailsOf(details
, NULL
, This
->columns
, &sd
);
415 if (FAILED(hr
)) break;
417 lvColumn
.fmt
= sd
.fmt
;
418 lvColumn
.cx
= sd
.cxChar
*8; /* chars->pixel */
419 StrRetToStrNW(nameW
, sizeof(nameW
)/sizeof(WCHAR
), &sd
.str
, NULL
);
420 SendMessageW(This
->hWndList
, LVM_INSERTCOLUMNW
, This
->columns
, (LPARAM
)&lvColumn
);
423 if (details
) IShellDetails_Release(details
);
426 /* LVM_SORTITEMS callback used when initially inserting items */
427 static INT CALLBACK
ShellView_CompareItems(LPARAM lParam1
, LPARAM lParam2
, LPARAM lpData
)
429 LPITEMIDLIST pidl1
= (LPITEMIDLIST
)lParam1
;
430 LPITEMIDLIST pidl2
= (LPITEMIDLIST
)lParam2
;
431 IShellFolder
*folder
= (IShellFolder
*)lpData
;
434 TRACE("pidl1=%p, pidl2=%p, shellfolder=%p\n", pidl1
, pidl2
, folder
);
436 ret
= (SHORT
)HRESULT_CODE(IShellFolder_CompareIDs(folder
, 0, pidl1
, pidl2
));
437 TRACE("ret=%i\n", ret
);
441 /*************************************************************************
442 * ShellView_ListViewCompareItems
444 * Compare Function for the Listview (FileOpen Dialog)
447 * lParam1 [I] the first ItemIdList to compare with
448 * lParam2 [I] the second ItemIdList to compare with
449 * lpData [I] The column ID for the header Ctrl to process
452 * A negative value if the first item should precede the second,
453 * a positive value if the first item should follow the second,
454 * or zero if the two items are equivalent
457 * FIXME: function does what ShellView_CompareItems is supposed to do.
458 * unify it and figure out how to use the undocumented first parameter
459 * of IShellFolder_CompareIDs to do the job this function does and
460 * move this code to IShellFolder.
461 * make LISTVIEW_SORT_INFO obsolete
462 * the way this function works is only usable if we had only
463 * filesystemfolders (25/10/99 jsch)
465 static INT CALLBACK
ShellView_ListViewCompareItems(LPVOID lParam1
, LPVOID lParam2
, LPARAM lpData
)
469 char strName1
[MAX_PATH
], strName2
[MAX_PATH
];
470 BOOL bIsFolder1
, bIsFolder2
,bIsBothFolder
;
471 LPITEMIDLIST pItemIdList1
= lParam1
;
472 LPITEMIDLIST pItemIdList2
= lParam2
;
473 LISTVIEW_SORT_INFO
*pSortInfo
= (LPLISTVIEW_SORT_INFO
) lpData
;
476 bIsFolder1
= _ILIsFolder(pItemIdList1
);
477 bIsFolder2
= _ILIsFolder(pItemIdList2
);
478 bIsBothFolder
= bIsFolder1
&& bIsFolder2
;
480 /* When sorting between a File and a Folder, the Folder gets sorted first */
481 if( (bIsFolder1
|| bIsFolder2
) && !bIsBothFolder
)
483 nDiff
= bIsFolder1
? -1 : 1;
487 /* Sort by Time: Folders or Files can be sorted */
489 if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TIME
)
491 _ILGetFileDateTime(pItemIdList1
, &fd1
);
492 _ILGetFileDateTime(pItemIdList2
, &fd2
);
493 nDiff
= CompareFileTime(&fd2
, &fd1
);
495 /* Sort by Attribute: Folder or Files can be sorted */
496 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_ATTRIB
)
498 _ILGetFileAttributes(pItemIdList1
, strName1
, MAX_PATH
);
499 _ILGetFileAttributes(pItemIdList2
, strName2
, MAX_PATH
);
500 nDiff
= lstrcmpiA(strName1
, strName2
);
502 /* Sort by FileName: Folder or Files can be sorted */
503 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_NAME
|| bIsBothFolder
)
506 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
507 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
508 nDiff
= lstrcmpiA(strName1
, strName2
);
510 /* Sort by File Size, Only valid for Files */
511 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_SIZE
)
513 nDiff
= (INT
)(_ILGetFileSize(pItemIdList1
, NULL
, 0) - _ILGetFileSize(pItemIdList2
, NULL
, 0));
515 /* Sort by File Type, Only valid for Files */
516 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TYPE
)
519 _ILGetFileType(pItemIdList1
, strName1
, MAX_PATH
);
520 _ILGetFileType(pItemIdList2
, strName2
, MAX_PATH
);
521 nDiff
= lstrcmpiA(strName1
, strName2
);
524 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
528 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
529 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
530 nDiff
= lstrcmpiA(strName1
, strName2
);
533 if(!pSortInfo
->bIsAscending
)
542 /**********************************************************
543 * LV_FindItemByPidl()
545 static int LV_FindItemByPidl(
546 IShellViewImpl
* This
,
551 lvItem
.mask
= LVIF_PARAM
;
552 for(lvItem
.iItem
= 0;
553 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
556 LPITEMIDLIST currentpidl
= (LPITEMIDLIST
) lvItem
.lParam
;
557 HRESULT hr
= IShellFolder_CompareIDs(This
->pSFParent
, 0, pidl
, currentpidl
);
558 if(SUCCEEDED(hr
) && !HRESULT_CODE(hr
))
566 static void shellview_add_item(IShellViewImpl
*shellview
, LPCITEMIDLIST pidl
)
571 TRACE("(%p)(pidl=%p)\n", shellview
, pidl
);
573 item
.mask
= LVIF_TEXT
| LVIF_IMAGE
| LVIF_PARAM
;
576 item
.lParam
= (LPARAM
)pidl
;
577 item
.pszText
= LPSTR_TEXTCALLBACKW
;
578 item
.iImage
= I_IMAGECALLBACK
;
579 SendMessageW(shellview
->hWndList
, LVM_INSERTITEMW
, 0, (LPARAM
)&item
);
581 for (i
= 1; i
< shellview
->columns
; i
++)
583 item
.mask
= LVIF_TEXT
;
586 item
.pszText
= LPSTR_TEXTCALLBACKW
;
587 SendMessageW(shellview
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
)&item
);
591 /**********************************************************
594 static BOOLEAN
LV_RenameItem(IShellViewImpl
* This
, LPCITEMIDLIST pidlOld
, LPCITEMIDLIST pidlNew
)
599 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This
, pidlOld
, pidlNew
);
601 nItem
= LV_FindItemByPidl(This
, ILFindLastID(pidlOld
));
604 lvItem
.mask
= LVIF_PARAM
; /* only the pidl */
605 lvItem
.iItem
= nItem
;
606 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
608 SHFree((LPITEMIDLIST
)lvItem
.lParam
);
609 lvItem
.mask
= LVIF_PARAM
;
610 lvItem
.iItem
= nItem
;
611 lvItem
.lParam
= (LPARAM
) ILClone(ILFindLastID(pidlNew
)); /* set the item's data */
612 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
613 SendMessageW(This
->hWndList
, LVM_UPDATE
, nItem
, 0);
614 return TRUE
; /* FIXME: better handling */
618 /**********************************************************
619 * ShellView_FillList()
621 * - gets the objectlist from the shellfolder
623 * - fills the list into the view
626 static HRESULT
ShellView_FillList(IShellViewImpl
*This
)
628 IFolderView2
*folderview
= &This
->IFolderView2_iface
;
629 LPENUMIDLIST pEnumIDList
;
634 TRACE("(%p)\n", This
);
636 /* get the itemlist from the shfolder*/
637 hr
= IShellFolder_EnumObjects(This
->pSFParent
, This
->hWnd
, SHCONTF_NONFOLDERS
| SHCONTF_FOLDERS
, &pEnumIDList
);
641 IFolderView2_SetRedraw(folderview
, FALSE
);
643 /* copy the items into the array */
644 while ((S_OK
== IEnumIDList_Next(pEnumIDList
, 1, &pidl
, &fetched
)) && fetched
)
646 if (IncludeObject(This
, pidl
) == S_OK
)
647 shellview_add_item(This
, pidl
);
650 SendMessageW(This
->hWndList
, LVM_SORTITEMS
, (WPARAM
)This
->pSFParent
, (LPARAM
)ShellView_CompareItems
);
652 IFolderView2_SetRedraw(folderview
, TRUE
);
654 IEnumIDList_Release(pEnumIDList
);
658 /**********************************************************
659 * ShellView_OnCreate()
661 static LRESULT
ShellView_OnCreate(IShellViewImpl
*This
)
663 IShellView3
*iface
= &This
->IShellView3_iface
;
664 static const WCHAR accel_nameW
[] = {'s','h','v','_','a','c','c','e','l',0};
665 IPersistFolder2
*ppf2
;
669 TRACE("(%p)\n", This
);
671 if (ShellView_CreateList(This
))
673 ShellView_InitList(This
);
674 ShellView_FillList(This
);
677 hr
= IShellView3_QueryInterface(iface
, &IID_IDropTarget
, (void**)&pdt
);
680 RegisterDragDrop(This
->hWnd
, pdt
);
681 IDropTarget_Release(pdt
);
684 /* register for receiving notifications */
685 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IPersistFolder2
, (LPVOID
*)&ppf2
);
688 LPITEMIDLIST raw_pidl
;
689 SHChangeNotifyEntry ntreg
;
691 hr
= IPersistFolder2_GetCurFolder(ppf2
, &raw_pidl
);
694 LPITEMIDLIST computer_pidl
;
695 SHGetFolderLocation(NULL
,CSIDL_DRIVES
,NULL
,0,&computer_pidl
);
696 if(ILIsParent(computer_pidl
,raw_pidl
,FALSE
))
698 /* Normalize the pidl to unixfs to workaround an issue with
699 * sending notifications on dos paths
701 WCHAR path
[MAX_PATH
];
702 SHGetPathFromIDListW(raw_pidl
,path
);
703 SHParseDisplayName(path
,NULL
,(LPITEMIDLIST
*)&ntreg
.pidl
,0,NULL
);
707 ntreg
.pidl
= raw_pidl
;
708 ntreg
.fRecursive
= TRUE
;
709 This
->hNotify
= SHChangeNotifyRegister(This
->hWnd
, SHCNRF_InterruptLevel
, SHCNE_ALLEVENTS
,
710 SHV_CHANGE_NOTIFY
, 1, &ntreg
);
711 SHFree((LPITEMIDLIST
)ntreg
.pidl
);
712 SHFree(computer_pidl
);
714 IPersistFolder2_Release(ppf2
);
717 This
->hAccel
= LoadAcceleratorsW(shell32_hInstance
, accel_nameW
);
722 /**********************************************************
723 * #### Handling of the menus ####
726 /**********************************************************
727 * ShellView_BuildFileMenu()
729 static HMENU
ShellView_BuildFileMenu(IShellViewImpl
* This
)
730 { WCHAR szText
[MAX_PATH
];
735 TRACE("(%p)\n",This
);
737 hSubMenu
= CreatePopupMenu();
739 { /*get the number of items in our global array*/
740 for(nTools
= 0; Tools
[nTools
].idCommand
!= -1; nTools
++){}
742 /*add the menu items*/
743 for(i
= 0; i
< nTools
; i
++)
745 LoadStringW(shell32_hInstance
, Tools
[i
].idMenuString
, szText
, MAX_PATH
);
747 ZeroMemory(&mii
, sizeof(mii
));
748 mii
.cbSize
= sizeof(mii
);
749 mii
.fMask
= MIIM_TYPE
| MIIM_ID
| MIIM_STATE
;
751 if(BTNS_SEP
!= Tools
[i
].bStyle
) /* no separator*/
753 mii
.fType
= MFT_STRING
;
754 mii
.fState
= MFS_ENABLED
;
755 mii
.dwTypeData
= szText
;
756 mii
.wID
= Tools
[i
].idCommand
;
760 mii
.fType
= MFT_SEPARATOR
;
762 /* tack This item onto the end of the menu */
763 InsertMenuItemW(hSubMenu
, (UINT
)-1, TRUE
, &mii
);
766 TRACE("-- return (menu=%p)\n",hSubMenu
);
769 /**********************************************************
770 * ShellView_MergeFileMenu()
772 static void ShellView_MergeFileMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
774 TRACE("(%p)->(submenu=%p) stub\n",This
,hSubMenu
);
778 static const WCHAR dummyW
[] = {'d','u','m','m','y','4','5',0};
781 /* insert This item at the beginning of the menu */
783 mii
.cbSize
= sizeof(mii
);
784 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
786 mii
.fType
= MFT_SEPARATOR
;
787 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
789 mii
.cbSize
= sizeof(mii
);
790 mii
.fMask
= MIIM_ID
| MIIM_TYPE
| MIIM_STATE
;
791 mii
.dwTypeData
= (LPWSTR
)dummyW
;
792 mii
.fState
= MFS_ENABLED
;
793 mii
.wID
= IDM_MYFILEITEM
;
794 mii
.fType
= MFT_STRING
;
795 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
801 /**********************************************************
802 * ShellView_MergeViewMenu()
805 static void ShellView_MergeViewMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
807 TRACE("(%p)->(submenu=%p)\n",This
,hSubMenu
);
809 /* add a separator at the correct position in the menu */
812 static const WCHAR menuW
[] = {'M','E','N','U','_','0','0','1',0};
813 static const WCHAR viewW
[] = {'V','i','e','w',0};
816 memset(&mii
, 0, sizeof(mii
));
817 mii
.cbSize
= sizeof(mii
);
818 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
820 mii
.fType
= MFT_SEPARATOR
;
821 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
823 mii
.cbSize
= sizeof(mii
);
824 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_DATA
;
825 mii
.fType
= MFT_STRING
;
826 mii
.dwTypeData
= (LPWSTR
)viewW
;
827 mii
.hSubMenu
= LoadMenuW(shell32_hInstance
, menuW
);
828 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
832 /**********************************************************
833 * ShellView_GetSelections()
835 * - fills the this->apidl list with the selected objects
838 * number of selected items
840 static UINT
ShellView_GetSelections(IShellViewImpl
* This
)
847 This
->cidl
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
848 This
->apidl
= SHAlloc(This
->cidl
* sizeof(LPITEMIDLIST
));
850 TRACE("selected=%i\n", This
->cidl
);
854 TRACE("-- Items selected =%u\n", This
->cidl
);
856 lvItem
.mask
= LVIF_STATE
| LVIF_PARAM
;
857 lvItem
.stateMask
= LVIS_SELECTED
;
861 while(ListView_GetItemW(This
->hWndList
, &lvItem
) && (i
< This
->cidl
))
863 if(lvItem
.state
& LVIS_SELECTED
)
865 This
->apidl
[i
] = (LPITEMIDLIST
)lvItem
.lParam
;
867 TRACE("-- selected Item found\n");
876 /**********************************************************
877 * ShellView_OpenSelectedItems()
879 static HRESULT
ShellView_OpenSelectedItems(IShellViewImpl
* This
)
881 static UINT CF_IDLIST
= 0;
883 IDataObject
* selection
;
887 LPCITEMIDLIST parent_pidl
;
888 WCHAR parent_path
[MAX_PATH
];
889 LPCWSTR parent_dir
= NULL
;
893 if (0 == ShellView_GetSelections(This
))
897 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
,
898 (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,
899 0, (LPVOID
*)&selection
);
905 CF_IDLIST
= RegisterClipboardFormatW(CFSTR_SHELLIDLISTW
);
907 fetc
.cfFormat
= CF_IDLIST
;
909 fetc
.dwAspect
= DVASPECT_CONTENT
;
911 fetc
.tymed
= TYMED_HGLOBAL
;
913 hr
= IDataObject_QueryGetData(selection
, &fetc
);
917 hr
= IDataObject_GetData(selection
, &fetc
, &stgm
);
921 pIDList
= GlobalLock(stgm
.u
.hGlobal
);
923 parent_pidl
= (LPCITEMIDLIST
) ((LPBYTE
)pIDList
+pIDList
->aoffset
[0]);
924 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &parent_pidl
, &attribs
);
925 if (SUCCEEDED(hr
) && (attribs
& SFGAO_FILESYSTEM
) &&
926 SHGetPathFromIDListW(parent_pidl
, parent_path
))
928 parent_dir
= parent_path
;
931 for (i
= pIDList
->cidl
; i
> 0; --i
)
935 pidl
= (LPCITEMIDLIST
)((LPBYTE
)pIDList
+pIDList
->aoffset
[i
]);
937 attribs
= SFGAO_FOLDER
;
938 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &pidl
, &attribs
);
940 if (SUCCEEDED(hr
) && ! (attribs
& SFGAO_FOLDER
))
942 SHELLEXECUTEINFOW shexinfo
;
944 shexinfo
.cbSize
= sizeof(SHELLEXECUTEINFOW
);
945 shexinfo
.fMask
= SEE_MASK_INVOKEIDLIST
; /* SEE_MASK_IDLIST is also possible. */
946 shexinfo
.hwnd
= NULL
;
947 shexinfo
.lpVerb
= NULL
;
948 shexinfo
.lpFile
= NULL
;
949 shexinfo
.lpParameters
= NULL
;
950 shexinfo
.lpDirectory
= parent_dir
;
951 shexinfo
.nShow
= SW_NORMAL
;
952 shexinfo
.lpIDList
= ILCombine(parent_pidl
, pidl
);
954 ShellExecuteExW(&shexinfo
); /* Discard error/success info */
956 ILFree(shexinfo
.lpIDList
);
960 GlobalUnlock(stgm
.u
.hGlobal
);
961 ReleaseStgMedium(&stgm
);
963 IDataObject_Release(selection
);
968 /**********************************************************
969 * ShellView_DoContextMenu()
971 static void ShellView_DoContextMenu(IShellViewImpl
* This
, WORD x
, WORD y
, BOOL bDefault
)
975 BOOL fExplore
= FALSE
;
977 LPCONTEXTMENU pContextMenu
= NULL
;
978 CMINVOKECOMMANDINFO cmi
;
980 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This
, x
, y
, bDefault
);
982 /* look, what's selected and create a context menu object of it*/
983 if( ShellView_GetSelections(This
) )
985 IShellFolder_GetUIObjectOf( This
->pSFParent
, This
->hWndParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
,
986 &IID_IContextMenu
, NULL
, (LPVOID
*)&pContextMenu
);
990 TRACE("-- pContextMenu\n");
991 hMenu
= CreatePopupMenu();
995 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
996 if(SUCCEEDED(IShellBrowser_GetControlWindow(This
->pShellBrowser
,FCW_TREE
, &hwndTree
)) && hwndTree
)
998 TRACE("-- explore mode\n");
1002 /* build the flags depending on what we can do with the selected item */
1003 wFlags
= CMF_NORMAL
| (This
->cidl
!= 1 ? 0 : CMF_CANRENAME
) | (fExplore
? CMF_EXPLORE
: 0);
1005 /* let the ContextMenu merge its items in */
1006 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, wFlags
)))
1008 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
1009 SetMenuDefaultItem(hMenu
, FCIDM_SHVIEW_OPEN
, MF_BYCOMMAND
);
1013 TRACE("-- get menu default command\n");
1014 uCommand
= GetMenuDefaultItem(hMenu
, FALSE
, GMDI_GOINTOPOPUPS
);
1018 TRACE("-- track popup\n");
1019 uCommand
= TrackPopupMenu( hMenu
,TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1024 TRACE("-- uCommand=%u\n", uCommand
);
1025 if (uCommand
==FCIDM_SHVIEW_OPEN
&& IsInCommDlg(This
))
1027 TRACE("-- dlg: OnDefaultCommand\n");
1028 if (OnDefaultCommand(This
) != S_OK
)
1030 ShellView_OpenSelectedItems(This
);
1035 TRACE("-- explore -- invoke command\n");
1036 ZeroMemory(&cmi
, sizeof(cmi
));
1037 cmi
.cbSize
= sizeof(cmi
);
1038 cmi
.hwnd
= This
->hWndParent
; /* this window has to answer CWM_GETISHELLBROWSER */
1039 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1040 IContextMenu_InvokeCommand(pContextMenu
, &cmi
);
1047 IContextMenu_Release(pContextMenu
);
1050 else /* background context menu */
1054 hMenu
= CreatePopupMenu();
1056 BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, &IID_IContextMenu2
, (void**)&pCM
);
1057 IContextMenu2_QueryContextMenu(pCM
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, 0);
1059 uCommand
= TrackPopupMenu( hMenu
, TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1062 TRACE("-- (%p)->(uCommand=0x%08x )\n",This
, uCommand
);
1064 ZeroMemory(&cmi
, sizeof(cmi
));
1065 cmi
.cbSize
= sizeof(cmi
);
1066 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1067 cmi
.hwnd
= This
->hWndParent
;
1068 IContextMenu2_InvokeCommand(pCM
, &cmi
);
1070 IContextMenu2_Release(pCM
);
1074 /**********************************************************
1075 * ##### message handling #####
1078 /**********************************************************
1079 * ShellView_OnSize()
1081 static LRESULT
ShellView_OnSize(IShellViewImpl
* This
, WORD wWidth
, WORD wHeight
)
1083 TRACE("%p width=%u height=%u\n",This
, wWidth
,wHeight
);
1085 /*resize the ListView to fit our window*/
1088 MoveWindow(This
->hWndList
, 0, 0, wWidth
, wHeight
, TRUE
);
1093 /**********************************************************
1094 * ShellView_OnDeactivate()
1099 static void ShellView_OnDeactivate(IShellViewImpl
* This
)
1103 if(This
->uState
!= SVUIA_DEACTIVATE
)
1107 IShellBrowser_SetMenuSB(This
->pShellBrowser
,0, 0, 0);
1108 IShellBrowser_RemoveMenusSB(This
->pShellBrowser
,This
->hMenu
);
1109 DestroyMenu(This
->hMenu
);
1113 This
->uState
= SVUIA_DEACTIVATE
;
1117 /**********************************************************
1118 * ShellView_OnActivate()
1120 static LRESULT
ShellView_OnActivate(IShellViewImpl
*This
, UINT uState
)
1122 OLEMENUGROUPWIDTHS omw
= { {0, 0, 0, 0, 0, 0} };
1125 TRACE("(%p) uState=%x\n",This
,uState
);
1127 /* don't do anything if the state isn't really changing */
1128 if (This
->uState
== uState
) return S_OK
;
1130 ShellView_OnDeactivate(This
);
1132 /* only do This if we are active */
1133 if (uState
!= SVUIA_DEACTIVATE
)
1135 /* merge the menus */
1136 This
->hMenu
= CreateMenu();
1140 static const WCHAR dummyW
[] = {'d','u','m','m','y',' ','3','1',0};
1142 IShellBrowser_InsertMenusSB(This
->pShellBrowser
, This
->hMenu
, &omw
);
1143 TRACE("-- after fnInsertMenusSB\n");
1145 mii
.cbSize
= sizeof(mii
);
1146 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_STATE
;
1147 mii
.fType
= MFT_STRING
;
1148 mii
.fState
= MFS_ENABLED
;
1150 mii
.hSubMenu
= ShellView_BuildFileMenu(This
);
1151 mii
.hbmpChecked
= NULL
;
1152 mii
.hbmpUnchecked
= NULL
;
1154 /* build the top level menu get the menu item's text */
1155 mii
.dwTypeData
= (LPWSTR
)dummyW
;
1157 mii
.hbmpItem
= NULL
;
1159 /* insert our menu into the menu bar */
1161 InsertMenuItemW(This
->hMenu
, FCIDM_MENU_HELP
, FALSE
, &mii
);
1163 /* get the view menu so we can merge with it */
1164 memset(&mii
, 0, sizeof(mii
));
1165 mii
.cbSize
= sizeof(mii
);
1166 mii
.fMask
= MIIM_SUBMENU
;
1168 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_VIEW
, FALSE
, &mii
))
1169 ShellView_MergeViewMenu(This
, mii
.hSubMenu
);
1171 /* add the items that should only be added if we have the focus */
1172 if (SVUIA_ACTIVATE_FOCUS
== uState
)
1174 /* get the file menu so we can merge with it */
1175 memset(&mii
, 0, sizeof(mii
));
1176 mii
.cbSize
= sizeof(mii
);
1177 mii
.fMask
= MIIM_SUBMENU
;
1179 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_FILE
, FALSE
, &mii
))
1180 ShellView_MergeFileMenu(This
, mii
.hSubMenu
);
1183 TRACE("-- before fnSetMenuSB\n");
1184 IShellBrowser_SetMenuSB(This
->pShellBrowser
, This
->hMenu
, 0, This
->hWnd
);
1187 This
->uState
= uState
;
1192 /**********************************************************
1193 * ShellView_OnSetFocus()
1196 static LRESULT
ShellView_OnSetFocus(IShellViewImpl
* This
)
1200 /* Tell the browser one of our windows has received the focus. This
1201 should always be done before merging menus (OnActivate merges the
1202 menus) if one of our windows has the focus.*/
1204 IShellBrowser_OnViewWindowActive(This
->pShellBrowser
, (IShellView
*)&This
->IShellView3_iface
);
1205 ShellView_OnActivate(This
, SVUIA_ACTIVATE_FOCUS
);
1207 /* Set the focus to the listview */
1208 SetFocus(This
->hWndList
);
1210 /* Notify the ICommDlgBrowser interface */
1211 OnStateChange(This
,CDBOSC_SETFOCUS
);
1216 /**********************************************************
1217 * ShellView_OnKillFocus()
1219 static LRESULT
ShellView_OnKillFocus(IShellViewImpl
* This
)
1221 TRACE("(%p) stub\n",This
);
1223 ShellView_OnActivate(This
, SVUIA_ACTIVATE_NOFOCUS
);
1224 /* Notify the ICommDlgBrowser */
1225 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1230 /**********************************************************
1231 * ShellView_OnCommand()
1234 * the CmdIDs are the ones from the context menu
1236 static LRESULT
ShellView_OnCommand(IShellViewImpl
* This
,DWORD dwCmdID
, DWORD dwCmd
, HWND hwndCmd
)
1238 TRACE("(%p)->(0x%08x 0x%08x %p) stub\n",This
, dwCmdID
, dwCmd
, hwndCmd
);
1242 case FCIDM_SHVIEW_SMALLICON
:
1243 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
1244 SetStyle (This
, LVS_SMALLICON
, LVS_TYPEMASK
);
1248 case FCIDM_SHVIEW_BIGICON
:
1249 This
->FolderSettings
.ViewMode
= FVM_ICON
;
1250 SetStyle (This
, LVS_ICON
, LVS_TYPEMASK
);
1254 case FCIDM_SHVIEW_LISTVIEW
:
1255 This
->FolderSettings
.ViewMode
= FVM_LIST
;
1256 SetStyle (This
, LVS_LIST
, LVS_TYPEMASK
);
1260 case FCIDM_SHVIEW_REPORTVIEW
:
1261 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
1262 SetStyle (This
, LVS_REPORT
, LVS_TYPEMASK
);
1266 /* the menu IDs for sorting are 0x30... see shell32.rc */
1271 This
->ListViewSortInfo
.nHeaderID
= dwCmdID
- 0x30;
1272 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1273 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1274 SendMessageW(This
->hWndList
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1278 TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID
);
1283 /**********************************************************
1284 * ShellView_OnNotify()
1287 static LRESULT
ShellView_OnNotify(IShellViewImpl
* This
, UINT CtlID
, LPNMHDR lpnmh
)
1288 { LPNMLISTVIEW lpnmlv
= (LPNMLISTVIEW
)lpnmh
;
1289 NMLVDISPINFOW
*lpdi
= (NMLVDISPINFOW
*)lpnmh
;
1292 TRACE("%p CtlID=%u lpnmh->code=%x\n",This
,CtlID
,lpnmh
->code
);
1297 TRACE("-- NM_SETFOCUS %p\n",This
);
1298 ShellView_OnSetFocus(This
);
1302 TRACE("-- NM_KILLFOCUS %p\n",This
);
1303 ShellView_OnDeactivate(This
);
1304 /* Notify the ICommDlgBrowser interface */
1305 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1309 TRACE("-- NM_CUSTOMDRAW %p\n",This
);
1310 return CDRF_DODEFAULT
;
1312 case NM_RELEASEDCAPTURE
:
1313 TRACE("-- NM_RELEASEDCAPTURE %p\n",This
);
1317 TRACE("-- NM_CLICK %p\n",This
);
1321 TRACE("-- NM_RCLICK %p\n",This
);
1325 TRACE("-- NM_DBLCLK %p\n",This
);
1326 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1330 TRACE("-- NM_RETURN %p\n",This
);
1331 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1335 TRACE("-- HDN_ENDTRACKW %p\n",This
);
1336 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1337 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1340 case LVN_DELETEITEM
:
1341 TRACE("-- LVN_DELETEITEM %p\n",This
);
1342 SHFree((LPITEMIDLIST
)lpnmlv
->lParam
); /*delete the pidl because we made a copy of it*/
1345 case LVN_DELETEALLITEMS
:
1346 TRACE("-- LVN_DELETEALLITEMS %p\n",This
);
1349 case LVN_INSERTITEM
:
1350 TRACE("-- LVN_INSERTITEM (STUB)%p\n",This
);
1353 case LVN_ITEMACTIVATE
:
1354 TRACE("-- LVN_ITEMACTIVATE %p\n",This
);
1355 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1358 case LVN_COLUMNCLICK
:
1359 This
->ListViewSortInfo
.nHeaderID
= lpnmlv
->iSubItem
;
1360 if(This
->ListViewSortInfo
.nLastHeaderID
== This
->ListViewSortInfo
.nHeaderID
)
1362 This
->ListViewSortInfo
.bIsAscending
= !This
->ListViewSortInfo
.bIsAscending
;
1366 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1368 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1370 SendMessageW(lpnmlv
->hdr
.hwndFrom
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1373 case LVN_GETDISPINFOA
:
1374 case LVN_GETDISPINFOW
:
1375 TRACE("-- LVN_GETDISPINFO %p\n",This
);
1376 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1378 if(lpdi
->item
.mask
& LVIF_TEXT
) /* text requested */
1380 static WCHAR emptyW
[] = { 0 };
1384 if (This
->pSF2Parent
)
1386 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1390 IShellDetails
*details
;
1392 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
1395 hr
= IShellDetails_GetDetailsOf(details
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1396 IShellDetails_Release(details
);
1399 WARN("IShellFolder2/IShellDetails not supported\n");
1404 /* set to empty on failure */
1405 sd
.str
.uType
= STRRET_WSTR
;
1406 sd
.str
.u
.pOleStr
= emptyW
;
1409 if (lpnmh
->code
== LVN_GETDISPINFOW
)
1411 StrRetToStrNW( lpdi
->item
.pszText
, lpdi
->item
.cchTextMax
, &sd
.str
, NULL
);
1412 TRACE("-- text=%s\n", debugstr_w(lpdi
->item
.pszText
));
1416 /* LVN_GETDISPINFOA - shouldn't happen */
1417 NMLVDISPINFOA
*lpdiA
= (NMLVDISPINFOA
*)lpnmh
;
1418 StrRetToStrNA( lpdiA
->item
.pszText
, lpdiA
->item
.cchTextMax
, &sd
.str
, NULL
);
1419 TRACE("-- text=%s\n", lpdiA
->item
.pszText
);
1423 if(lpdi
->item
.mask
& LVIF_IMAGE
) /* image requested */
1425 lpdi
->item
.iImage
= SHMapPIDLToSystemImageListIndex(This
->pSFParent
, pidl
, 0);
1429 case LVN_ITEMCHANGED
:
1430 TRACE("-- LVN_ITEMCHANGED %p\n",This
);
1431 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1435 case LVN_BEGINRDRAG
:
1436 TRACE("-- LVN_BEGINDRAG\n");
1438 if (ShellView_GetSelections(This
))
1441 DWORD dwAttributes
= SFGAO_CANLINK
;
1442 DWORD dwEffect
= DROPEFFECT_COPY
| DROPEFFECT_MOVE
;
1444 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,0,(LPVOID
*)&pda
)))
1446 IDropSource
*pds
= &This
->IDropSource_iface
; /* own DropSource interface */
1448 if (SUCCEEDED(IShellFolder_GetAttributesOf(This
->pSFParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &dwAttributes
)))
1450 if (dwAttributes
& SFGAO_CANLINK
)
1452 dwEffect
|= DROPEFFECT_LINK
;
1459 DoDragDrop(pda
, pds
, dwEffect
, &dwEffect2
);
1461 IDataObject_Release(pda
);
1466 case LVN_BEGINLABELEDITW
:
1468 DWORD dwAttr
= SFGAO_CANRENAME
;
1469 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1471 TRACE("-- LVN_BEGINLABELEDITW %p\n",This
);
1473 IShellFolder_GetAttributesOf(This
->pSFParent
, 1, (LPCITEMIDLIST
*)&pidl
, &dwAttr
);
1474 if (SFGAO_CANRENAME
& dwAttr
)
1481 case LVN_ENDLABELEDITW
:
1483 TRACE("-- LVN_ENDLABELEDITA %p\n",This
);
1484 if (lpdi
->item
.pszText
)
1489 lvItem
.iItem
= lpdi
->item
.iItem
;
1490 lvItem
.iSubItem
= 0;
1491 lvItem
.mask
= LVIF_PARAM
;
1492 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
1494 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1495 hr
= IShellFolder_SetNameOf(This
->pSFParent
, 0, pidl
, lpdi
->item
.pszText
, SHGDN_INFOLDER
, &pidl
);
1497 if(SUCCEEDED(hr
) && pidl
)
1499 lvItem
.mask
= LVIF_PARAM
;
1500 lvItem
.lParam
= (LPARAM
)pidl
;
1501 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
1510 LPNMLVKEYDOWN plvKeyDown
= (LPNMLVKEYDOWN
) lpnmh
;
1512 /* initiate a rename of the selected file or directory */
1513 switch (plvKeyDown
->wVKey
)
1517 INT i
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
1521 /* get selected item */
1522 i
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, MAKELPARAM (LVNI_SELECTED
, 0));
1524 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, i
, 0);
1525 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, i
, 0);
1534 LPITEMIDLIST
* pItems
;
1538 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_ISFHelper
, (void**)&psfhlp
);
1539 if (hr
!= S_OK
) return 0;
1541 if(!(count
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0)))
1543 ISFHelper_Release(psfhlp
);
1547 /* allocate memory for the pidl array */
1548 pItems
= HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST
) * count
);
1550 /* retrieve all selected items */
1556 /* get selected item */
1557 item_index
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, item_index
,
1558 MAKELPARAM (LVNI_SELECTED
, 0));
1559 item
.iItem
= item_index
;
1560 item
.mask
= LVIF_PARAM
;
1561 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
);
1564 pItems
[i
] = (LPITEMIDLIST
)item
.lParam
;
1569 /* perform the item deletion */
1570 ISFHelper_DeleteItems(psfhlp
, i
, (LPCITEMIDLIST
*)pItems
);
1571 ISFHelper_Release(psfhlp
);
1573 /* free pidl array memory */
1574 HeapFree(GetProcessHeap(), 0, pItems
);
1579 /* Initiate a refresh */
1580 IShellView3_Refresh(&This
->IShellView3_iface
);
1585 LPSHELLBROWSER lpSb
;
1586 if((lpSb
= (LPSHELLBROWSER
)SendMessageW(This
->hWndParent
, CWM_GETISHELLBROWSER
, 0, 0)))
1588 IShellBrowser_BrowseObject(lpSb
, NULL
, SBSP_PARENT
);
1594 FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown
->wVKey
);
1600 TRACE("-- %p WM_COMMAND %x unhandled\n", This
, lpnmh
->code
);
1606 /**********************************************************
1607 * ShellView_OnChange()
1610 static LRESULT
ShellView_OnChange(IShellViewImpl
* This
, const LPCITEMIDLIST
*pidls
, LONG event
)
1615 TRACE("(%p)->(%p, %p, 0x%08x)\n", This
, pidls
[0], pidls
[1], event
);
1621 pidl
= ILClone(ILFindLastID(pidls
[0]));
1622 shellview_add_item(This
, pidl
);
1627 INT i
= LV_FindItemByPidl(This
, ILFindLastID(pidls
[0]));
1628 ret
= SendMessageW(This
->hWndList
, LVM_DELETEITEM
, i
, 0);
1631 case SHCNE_RENAMEFOLDER
:
1632 case SHCNE_RENAMEITEM
:
1633 LV_RenameItem(This
, pidls
[0], pidls
[1]);
1635 case SHCNE_UPDATEITEM
:
1640 /**********************************************************
1644 static LRESULT CALLBACK
ShellView_WndProc(HWND hWnd
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
1646 IShellViewImpl
* pThis
= (IShellViewImpl
*)GetWindowLongPtrW(hWnd
, GWLP_USERDATA
);
1647 LPCREATESTRUCTW lpcs
;
1649 TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd
, uMessage
, wParam
, lParam
);
1654 lpcs
= (LPCREATESTRUCTW
)lParam
;
1655 pThis
= lpcs
->lpCreateParams
;
1656 SetWindowLongPtrW(hWnd
, GWLP_USERDATA
, (ULONG_PTR
)pThis
);
1657 pThis
->hWnd
= hWnd
; /*set the window handle*/
1660 case WM_SIZE
: return ShellView_OnSize(pThis
,LOWORD(lParam
), HIWORD(lParam
));
1661 case WM_SETFOCUS
: return ShellView_OnSetFocus(pThis
);
1662 case WM_KILLFOCUS
: return ShellView_OnKillFocus(pThis
);
1663 case WM_CREATE
: return ShellView_OnCreate(pThis
);
1664 case WM_ACTIVATE
: return ShellView_OnActivate(pThis
, SVUIA_ACTIVATE_FOCUS
);
1665 case WM_NOTIFY
: return ShellView_OnNotify(pThis
,(UINT
)wParam
, (LPNMHDR
)lParam
);
1666 case WM_COMMAND
: return ShellView_OnCommand(pThis
,
1667 GET_WM_COMMAND_ID(wParam
, lParam
),
1668 GET_WM_COMMAND_CMD(wParam
, lParam
),
1669 GET_WM_COMMAND_HWND(wParam
, lParam
));
1670 case SHV_CHANGE_NOTIFY
: return ShellView_OnChange(pThis
, (const LPCITEMIDLIST
*)wParam
, (LONG
)lParam
);
1672 case WM_CONTEXTMENU
: ShellView_DoContextMenu(pThis
, LOWORD(lParam
), HIWORD(lParam
), FALSE
);
1675 case WM_SHOWWINDOW
: UpdateWindow(pThis
->hWndList
);
1678 case WM_GETDLGCODE
: return SendMessageW(pThis
->hWndList
, uMessage
, 0, 0);
1679 case WM_SETFONT
: return SendMessageW(pThis
->hWndList
, WM_SETFONT
, wParam
, lParam
);
1680 case WM_GETFONT
: return SendMessageW(pThis
->hWndList
, WM_GETFONT
, wParam
, lParam
);
1683 RevokeDragDrop(pThis
->hWnd
);
1684 SHChangeNotifyDeregister(pThis
->hNotify
);
1688 if ((pThis
->FolderSettings
.fFlags
& FWF_DESKTOP
) ||
1689 (pThis
->FolderSettings
.fFlags
& FWF_TRANSPARENT
))
1694 return DefWindowProcW(hWnd
, uMessage
, wParam
, lParam
);
1696 /**********************************************************
1699 * The INTERFACE of the IShellView object
1702 **********************************************************
1703 * IShellView_QueryInterface
1705 static HRESULT WINAPI
IShellView_fnQueryInterface(IShellView3
*iface
, REFIID riid
, void **ppvObj
)
1707 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1709 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppvObj
);
1713 if(IsEqualIID(riid
, &IID_IUnknown
) ||
1714 IsEqualIID(riid
, &IID_IShellView
) ||
1715 IsEqualIID(riid
, &IID_IShellView2
) ||
1716 IsEqualIID(riid
, &IID_IShellView3
) ||
1717 IsEqualIID(riid
, &IID_CDefView
))
1719 *ppvObj
= &This
->IShellView3_iface
;
1721 else if(IsEqualIID(riid
, &IID_IShellFolderView
))
1723 *ppvObj
= &This
->IShellFolderView_iface
;
1725 else if(IsEqualIID(riid
, &IID_IFolderView
) ||
1726 IsEqualIID(riid
, &IID_IFolderView2
))
1728 *ppvObj
= &This
->IFolderView2_iface
;
1730 else if(IsEqualIID(riid
, &IID_IOleCommandTarget
))
1732 *ppvObj
= &This
->IOleCommandTarget_iface
;
1734 else if(IsEqualIID(riid
, &IID_IDropTarget
))
1736 *ppvObj
= &This
->IDropTarget_iface
;
1738 else if(IsEqualIID(riid
, &IID_IDropSource
))
1740 *ppvObj
= &This
->IDropSource_iface
;
1742 else if(IsEqualIID(riid
, &IID_IViewObject
))
1744 *ppvObj
= &This
->IViewObject_iface
;
1749 IUnknown_AddRef( (IUnknown
*)*ppvObj
);
1750 TRACE("-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
1753 TRACE("-- Interface: E_NOINTERFACE\n");
1754 return E_NOINTERFACE
;
1757 /**********************************************************
1760 static ULONG WINAPI
IShellView_fnAddRef(IShellView3
*iface
)
1762 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1763 ULONG refCount
= InterlockedIncrement(&This
->ref
);
1765 TRACE("(%p)->(count=%u)\n", This
, refCount
- 1);
1769 /**********************************************************
1770 * IShellView_Release
1772 static ULONG WINAPI
IShellView_fnRelease(IShellView3
*iface
)
1774 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1775 ULONG refCount
= InterlockedDecrement(&This
->ref
);
1777 TRACE("(%p)->(count=%i)\n", This
, refCount
+ 1);
1781 TRACE(" destroying IShellView(%p)\n",This
);
1783 DestroyWindow(This
->hWndList
);
1786 IShellFolder_Release(This
->pSFParent
);
1788 if(This
->pSF2Parent
)
1789 IShellFolder2_Release(This
->pSF2Parent
);
1791 SHFree(This
->apidl
);
1794 IAdviseSink_Release(This
->pAdvSink
);
1796 HeapFree(GetProcessHeap(),0,This
);
1801 /**********************************************************
1802 * ShellView_GetWindow
1804 static HRESULT WINAPI
IShellView_fnGetWindow(IShellView3
*iface
, HWND
*phWnd
)
1806 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1808 TRACE("(%p)\n", This
);
1810 *phWnd
= This
->hWnd
;
1814 static HRESULT WINAPI
IShellView_fnContextSensitiveHelp(IShellView3
*iface
, BOOL mode
)
1816 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1817 TRACE("(%p)->(%d)\n", This
, mode
);
1821 /**********************************************************
1822 * IShellView_TranslateAccelerator
1825 * use the accel functions
1827 static HRESULT WINAPI
IShellView_fnTranslateAccelerator(IShellView3
*iface
, MSG
*lpmsg
)
1830 IShellViewImpl
*This
= (IShellViewImpl
*)iface
;
1832 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%x wp=%x) stub\n",This
,lpmsg
, lpmsg
->hwnd
, lpmsg
->message
, lpmsg
->lParam
, lpmsg
->wParam
);
1835 if ((lpmsg
->message
>=WM_KEYFIRST
) && (lpmsg
->message
>=WM_KEYLAST
))
1837 TRACE("-- key=0x04%lx\n",lpmsg
->wParam
) ;
1839 return S_FALSE
; /* not handled */
1842 static HRESULT WINAPI
IShellView_fnEnableModeless(IShellView3
*iface
, BOOL fEnable
)
1844 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1846 FIXME("(%p) stub\n", This
);
1851 static HRESULT WINAPI
IShellView_fnUIActivate(IShellView3
*iface
, UINT uState
)
1853 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1856 CHAR szName[MAX_PATH];
1859 int nPartArray
[1] = {-1};
1861 TRACE("(%p)->(state=%x) stub\n",This
, uState
);
1863 /*don't do anything if the state isn't really changing*/
1864 if(This
->uState
== uState
)
1869 /*OnActivate handles the menu merging and internal state*/
1870 ShellView_OnActivate(This
, uState
);
1872 /*only do This if we are active*/
1873 if(uState
!= SVUIA_DEACTIVATE
)
1877 GetFolderPath is not a method of IShellFolder
1878 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1880 /* set the number of parts */
1881 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_STATUS
, SB_SETPARTS
, 1,
1882 (LPARAM
)nPartArray
, &lResult
);
1884 /* set the text for the parts */
1886 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1887 0, (LPARAM)szName, &lResult);
1894 static HRESULT WINAPI
IShellView_fnRefresh(IShellView3
*iface
)
1896 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1898 TRACE("(%p)\n", This
);
1900 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
1901 ShellView_FillList(This
);
1906 static HRESULT WINAPI
IShellView_fnCreateViewWindow(IShellView3
*iface
, IShellView
*prev_view
,
1907 const FOLDERSETTINGS
*settings
, IShellBrowser
*owner
, RECT
*rect
, HWND
*hWnd
)
1909 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1910 TRACE("(%p)->(%p %p %p %p %p)\n", This
, prev_view
, settings
, owner
, rect
, hWnd
);
1911 return IShellView3_CreateViewWindow3(iface
, owner
, prev_view
, SV3CVW3_DEFAULT
,
1912 settings
->fFlags
, settings
->fFlags
, settings
->ViewMode
, NULL
, rect
, hWnd
);
1915 static HRESULT WINAPI
IShellView_fnDestroyViewWindow(IShellView3
*iface
)
1917 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1919 TRACE("(%p)\n", This
);
1924 /* Make absolutely sure all our UI is cleaned up. */
1925 IShellView3_UIActivate(iface
, SVUIA_DEACTIVATE
);
1928 DestroyMenu(This
->hMenu
);
1930 DestroyWindow(This
->hWnd
);
1931 if (This
->pShellBrowser
) IShellBrowser_Release(This
->pShellBrowser
);
1932 if (This
->pCommDlgBrowser
) ICommDlgBrowser_Release(This
->pCommDlgBrowser
);
1936 This
->pShellBrowser
= NULL
;
1937 This
->pCommDlgBrowser
= NULL
;
1942 static HRESULT WINAPI
IShellView_fnGetCurrentInfo(IShellView3
*iface
, LPFOLDERSETTINGS lpfs
)
1944 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1946 TRACE("(%p)->(%p) vmode=%x flags=%x\n", This
, lpfs
,
1947 This
->FolderSettings
.ViewMode
, This
->FolderSettings
.fFlags
);
1949 if (!lpfs
) return E_INVALIDARG
;
1950 *lpfs
= This
->FolderSettings
;
1954 static HRESULT WINAPI
IShellView_fnAddPropertySheetPages(IShellView3
*iface
, DWORD dwReserved
,
1955 LPFNADDPROPSHEETPAGE lpfn
, LPARAM lparam
)
1957 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1958 FIXME("(%p) stub\n", This
);
1962 static HRESULT WINAPI
IShellView_fnSaveViewState(IShellView3
*iface
)
1964 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1965 FIXME("(%p) stub\n", This
);
1969 static HRESULT WINAPI
IShellView_fnSelectItem(IShellView3
*iface
, LPCITEMIDLIST pidl
, UINT flags
)
1971 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1974 TRACE("(%p)->(pidl=%p, 0x%08x)\n",This
, pidl
, flags
);
1976 i
= LV_FindItemByPidl(This
, pidl
);
1977 if (i
== -1) return S_OK
;
1979 return IFolderView2_SelectItem(&This
->IFolderView2_iface
, i
, flags
);
1982 static HRESULT WINAPI
IShellView_fnGetItemObject(IShellView3
*iface
, UINT uItem
, REFIID riid
,
1985 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1986 HRESULT hr
= E_NOINTERFACE
;
1988 TRACE("(%p)->(0x%08x, %s, %p)\n",This
, uItem
, debugstr_guid(riid
), ppvOut
);
1994 case SVGIO_BACKGROUND
:
1996 if (IsEqualIID(&IID_IContextMenu
, riid
))
1997 return BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, riid
, ppvOut
);
1998 else if (IsEqualIID(&IID_IDispatch
, riid
)) {
1999 *ppvOut
= &This
->IShellFolderViewDual3_iface
;
2000 IShellFolderViewDual3_AddRef(&This
->IShellFolderViewDual3_iface
);
2004 FIXME("unsupported interface requested %s\n", debugstr_guid(riid
));
2008 case SVGIO_SELECTION
:
2009 ShellView_GetSelections(This
);
2010 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, riid
, 0, ppvOut
);
2014 FIXME("unimplemented for uItem = 0x%08x\n", uItem
);
2016 TRACE("-- (%p)->(interface=%p)\n",This
, *ppvOut
);
2021 static HRESULT WINAPI
IShellView2_fnGetView(IShellView3
*iface
, SHELLVIEWID
*view_guid
, ULONG view_type
)
2023 FIXME("(%p)->(%s, %#x) stub!\n", iface
, debugstr_guid(view_guid
), view_type
);
2027 static HRESULT WINAPI
IShellView2_fnCreateViewWindow2(IShellView3
*iface
, SV2CVW2_PARAMS
*view_params
)
2029 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2030 TRACE("(%p)->(%p)\n", This
, view_params
);
2031 return IShellView3_CreateViewWindow3(iface
, view_params
->psbOwner
, view_params
->psvPrev
,
2032 SV3CVW3_DEFAULT
, view_params
->pfs
->fFlags
, view_params
->pfs
->fFlags
,
2033 view_params
->pfs
->ViewMode
, view_params
->pvid
, view_params
->prcView
, &view_params
->hwndView
);
2036 static HRESULT WINAPI
IShellView2_fnHandleRename(IShellView3
*iface
, LPCITEMIDLIST new_pidl
)
2038 FIXME("(%p)->(new_pidl %p) stub!\n", iface
, new_pidl
);
2042 static HRESULT WINAPI
IShellView2_fnSelectAndPositionItem(IShellView3
*iface
, LPCITEMIDLIST item
,
2043 UINT flags
, POINT
*point
)
2045 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2046 TRACE("(%p)->(item %p, flags %#x, point %p)\n", This
, item
, flags
, point
);
2047 return IFolderView2_SelectAndPositionItems(&This
->IFolderView2_iface
, 1, &item
, point
, flags
);
2050 static HRESULT WINAPI
IShellView3_fnCreateViewWindow3(IShellView3
*iface
, IShellBrowser
*owner
,
2051 IShellView
*prev_view
, SV3CVW3_FLAGS view_flags
, FOLDERFLAGS mask
, FOLDERFLAGS flags
,
2052 FOLDERVIEWMODE mode
, const SHELLVIEWID
*view_id
, const RECT
*rect
, HWND
*hwnd
)
2054 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2055 INITCOMMONCONTROLSEX icex
;
2060 TRACE("(%p)->(%p %p 0x%08x 0x%08x 0x%08x %d %s %s %p)\n", This
, owner
, prev_view
, view_flags
,
2061 mask
, flags
, mode
, debugstr_guid(view_id
), wine_dbgstr_rect(rect
), hwnd
);
2063 icex
.dwSize
= sizeof(icex
);
2064 icex
.dwICC
= ICC_LISTVIEW_CLASSES
;
2065 InitCommonControlsEx(&icex
);
2069 if (!owner
|| This
->hWnd
)
2070 return E_UNEXPECTED
;
2072 if (view_flags
!= SV3CVW3_DEFAULT
)
2073 FIXME("unsupported view flags 0x%08x\n", view_flags
);
2075 /* Set up the member variables */
2076 This
->pShellBrowser
= owner
;
2077 This
->FolderSettings
.ViewMode
= mode
;
2078 This
->FolderSettings
.fFlags
= mask
& flags
;
2082 if (IsEqualGUID(view_id
, &VID_LargeIcons
))
2083 This
->FolderSettings
.ViewMode
= FVM_ICON
;
2084 else if (IsEqualGUID(view_id
, &VID_SmallIcons
))
2085 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
2086 else if (IsEqualGUID(view_id
, &VID_List
))
2087 This
->FolderSettings
.ViewMode
= FVM_LIST
;
2088 else if (IsEqualGUID(view_id
, &VID_Details
))
2089 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
2090 else if (IsEqualGUID(view_id
, &VID_Thumbnails
))
2091 This
->FolderSettings
.ViewMode
= FVM_THUMBNAIL
;
2092 else if (IsEqualGUID(view_id
, &VID_Tile
))
2093 This
->FolderSettings
.ViewMode
= FVM_TILE
;
2094 else if (IsEqualGUID(view_id
, &VID_ThumbStrip
))
2095 This
->FolderSettings
.ViewMode
= FVM_THUMBSTRIP
;
2097 FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id
));
2100 /* Get our parent window */
2101 IShellBrowser_AddRef(This
->pShellBrowser
);
2102 IShellBrowser_GetWindow(This
->pShellBrowser
, &This
->hWndParent
);
2104 /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2105 This
->pCommDlgBrowser
= NULL
;
2106 hr
= IShellBrowser_QueryInterface(This
->pShellBrowser
, &IID_ICommDlgBrowser
, (void **)&This
->pCommDlgBrowser
);
2108 TRACE("-- CommDlgBrowser %p\n", This
->pCommDlgBrowser
);
2110 /* If our window class has not been registered, then do so */
2111 if (!GetClassInfoW(shell32_hInstance
, SV_CLASS_NAME
, &wc
))
2113 wc
.style
= CS_HREDRAW
| CS_VREDRAW
;
2114 wc
.lpfnWndProc
= ShellView_WndProc
;
2117 wc
.hInstance
= shell32_hInstance
;
2119 wc
.hCursor
= LoadCursorW(0, (LPWSTR
)IDC_ARROW
);
2120 wc
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
2121 wc
.lpszMenuName
= NULL
;
2122 wc
.lpszClassName
= SV_CLASS_NAME
;
2124 if (!RegisterClassW(&wc
)) return E_FAIL
;
2127 wnd
= CreateWindowExW(0, SV_CLASS_NAME
, NULL
, WS_CHILD
| WS_TABSTOP
,
2128 rect
->left
, rect
->top
,
2129 rect
->right
- rect
->left
,
2130 rect
->bottom
- rect
->top
,
2131 This
->hWndParent
, 0, shell32_hInstance
, This
);
2137 IShellBrowser_Release(This
->pShellBrowser
);
2141 SetWindowPos(wnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
| SWP_SHOWWINDOW
);
2149 static const IShellView3Vtbl shellviewvtbl
=
2151 IShellView_fnQueryInterface
,
2152 IShellView_fnAddRef
,
2153 IShellView_fnRelease
,
2154 IShellView_fnGetWindow
,
2155 IShellView_fnContextSensitiveHelp
,
2156 IShellView_fnTranslateAccelerator
,
2157 IShellView_fnEnableModeless
,
2158 IShellView_fnUIActivate
,
2159 IShellView_fnRefresh
,
2160 IShellView_fnCreateViewWindow
,
2161 IShellView_fnDestroyViewWindow
,
2162 IShellView_fnGetCurrentInfo
,
2163 IShellView_fnAddPropertySheetPages
,
2164 IShellView_fnSaveViewState
,
2165 IShellView_fnSelectItem
,
2166 IShellView_fnGetItemObject
,
2167 IShellView2_fnGetView
,
2168 IShellView2_fnCreateViewWindow2
,
2169 IShellView2_fnHandleRename
,
2170 IShellView2_fnSelectAndPositionItem
,
2171 IShellView3_fnCreateViewWindow3
2175 /**********************************************************
2176 * ISVOleCmdTarget_QueryInterface (IUnknown)
2178 static HRESULT WINAPI
ISVOleCmdTarget_QueryInterface(IOleCommandTarget
*iface
, REFIID iid
, void **ppvObj
)
2180 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2181 return IShellView3_QueryInterface(&This
->IShellView3_iface
, iid
, ppvObj
);
2184 /**********************************************************
2185 * ISVOleCmdTarget_AddRef (IUnknown)
2187 static ULONG WINAPI
ISVOleCmdTarget_AddRef(IOleCommandTarget
*iface
)
2189 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2190 return IShellView3_AddRef(&This
->IShellView3_iface
);
2193 /**********************************************************
2194 * ISVOleCmdTarget_Release (IUnknown)
2196 static ULONG WINAPI
ISVOleCmdTarget_Release(IOleCommandTarget
*iface
)
2198 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2199 return IShellView3_Release(&This
->IShellView3_iface
);
2202 /**********************************************************
2203 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2205 static HRESULT WINAPI
ISVOleCmdTarget_QueryStatus(
2206 IOleCommandTarget
*iface
,
2207 const GUID
*pguidCmdGroup
,
2210 OLECMDTEXT
*pCmdText
)
2212 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2215 FIXME("(%p)->(%s %d %p %p)\n",
2216 This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
, pCmdText
);
2219 return E_INVALIDARG
;
2220 for (i
= 0; i
< cCmds
; i
++)
2222 FIXME("\tprgCmds[%d].cmdID = %d\n", i
, prgCmds
[i
].cmdID
);
2223 prgCmds
[i
].cmdf
= 0;
2225 return OLECMDERR_E_UNKNOWNGROUP
;
2228 /**********************************************************
2229 * ISVOleCmdTarget_Exec (IOleCommandTarget)
2231 * nCmdID is the OLECMDID_* enumeration
2233 static HRESULT WINAPI
ISVOleCmdTarget_Exec(
2234 IOleCommandTarget
*iface
,
2235 const GUID
* pguidCmdGroup
,
2241 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2243 FIXME("(%p)->(%s %d 0x%08x %s %p)\n",
2244 This
, debugstr_guid(pguidCmdGroup
), nCmdID
, nCmdexecopt
, debugstr_variant(pvaIn
), pvaOut
);
2247 return OLECMDERR_E_UNKNOWNGROUP
;
2249 if (IsEqualIID(pguidCmdGroup
, &CGID_Explorer
) &&
2250 (nCmdID
== OLECMDID_SHOWMESSAGE
) &&
2251 (nCmdexecopt
== 4) && pvaOut
)
2253 if (IsEqualIID(pguidCmdGroup
, &CGID_ShellDocView
) &&
2254 (nCmdID
== OLECMDID_SPELL
) &&
2255 (nCmdexecopt
== OLECMDEXECOPT_DODEFAULT
))
2258 return OLECMDERR_E_UNKNOWNGROUP
;
2261 static const IOleCommandTargetVtbl olecommandtargetvtbl
=
2263 ISVOleCmdTarget_QueryInterface
,
2264 ISVOleCmdTarget_AddRef
,
2265 ISVOleCmdTarget_Release
,
2266 ISVOleCmdTarget_QueryStatus
,
2267 ISVOleCmdTarget_Exec
2270 /**********************************************************
2271 * ISVDropTarget implementation
2274 static HRESULT WINAPI
ISVDropTarget_QueryInterface(IDropTarget
*iface
, REFIID riid
, void **ppvObj
)
2276 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2277 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2280 static ULONG WINAPI
ISVDropTarget_AddRef(IDropTarget
*iface
)
2282 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2283 return IShellView3_AddRef(&This
->IShellView3_iface
);
2286 static ULONG WINAPI
ISVDropTarget_Release(IDropTarget
*iface
)
2288 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2289 return IShellView3_Release(&This
->IShellView3_iface
);
2292 /******************************************************************************
2293 * drag_notify_subitem [Internal]
2295 * Figure out the shellfolder object, which is currently under the mouse cursor
2296 * and notify it via the IDropTarget interface.
2299 #define SCROLLAREAWIDTH 20
2301 static HRESULT
drag_notify_subitem(IShellViewImpl
*This
, DWORD grfKeyState
, POINTL pt
,
2304 LVHITTESTINFO htinfo
;
2310 /* Map from global to client coordinates and query the index of the listview-item, which is
2311 * currently under the mouse cursor. */
2314 htinfo
.flags
= LVHT_ONITEM
;
2315 ScreenToClient(This
->hWndList
, &htinfo
.pt
);
2316 lResult
= SendMessageW(This
->hWndList
, LVM_HITTEST
, 0, (LPARAM
)&htinfo
);
2318 /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
2319 GetClientRect(This
->hWndList
, &clientRect
);
2320 if (htinfo
.pt
.x
== This
->ptLastMousePos
.x
&& htinfo
.pt
.y
== This
->ptLastMousePos
.y
&&
2321 (htinfo
.pt
.x
< SCROLLAREAWIDTH
|| htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
||
2322 htinfo
.pt
.y
< SCROLLAREAWIDTH
|| htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
))
2324 This
->cScrollDelay
= (This
->cScrollDelay
+ 1) % 5; /* DragOver is called every 50 ms */
2325 if (This
->cScrollDelay
== 0) { /* Mouse did hover another 250 ms over the scroll-area */
2326 if (htinfo
.pt
.x
< SCROLLAREAWIDTH
)
2327 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEUP
, 0);
2328 if (htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
)
2329 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEDOWN
, 0);
2330 if (htinfo
.pt
.y
< SCROLLAREAWIDTH
)
2331 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEUP
, 0);
2332 if (htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
)
2333 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEDOWN
, 0);
2336 This
->cScrollDelay
= 0; /* Reset, if the cursor is not over the listview's scroll-area */
2338 This
->ptLastMousePos
= htinfo
.pt
;
2340 /* If we are still over the previous sub-item, notify it via DragOver and return. */
2341 if (This
->pCurDropTarget
&& lResult
== This
->iDragOverItem
)
2342 return IDropTarget_DragOver(This
->pCurDropTarget
, grfKeyState
, pt
, pdwEffect
);
2344 /* We've left the previous sub-item, notify it via DragLeave and Release it. */
2345 if (This
->pCurDropTarget
) {
2346 IDropTarget_DragLeave(This
->pCurDropTarget
);
2347 IDropTarget_Release(This
->pCurDropTarget
);
2348 This
->pCurDropTarget
= NULL
;
2351 This
->iDragOverItem
= lResult
;
2352 if (lResult
== -1) {
2353 /* We are not above one of the listview's subitems. Bind to the parent folder's
2354 * DropTarget interface. */
2355 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IDropTarget
,
2356 (LPVOID
*)&This
->pCurDropTarget
);
2358 /* Query the relative PIDL of the shellfolder object represented by the currently
2359 * dragged over listview-item ... */
2360 lvItem
.mask
= LVIF_PARAM
;
2361 lvItem
.iItem
= lResult
;
2362 lvItem
.iSubItem
= 0;
2363 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
2365 /* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */
2366 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWndList
, 1,
2367 (LPCITEMIDLIST
*)&lvItem
.lParam
, &IID_IDropTarget
, NULL
, (LPVOID
*)&This
->pCurDropTarget
);
2370 /* If anything failed, pCurDropTarget should be NULL now, which ought to be a save state. */
2374 /* Notify the item just entered via DragEnter. */
2375 return IDropTarget_DragEnter(This
->pCurDropTarget
, This
->pCurDataObject
, grfKeyState
, pt
, pdwEffect
);
2378 static HRESULT WINAPI
ISVDropTarget_DragEnter(IDropTarget
*iface
, IDataObject
*pDataObject
,
2379 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2381 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2383 /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
2384 This
->pCurDataObject
= pDataObject
;
2385 IDataObject_AddRef(pDataObject
);
2387 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2390 static HRESULT WINAPI
ISVDropTarget_DragOver(IDropTarget
*iface
, DWORD grfKeyState
, POINTL pt
,
2393 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2394 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2397 static HRESULT WINAPI
ISVDropTarget_DragLeave(IDropTarget
*iface
)
2399 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2401 if (This
->pCurDropTarget
)
2403 IDropTarget_DragLeave(This
->pCurDropTarget
);
2404 IDropTarget_Release(This
->pCurDropTarget
);
2405 This
->pCurDropTarget
= NULL
;
2408 if (This
->pCurDataObject
)
2410 IDataObject_Release(This
->pCurDataObject
);
2411 This
->pCurDataObject
= NULL
;
2414 This
->iDragOverItem
= 0;
2419 static HRESULT WINAPI
ISVDropTarget_Drop(IDropTarget
*iface
, IDataObject
* pDataObject
,
2420 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2422 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2424 if (!This
->pCurDropTarget
) return DRAGDROP_E_INVALIDHWND
;
2426 IDropTarget_Drop(This
->pCurDropTarget
, pDataObject
, grfKeyState
, pt
, pdwEffect
);
2428 IDropTarget_Release(This
->pCurDropTarget
);
2429 IDataObject_Release(This
->pCurDataObject
);
2430 This
->pCurDataObject
= NULL
;
2431 This
->pCurDropTarget
= NULL
;
2432 This
->iDragOverItem
= 0;
2437 static const IDropTargetVtbl droptargetvtbl
=
2439 ISVDropTarget_QueryInterface
,
2440 ISVDropTarget_AddRef
,
2441 ISVDropTarget_Release
,
2442 ISVDropTarget_DragEnter
,
2443 ISVDropTarget_DragOver
,
2444 ISVDropTarget_DragLeave
,
2448 /**********************************************************
2449 * ISVDropSource implementation
2452 static HRESULT WINAPI
ISVDropSource_QueryInterface(IDropSource
*iface
, REFIID riid
, void **ppvObj
)
2454 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2455 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2458 static ULONG WINAPI
ISVDropSource_AddRef(IDropSource
*iface
)
2460 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2461 return IShellView3_AddRef(&This
->IShellView3_iface
);
2464 static ULONG WINAPI
ISVDropSource_Release(IDropSource
*iface
)
2466 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2467 return IShellView3_Release(&This
->IShellView3_iface
);
2470 static HRESULT WINAPI
ISVDropSource_QueryContinueDrag(
2472 BOOL fEscapePressed
,
2475 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2476 TRACE("(%p)\n",This
);
2479 return DRAGDROP_S_CANCEL
;
2480 else if (!(grfKeyState
& MK_LBUTTON
) && !(grfKeyState
& MK_RBUTTON
))
2481 return DRAGDROP_S_DROP
;
2486 static HRESULT WINAPI
ISVDropSource_GiveFeedback(
2490 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2491 TRACE("(%p)\n",This
);
2493 return DRAGDROP_S_USEDEFAULTCURSORS
;
2496 static const IDropSourceVtbl dropsourcevtbl
=
2498 ISVDropSource_QueryInterface
,
2499 ISVDropSource_AddRef
,
2500 ISVDropSource_Release
,
2501 ISVDropSource_QueryContinueDrag
,
2502 ISVDropSource_GiveFeedback
2504 /**********************************************************
2505 * ISVViewObject implementation
2508 static HRESULT WINAPI
ISVViewObject_QueryInterface(IViewObject
*iface
, REFIID riid
, void **ppvObj
)
2510 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2511 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2514 static ULONG WINAPI
ISVViewObject_AddRef(IViewObject
*iface
)
2516 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2517 return IShellView3_AddRef(&This
->IShellView3_iface
);
2520 static ULONG WINAPI
ISVViewObject_Release(IViewObject
*iface
)
2522 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2523 return IShellView3_Release(&This
->IShellView3_iface
);
2526 static HRESULT WINAPI
ISVViewObject_Draw(
2531 DVTARGETDEVICE
* ptd
,
2534 LPCRECTL lprcBounds
,
2535 LPCRECTL lprcWBounds
,
2536 BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
),
2537 ULONG_PTR dwContinue
)
2540 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2542 FIXME("Stub: This=%p\n",This
);
2546 static HRESULT WINAPI
ISVViewObject_GetColorSet(
2551 DVTARGETDEVICE
* ptd
,
2552 HDC hicTargetDevice
,
2553 LOGPALETTE
** ppColorSet
)
2556 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2558 FIXME("Stub: This=%p\n",This
);
2562 static HRESULT WINAPI
ISVViewObject_Freeze(
2570 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2572 FIXME("Stub: This=%p\n",This
);
2576 static HRESULT WINAPI
ISVViewObject_Unfreeze(
2581 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2583 FIXME("Stub: This=%p\n",This
);
2587 static HRESULT WINAPI
ISVViewObject_SetAdvise(
2591 IAdviseSink
* pAdvSink
)
2594 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2596 FIXME("partial stub: %p %08x %08x %p\n",
2597 This
, aspects
, advf
, pAdvSink
);
2599 /* FIXME: we set the AdviseSink, but never use it to send any advice */
2600 This
->pAdvSink
= pAdvSink
;
2601 This
->dwAspects
= aspects
;
2602 This
->dwAdvf
= advf
;
2607 static HRESULT WINAPI
ISVViewObject_GetAdvise(
2611 IAdviseSink
** ppAdvSink
)
2614 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2616 TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
2617 This
, pAspects
, pAdvf
, ppAdvSink
);
2621 IAdviseSink_AddRef( This
->pAdvSink
);
2622 *ppAdvSink
= This
->pAdvSink
;
2625 *pAspects
= This
->dwAspects
;
2627 *pAdvf
= This
->dwAdvf
;
2633 static const IViewObjectVtbl viewobjectvtbl
=
2635 ISVViewObject_QueryInterface
,
2636 ISVViewObject_AddRef
,
2637 ISVViewObject_Release
,
2639 ISVViewObject_GetColorSet
,
2640 ISVViewObject_Freeze
,
2641 ISVViewObject_Unfreeze
,
2642 ISVViewObject_SetAdvise
,
2643 ISVViewObject_GetAdvise
2647 static HRESULT WINAPI
FolderView_QueryInterface(IFolderView2
*iface
, REFIID riid
, void **ppvObj
)
2649 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2650 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2653 static ULONG WINAPI
FolderView_AddRef(IFolderView2
*iface
)
2655 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2656 return IShellView3_AddRef(&This
->IShellView3_iface
);
2659 static ULONG WINAPI
FolderView_Release(IFolderView2
*iface
)
2661 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2662 return IShellView3_Release(&This
->IShellView3_iface
);
2665 static HRESULT WINAPI
FolderView_GetCurrentViewMode(IFolderView2
*iface
, UINT
*mode
)
2667 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2668 TRACE("(%p)->(%p), stub\n", This
, mode
);
2671 return E_INVALIDARG
;
2673 *mode
= This
->FolderSettings
.ViewMode
;
2677 static HRESULT WINAPI
FolderView_SetCurrentViewMode(IFolderView2
*iface
, UINT mode
)
2679 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2681 TRACE("(%p)->(%u), stub\n", This
, mode
);
2683 if((mode
< FVM_FIRST
|| mode
> FVM_LAST
) &&
2685 return E_INVALIDARG
;
2687 /* Windows before Vista uses LVM_SETVIEW and possibly
2688 LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2689 while later versions seem to accomplish this through other
2691 dwStyle
= ViewModeToListStyle(mode
);
2692 SetStyle(This
, dwStyle
, LVS_TYPEMASK
);
2694 /* This will not necessarily be the actual mode set above.
2695 This mimics the behavior of Windows XP. */
2696 This
->FolderSettings
.ViewMode
= mode
;
2701 static HRESULT WINAPI
FolderView_GetFolder(IFolderView2
*iface
, REFIID riid
, void **ppv
)
2703 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2705 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppv
);
2707 return IShellFolder_QueryInterface(This
->pSFParent
, riid
, ppv
);
2710 static HRESULT WINAPI
FolderView_Item(IFolderView2
*iface
, int index
, PITEMID_CHILD
*ppidl
)
2712 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2715 TRACE("(%p)->(%d %p)\n", This
, index
, ppidl
);
2717 item
.mask
= LVIF_PARAM
;
2720 if (SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
))
2722 *ppidl
= ILClone((PITEMID_CHILD
)item
.lParam
);
2728 return E_INVALIDARG
;
2732 static HRESULT WINAPI
FolderView_ItemCount(IFolderView2
*iface
, UINT flags
, int *items
)
2734 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2736 TRACE("(%p)->(%u %p)\n", This
, flags
, items
);
2738 if (flags
!= SVGIO_ALLVIEW
)
2739 FIXME("some flags unsupported, %x\n", flags
& ~SVGIO_ALLVIEW
);
2741 *items
= SendMessageW(This
->hWndList
, LVM_GETITEMCOUNT
, 0, 0);
2746 static HRESULT WINAPI
FolderView_Items(IFolderView2
*iface
, UINT flags
, REFIID riid
, void **ppv
)
2748 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2749 FIXME("(%p)->(%u %s %p), stub\n", This
, flags
, debugstr_guid(riid
), ppv
);
2753 static HRESULT WINAPI
FolderView_GetSelectionMarkedItem(IFolderView2
*iface
, int *item
)
2755 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2757 TRACE("(%p)->(%p)\n", This
, item
);
2759 *item
= SendMessageW(This
->hWndList
, LVM_GETSELECTIONMARK
, 0, 0);
2764 static HRESULT WINAPI
FolderView_GetFocusedItem(IFolderView2
*iface
, int *item
)
2766 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2768 TRACE("(%p)->(%p)\n", This
, item
);
2770 *item
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, LVNI_FOCUSED
);
2775 static HRESULT WINAPI
FolderView_GetItemPosition(IFolderView2
*iface
, PCUITEMID_CHILD pidl
, POINT
*ppt
)
2777 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2778 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, ppt
);
2782 static HRESULT WINAPI
FolderView_GetSpacing(IFolderView2
*iface
, POINT
*pt
)
2784 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2786 TRACE("(%p)->(%p)\n", This
, pt
);
2788 if (!This
->hWndList
) return S_FALSE
;
2793 ret
= SendMessageW(This
->hWndList
, LVM_GETITEMSPACING
, 0, 0);
2795 pt
->x
= LOWORD(ret
);
2796 pt
->y
= HIWORD(ret
);
2802 static HRESULT WINAPI
FolderView_GetDefaultSpacing(IFolderView2
*iface
, POINT
*pt
)
2804 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2805 FIXME("(%p)->(%p), stub\n", This
, pt
);
2809 static HRESULT WINAPI
FolderView_GetAutoArrange(IFolderView2
*iface
)
2811 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2812 FIXME("(%p), stub\n", This
);
2816 static HRESULT WINAPI
FolderView_SelectItem(IFolderView2
*iface
, int item
, DWORD flags
)
2818 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2821 TRACE("(%p)->(%d, %x)\n", This
, item
, flags
);
2824 lvItem
.stateMask
= LVIS_SELECTED
;
2826 if (flags
& SVSI_ENSUREVISIBLE
)
2827 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, item
, 0);
2830 if (flags
& SVSI_DESELECTOTHERS
)
2831 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, -1, (LPARAM
)&lvItem
);
2834 if (flags
& SVSI_SELECT
)
2835 lvItem
.state
|= LVIS_SELECTED
;
2837 if (flags
& SVSI_FOCUSED
)
2838 lvItem
.stateMask
|= LVIS_FOCUSED
;
2840 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, item
, (LPARAM
)&lvItem
);
2842 if (flags
& SVSI_EDIT
)
2843 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, item
, 0);
2848 static HRESULT WINAPI
FolderView_SelectAndPositionItems(IFolderView2
*iface
, UINT cidl
,
2849 PCUITEMID_CHILD_ARRAY apidl
, POINT
*apt
, DWORD flags
)
2851 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2852 FIXME("(%p)->(%u %p %p %x), stub\n", This
, cidl
, apidl
, apt
, flags
);
2856 static HRESULT WINAPI
FolderView2_SetGroupBy(IFolderView2
*iface
, REFPROPERTYKEY key
, BOOL ascending
)
2858 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2859 FIXME("(%p)->(%p %d), stub\n", This
, key
, ascending
);
2863 static HRESULT WINAPI
FolderView2_GetGroupBy(IFolderView2
*iface
, PROPERTYKEY
*pkey
, BOOL
*ascending
)
2865 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2866 FIXME("(%p)->(%p %p), stub\n", This
, pkey
, ascending
);
2870 static HRESULT WINAPI
FolderView2_SetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2871 REFPROPERTYKEY propkey
, REFPROPVARIANT propvar
)
2873 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2874 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2878 static HRESULT WINAPI
FolderView2_GetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2879 REFPROPERTYKEY propkey
, PROPVARIANT
*propvar
)
2881 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2882 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2886 static HRESULT WINAPI
FolderView2_SetTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2889 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2890 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2894 static HRESULT WINAPI
FolderView2_SetExtendedTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2897 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2898 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2902 static HRESULT WINAPI
FolderView2_SetText(IFolderView2
*iface
, FVTEXTTYPE type
, LPCWSTR text
)
2904 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2905 FIXME("(%p)->(%d %s), stub\n", This
, type
, debugstr_w(text
));
2909 static HRESULT WINAPI
FolderView2_SetCurrentFolderFlags(IFolderView2
*iface
, DWORD mask
, DWORD flags
)
2911 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2912 FIXME("(%p)->(0x%08x 0x%08x), stub\n", This
, mask
, flags
);
2916 static HRESULT WINAPI
FolderView2_GetCurrentFolderFlags(IFolderView2
*iface
, DWORD
*flags
)
2918 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2919 FIXME("(%p)->(%p), stub\n", This
, flags
);
2923 static HRESULT WINAPI
FolderView2_GetSortColumnCount(IFolderView2
*iface
, int *columns
)
2925 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2926 FIXME("(%p)->(%p), stub\n", This
, columns
);
2930 static HRESULT WINAPI
FolderView2_SetSortColumns(IFolderView2
*iface
, const SORTCOLUMN
*columns
,
2933 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2934 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2938 static HRESULT WINAPI
FolderView2_GetSortColumns(IFolderView2
*iface
, SORTCOLUMN
*columns
,
2941 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2942 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2946 static HRESULT WINAPI
FolderView2_GetItem(IFolderView2
*iface
, int item
, REFIID riid
, void **ppv
)
2948 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2949 FIXME("(%p)->(%d %s %p), stub\n", This
, item
, debugstr_guid(riid
), ppv
);
2953 static HRESULT WINAPI
FolderView2_GetVisibleItem(IFolderView2
*iface
, int start
, BOOL previous
,
2956 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2957 FIXME("(%p)->(%d %d %p), stub\n", This
, start
, previous
, item
);
2961 static HRESULT WINAPI
FolderView2_GetSelectedItem(IFolderView2
*iface
, int start
, int *item
)
2963 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2964 FIXME("(%p)->(%d %p), stub\n", This
, start
, item
);
2968 static HRESULT WINAPI
FolderView2_GetSelection(IFolderView2
*iface
, BOOL none_implies_folder
,
2969 IShellItemArray
**array
)
2971 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2972 FIXME("(%p)->(%d %p), stub\n", This
, none_implies_folder
, array
);
2976 static HRESULT WINAPI
FolderView2_GetSelectionState(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2979 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2980 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, flags
);
2984 static HRESULT WINAPI
FolderView2_InvokeVerbOnSelection(IFolderView2
*iface
, LPCSTR verb
)
2986 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2987 FIXME("(%p)->(%s), stub\n", This
, debugstr_a(verb
));
2991 static HRESULT WINAPI
FolderView2_SetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE mode
,
2994 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2995 FIXME("(%p)->(%d %d), stub\n", This
, mode
, size
);
2999 static HRESULT WINAPI
FolderView2_GetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE
*mode
,
3002 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3003 FIXME("(%p)->(%p %p), stub\n", This
, mode
, size
);
3007 static HRESULT WINAPI
FolderView2_SetGroupSubsetCount(IFolderView2
*iface
, UINT visible_rows
)
3009 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3010 FIXME("(%p)->(%u), stub\n", This
, visible_rows
);
3014 static HRESULT WINAPI
FolderView2_GetGroupSubsetCount(IFolderView2
*iface
, UINT
*visible_rows
)
3016 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3017 FIXME("(%p)->(%p), stub\n", This
, visible_rows
);
3021 static HRESULT WINAPI
FolderView2_SetRedraw(IFolderView2
*iface
, BOOL redraw
)
3023 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3024 TRACE("(%p)->(%d)\n", This
, redraw
);
3025 SendMessageW(This
->hWndList
, WM_SETREDRAW
, redraw
, 0);
3029 static HRESULT WINAPI
FolderView2_IsMoveInSameFolder(IFolderView2
*iface
)
3031 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3032 FIXME("(%p), stub\n", This
);
3036 static HRESULT WINAPI
FolderView2_DoRename(IFolderView2
*iface
)
3038 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3039 FIXME("(%p), stub\n", This
);
3043 static const IFolderView2Vtbl folderviewvtbl
=
3045 FolderView_QueryInterface
,
3048 FolderView_GetCurrentViewMode
,
3049 FolderView_SetCurrentViewMode
,
3050 FolderView_GetFolder
,
3052 FolderView_ItemCount
,
3054 FolderView_GetSelectionMarkedItem
,
3055 FolderView_GetFocusedItem
,
3056 FolderView_GetItemPosition
,
3057 FolderView_GetSpacing
,
3058 FolderView_GetDefaultSpacing
,
3059 FolderView_GetAutoArrange
,
3060 FolderView_SelectItem
,
3061 FolderView_SelectAndPositionItems
,
3062 FolderView2_SetGroupBy
,
3063 FolderView2_GetGroupBy
,
3064 FolderView2_SetViewProperty
,
3065 FolderView2_GetViewProperty
,
3066 FolderView2_SetTileViewProperties
,
3067 FolderView2_SetExtendedTileViewProperties
,
3068 FolderView2_SetText
,
3069 FolderView2_SetCurrentFolderFlags
,
3070 FolderView2_GetCurrentFolderFlags
,
3071 FolderView2_GetSortColumnCount
,
3072 FolderView2_SetSortColumns
,
3073 FolderView2_GetSortColumns
,
3074 FolderView2_GetItem
,
3075 FolderView2_GetVisibleItem
,
3076 FolderView2_GetSelectedItem
,
3077 FolderView2_GetSelection
,
3078 FolderView2_GetSelectionState
,
3079 FolderView2_InvokeVerbOnSelection
,
3080 FolderView2_SetViewModeAndIconSize
,
3081 FolderView2_GetViewModeAndIconSize
,
3082 FolderView2_SetGroupSubsetCount
,
3083 FolderView2_GetGroupSubsetCount
,
3084 FolderView2_SetRedraw
,
3085 FolderView2_IsMoveInSameFolder
,
3086 FolderView2_DoRename
3089 /* IShellFolderView */
3090 static HRESULT WINAPI
IShellFolderView_fnQueryInterface(IShellFolderView
*iface
, REFIID riid
, void **ppvObj
)
3092 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3093 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
3096 static ULONG WINAPI
IShellFolderView_fnAddRef(IShellFolderView
*iface
)
3098 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3099 return IShellView3_AddRef(&This
->IShellView3_iface
);
3102 static ULONG WINAPI
IShellFolderView_fnRelease(IShellFolderView
*iface
)
3104 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3105 return IShellView3_Release(&This
->IShellView3_iface
);
3108 static HRESULT WINAPI
IShellFolderView_fnRearrange(IShellFolderView
*iface
, LPARAM sort
)
3110 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3111 FIXME("(%p)->(%ld) stub\n", This
, sort
);
3115 static HRESULT WINAPI
IShellFolderView_fnGetArrangeParam(IShellFolderView
*iface
, LPARAM
*sort
)
3117 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3118 FIXME("(%p)->(%p) stub\n", This
, sort
);
3122 static HRESULT WINAPI
IShellFolderView_fnArrangeGrid(IShellFolderView
*iface
)
3124 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3125 FIXME("(%p) stub\n", This
);
3129 static HRESULT WINAPI
IShellFolderView_fnAutoArrange(IShellFolderView
*iface
)
3131 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3132 TRACE("(%p)\n", This
);
3133 return IFolderView2_SetCurrentFolderFlags(&This
->IFolderView2_iface
, FWF_AUTOARRANGE
, FWF_AUTOARRANGE
);
3136 static HRESULT WINAPI
IShellFolderView_fnGetAutoArrange(IShellFolderView
*iface
)
3138 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3139 TRACE("(%p)\n", This
);
3140 return IFolderView2_GetAutoArrange(&This
->IFolderView2_iface
);
3143 static HRESULT WINAPI
IShellFolderView_fnAddObject(
3144 IShellFolderView
*iface
,
3148 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3149 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3153 static HRESULT WINAPI
IShellFolderView_fnGetObject(
3154 IShellFolderView
*iface
,
3155 PITEMID_CHILD
*pidl
,
3158 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3159 TRACE("(%p)->(%p %d)\n", This
, pidl
, item
);
3160 return IFolderView2_Item(&This
->IFolderView2_iface
, item
, pidl
);
3163 static HRESULT WINAPI
IShellFolderView_fnRemoveObject(
3164 IShellFolderView
*iface
,
3168 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3170 TRACE("(%p)->(%p %p)\n", This
, pidl
, item
);
3174 *item
= LV_FindItemByPidl(This
, ILFindLastID(pidl
));
3175 SendMessageW(This
->hWndList
, LVM_DELETEITEM
, *item
, 0);
3180 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
3186 static HRESULT WINAPI
IShellFolderView_fnGetObjectCount(
3187 IShellFolderView
*iface
,
3190 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3191 TRACE("(%p)->(%p)\n", This
, count
);
3192 return IFolderView2_ItemCount(&This
->IFolderView2_iface
, SVGIO_ALLVIEW
, (INT
*)count
);
3195 static HRESULT WINAPI
IShellFolderView_fnSetObjectCount(
3196 IShellFolderView
*iface
,
3200 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3201 FIXME("(%p)->(%d %x) stub\n", This
, count
, flags
);
3205 static HRESULT WINAPI
IShellFolderView_fnUpdateObject(
3206 IShellFolderView
*iface
,
3207 PITEMID_CHILD pidl_old
,
3208 PITEMID_CHILD pidl_new
,
3211 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3212 FIXME("(%p)->(%p %p %p) stub\n", This
, pidl_old
, pidl_new
, item
);
3216 static HRESULT WINAPI
IShellFolderView_fnRefreshObject(
3217 IShellFolderView
*iface
,
3221 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3222 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3226 static HRESULT WINAPI
IShellFolderView_fnSetRedraw(
3227 IShellFolderView
*iface
,
3230 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3231 TRACE("(%p)->(%d)\n", This
, redraw
);
3232 return IFolderView2_SetRedraw(&This
->IFolderView2_iface
, redraw
);
3235 static HRESULT WINAPI
IShellFolderView_fnGetSelectedCount(
3236 IShellFolderView
*iface
,
3239 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3240 IShellItemArray
*selection
;
3243 TRACE("(%p)->(%p)\n", This
, count
);
3246 hr
= IFolderView2_GetSelection(&This
->IFolderView2_iface
, FALSE
, &selection
);
3250 hr
= IShellItemArray_GetCount(selection
, count
);
3251 IShellItemArray_Release(selection
);
3255 static HRESULT WINAPI
IShellFolderView_fnGetSelectedObjects(
3256 IShellFolderView
*iface
,
3257 PCITEMID_CHILD
**pidl
,
3260 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3262 TRACE("(%p)->(%p %p)\n", This
, pidl
, items
);
3264 *items
= ShellView_GetSelections( This
);
3268 *pidl
= LocalAlloc(0, *items
*sizeof(LPITEMIDLIST
));
3269 if (!*pidl
) return E_OUTOFMEMORY
;
3271 /* it's documented that caller shouldn't free PIDLs, only array itself */
3272 memcpy((PITEMID_CHILD
*)*pidl
, This
->apidl
, *items
*sizeof(LPITEMIDLIST
));
3278 static HRESULT WINAPI
IShellFolderView_fnIsDropOnSource(
3279 IShellFolderView
*iface
,
3280 IDropTarget
*drop_target
)
3282 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3283 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3287 static HRESULT WINAPI
IShellFolderView_fnGetDragPoint(
3288 IShellFolderView
*iface
,
3291 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3292 FIXME("(%p)->(%p) stub\n", This
, pt
);
3296 static HRESULT WINAPI
IShellFolderView_fnGetDropPoint(
3297 IShellFolderView
*iface
,
3300 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3301 FIXME("(%p)->(%p) stub\n", This
, pt
);
3305 static HRESULT WINAPI
IShellFolderView_fnMoveIcons(
3306 IShellFolderView
*iface
,
3309 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3310 TRACE("(%p)->(%p)\n", This
, obj
);
3314 static HRESULT WINAPI
IShellFolderView_fnSetItemPos(
3315 IShellFolderView
*iface
,
3316 PCUITEMID_CHILD pidl
,
3319 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3320 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, pt
);
3324 static HRESULT WINAPI
IShellFolderView_fnIsBkDropTarget(
3325 IShellFolderView
*iface
,
3326 IDropTarget
*drop_target
)
3328 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3329 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3333 static HRESULT WINAPI
IShellFolderView_fnSetClipboard(
3334 IShellFolderView
*iface
,
3337 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3338 FIXME("(%p)->(%d) stub\n", This
, move
);
3342 static HRESULT WINAPI
IShellFolderView_fnSetPoints(
3343 IShellFolderView
*iface
,
3346 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3347 FIXME("(%p)->(%p) stub\n", This
, obj
);
3351 static HRESULT WINAPI
IShellFolderView_fnGetItemSpacing(
3352 IShellFolderView
*iface
,
3353 ITEMSPACING
*spacing
)
3355 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3356 FIXME("(%p)->(%p) stub\n", This
, spacing
);
3360 static HRESULT WINAPI
IShellFolderView_fnSetCallback(
3361 IShellFolderView
*iface
,
3362 IShellFolderViewCB
*new_cb
,
3363 IShellFolderViewCB
**old_cb
)
3366 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3367 FIXME("(%p)->(%p %p) stub\n", This
, new_cb
, old_cb
);
3371 static HRESULT WINAPI
IShellFolderView_fnSelect(
3372 IShellFolderView
*iface
,
3375 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3376 FIXME("(%p)->(%d) stub\n", This
, flags
);
3380 static HRESULT WINAPI
IShellFolderView_fnQuerySupport(
3381 IShellFolderView
*iface
,
3384 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3385 TRACE("(%p)->(%p)\n", This
, support
);
3389 static HRESULT WINAPI
IShellFolderView_fnSetAutomationObject(
3390 IShellFolderView
*iface
,
3393 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3394 FIXME("(%p)->(%p) stub\n", This
, disp
);
3398 static const IShellFolderViewVtbl shellfolderviewvtbl
=
3400 IShellFolderView_fnQueryInterface
,
3401 IShellFolderView_fnAddRef
,
3402 IShellFolderView_fnRelease
,
3403 IShellFolderView_fnRearrange
,
3404 IShellFolderView_fnGetArrangeParam
,
3405 IShellFolderView_fnArrangeGrid
,
3406 IShellFolderView_fnAutoArrange
,
3407 IShellFolderView_fnGetAutoArrange
,
3408 IShellFolderView_fnAddObject
,
3409 IShellFolderView_fnGetObject
,
3410 IShellFolderView_fnRemoveObject
,
3411 IShellFolderView_fnGetObjectCount
,
3412 IShellFolderView_fnSetObjectCount
,
3413 IShellFolderView_fnUpdateObject
,
3414 IShellFolderView_fnRefreshObject
,
3415 IShellFolderView_fnSetRedraw
,
3416 IShellFolderView_fnGetSelectedCount
,
3417 IShellFolderView_fnGetSelectedObjects
,
3418 IShellFolderView_fnIsDropOnSource
,
3419 IShellFolderView_fnGetDragPoint
,
3420 IShellFolderView_fnGetDropPoint
,
3421 IShellFolderView_fnMoveIcons
,
3422 IShellFolderView_fnSetItemPos
,
3423 IShellFolderView_fnIsBkDropTarget
,
3424 IShellFolderView_fnSetClipboard
,
3425 IShellFolderView_fnSetPoints
,
3426 IShellFolderView_fnGetItemSpacing
,
3427 IShellFolderView_fnSetCallback
,
3428 IShellFolderView_fnSelect
,
3429 IShellFolderView_fnQuerySupport
,
3430 IShellFolderView_fnSetAutomationObject
3433 static HRESULT WINAPI
shellfolderviewdual_QueryInterface(IShellFolderViewDual3
*iface
, REFIID riid
, void **ppvObj
)
3435 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3437 TRACE("(%p)->(IID:%s,%p)\n", This
, debugstr_guid(riid
), ppvObj
);
3439 if (IsEqualIID(riid
, &IID_IShellFolderViewDual3
) ||
3440 IsEqualIID(riid
, &IID_IShellFolderViewDual2
) ||
3441 IsEqualIID(riid
, &IID_IShellFolderViewDual
) ||
3442 IsEqualIID(riid
, &IID_IDispatch
) ||
3443 IsEqualIID(riid
, &IID_IUnknown
))
3446 IShellFolderViewDual3_AddRef(iface
);
3450 WARN("unsupported interface %s\n", debugstr_guid(riid
));
3451 return E_NOINTERFACE
;
3454 static ULONG WINAPI
shellfolderviewdual_AddRef(IShellFolderViewDual3
*iface
)
3456 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3457 return IShellView3_AddRef(&This
->IShellView3_iface
);
3460 static ULONG WINAPI
shellfolderviewdual_Release(IShellFolderViewDual3
*iface
)
3462 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3463 return IShellView3_Release(&This
->IShellView3_iface
);
3466 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfoCount(IShellFolderViewDual3
*iface
, UINT
*pctinfo
)
3468 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3469 TRACE("%p %p\n", This
, pctinfo
);
3474 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfo(IShellFolderViewDual3
*iface
,
3475 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
3477 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3480 TRACE("(%p,%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3482 hr
= get_typeinfo(IShellFolderViewDual3_tid
, ppTInfo
);
3484 ITypeInfo_AddRef(*ppTInfo
);
3488 static HRESULT WINAPI
shellfolderviewdual_GetIDsOfNames(
3489 IShellFolderViewDual3
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT
3490 cNames
, LCID lcid
, DISPID
*rgDispId
)
3492 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3496 TRACE("(%p, %s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
,
3497 cNames
, lcid
, rgDispId
);
3499 hr
= get_typeinfo(IShellFolderViewDual3_tid
, &ti
);
3501 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3505 static HRESULT WINAPI
shellfolderviewdual_Invoke(IShellFolderViewDual3
*iface
,
3506 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
,
3507 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
3510 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3514 TRACE("(%p, %d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3515 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3516 pExcepInfo
, puArgErr
);
3518 hr
= get_typeinfo(IShellFolderViewDual3_tid
, &ti
);
3520 hr
= ITypeInfo_Invoke(ti
, &This
->IShellFolderViewDual3_iface
, dispIdMember
, wFlags
, pDispParams
,
3521 pVarResult
, pExcepInfo
, puArgErr
);
3526 static HRESULT WINAPI
shellfolderviewdual_get_Application(IShellFolderViewDual3
*iface
,
3529 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3531 TRACE("%p %p\n", This
, disp
);
3534 return E_INVALIDARG
;
3536 return IShellDispatch_Constructor(NULL
, &IID_IDispatch
, (void**)disp
);
3539 static HRESULT WINAPI
shellfolderviewdual_get_Parent(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3541 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3542 FIXME("%p %p\n", This
, disp
);
3546 static HRESULT WINAPI
shellfolderviewdual_get_Folder(IShellFolderViewDual3
*iface
, Folder
**folder
)
3548 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3549 FIXME("%p %p\n", This
, folder
);
3553 static HRESULT WINAPI
shellfolderviewdual_SelectedItems(IShellFolderViewDual3
*iface
, FolderItems
**items
)
3555 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3556 FIXME("%p %p\n", This
, items
);
3560 static HRESULT WINAPI
shellfolderviewdual_get_FocusedItem(IShellFolderViewDual3
*iface
,
3563 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3564 FIXME("%p %p\n", This
, item
);
3568 static HRESULT WINAPI
shellfolderviewdual_SelectItem(IShellFolderViewDual3
*iface
,
3569 VARIANT
*v
, int flags
)
3571 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3572 FIXME("%p %s %x\n", This
, debugstr_variant(v
), flags
);
3576 static HRESULT WINAPI
shellfolderviewdual_PopupItemMenu(IShellFolderViewDual3
*iface
,
3577 FolderItem
*item
, VARIANT vx
, VARIANT vy
, BSTR
*command
)
3579 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3580 FIXME("%p %p %s %s %p\n", This
, item
, debugstr_variant(&vx
), debugstr_variant(&vy
), command
);
3584 static HRESULT WINAPI
shellfolderviewdual_get_Script(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3586 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3587 FIXME("%p %p\n", This
, disp
);
3591 static HRESULT WINAPI
shellfolderviewdual_get_ViewOptions(IShellFolderViewDual3
*iface
, LONG
*options
)
3593 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3594 FIXME("%p %p\n", This
, options
);
3598 static HRESULT WINAPI
shellfolderviewdual_get_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT
*mode
)
3600 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3601 FIXME("%p %p\n", This
, mode
);
3605 static HRESULT WINAPI
shellfolderviewdual_put_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT mode
)
3607 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3608 FIXME("%p %u\n", This
, mode
);
3612 static HRESULT WINAPI
shellfolderviewdual_SelectItemRelative(IShellFolderViewDual3
*iface
, int relative
)
3614 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3615 FIXME("%p %d\n", This
, relative
);
3619 static HRESULT WINAPI
shellfolderviewdual_get_GroupBy(IShellFolderViewDual3
*iface
, BSTR
*groupby
)
3621 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3622 FIXME("%p %p\n", This
, groupby
);
3626 static HRESULT WINAPI
shellfolderviewdual_put_GroupBy(IShellFolderViewDual3
*iface
, BSTR groupby
)
3628 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3629 FIXME("%p %s\n", This
, debugstr_w(groupby
));
3633 static HRESULT WINAPI
shellfolderviewdual_get_FolderFlags(IShellFolderViewDual3
*iface
, DWORD
*flags
)
3635 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3636 FIXME("%p %p\n", This
, flags
);
3640 static HRESULT WINAPI
shellfolderviewdual_put_FolderFlags(IShellFolderViewDual3
*iface
, DWORD flags
)
3642 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3643 FIXME("%p 0x%08x\n", This
, flags
);
3647 static HRESULT WINAPI
shellfolderviewdual_get_SortColumns(IShellFolderViewDual3
*iface
, BSTR
*sortcolumns
)
3649 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3650 FIXME("%p %p\n", This
, sortcolumns
);
3654 static HRESULT WINAPI
shellfolderviewdual_put_SortColumns(IShellFolderViewDual3
*iface
, BSTR sortcolumns
)
3656 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3657 FIXME("%p %s\n", This
, debugstr_w(sortcolumns
));
3661 static HRESULT WINAPI
shellfolderviewdual_put_IconSize(IShellFolderViewDual3
*iface
, int icon_size
)
3663 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3664 FIXME("%p %d\n", This
, icon_size
);
3668 static HRESULT WINAPI
shellfolderviewdual_get_IconSize(IShellFolderViewDual3
*iface
, int *icon_size
)
3670 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3671 FIXME("%p %p\n", This
, icon_size
);
3675 static HRESULT WINAPI
shellfolderviewdual_FilterView(IShellFolderViewDual3
*iface
, BSTR filter_text
)
3677 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3678 FIXME("%p %s\n", This
, debugstr_w(filter_text
));
3682 static const IShellFolderViewDual3Vtbl shellfolderviewdualvtbl
=
3684 shellfolderviewdual_QueryInterface
,
3685 shellfolderviewdual_AddRef
,
3686 shellfolderviewdual_Release
,
3687 shellfolderviewdual_GetTypeInfoCount
,
3688 shellfolderviewdual_GetTypeInfo
,
3689 shellfolderviewdual_GetIDsOfNames
,
3690 shellfolderviewdual_Invoke
,
3691 shellfolderviewdual_get_Application
,
3692 shellfolderviewdual_get_Parent
,
3693 shellfolderviewdual_get_Folder
,
3694 shellfolderviewdual_SelectedItems
,
3695 shellfolderviewdual_get_FocusedItem
,
3696 shellfolderviewdual_SelectItem
,
3697 shellfolderviewdual_PopupItemMenu
,
3698 shellfolderviewdual_get_Script
,
3699 shellfolderviewdual_get_ViewOptions
,
3700 shellfolderviewdual_get_CurrentViewMode
,
3701 shellfolderviewdual_put_CurrentViewMode
,
3702 shellfolderviewdual_SelectItemRelative
,
3703 shellfolderviewdual_get_GroupBy
,
3704 shellfolderviewdual_put_GroupBy
,
3705 shellfolderviewdual_get_FolderFlags
,
3706 shellfolderviewdual_put_FolderFlags
,
3707 shellfolderviewdual_get_SortColumns
,
3708 shellfolderviewdual_put_SortColumns
,
3709 shellfolderviewdual_put_IconSize
,
3710 shellfolderviewdual_get_IconSize
,
3711 shellfolderviewdual_FilterView
3714 /**********************************************************
3715 * IShellView_Constructor
3717 IShellView
*IShellView_Constructor(IShellFolder
*folder
)
3721 sv
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IShellViewImpl
));
3726 sv
->IShellView3_iface
.lpVtbl
= &shellviewvtbl
;
3727 sv
->IOleCommandTarget_iface
.lpVtbl
= &olecommandtargetvtbl
;
3728 sv
->IDropTarget_iface
.lpVtbl
= &droptargetvtbl
;
3729 sv
->IDropSource_iface
.lpVtbl
= &dropsourcevtbl
;
3730 sv
->IViewObject_iface
.lpVtbl
= &viewobjectvtbl
;
3731 sv
->IFolderView2_iface
.lpVtbl
= &folderviewvtbl
;
3732 sv
->IShellFolderView_iface
.lpVtbl
= &shellfolderviewvtbl
;
3733 sv
->IShellFolderViewDual3_iface
.lpVtbl
= &shellfolderviewdualvtbl
;
3735 sv
->pSFParent
= folder
;
3736 if (folder
) IShellFolder_AddRef(folder
);
3737 IShellFolder_QueryInterface(sv
->pSFParent
, &IID_IShellFolder2
, (void**)&sv
->pSF2Parent
);
3739 sv
->pCurDropTarget
= NULL
;
3740 sv
->pCurDataObject
= NULL
;
3741 sv
->iDragOverItem
= 0;
3742 sv
->cScrollDelay
= 0;
3743 sv
->ptLastMousePos
.x
= 0;
3744 sv
->ptLastMousePos
.y
= 0;
3746 TRACE("(%p)->(%p)\n", sv
, folder
);
3747 return (IShellView
*)&sv
->IShellView3_iface
;
3750 /*************************************************************************
3751 * SHCreateShellFolderView [SHELL32.256]
3753 * Create a new instance of the default Shell folder view object.
3757 * Failure: error value
3760 * see IShellFolder::CreateViewObject
3762 HRESULT WINAPI
SHCreateShellFolderView(const SFV_CREATE
*desc
, IShellView
**shellview
)
3764 TRACE("(%p, %p)\n", desc
, shellview
);
3768 if (!desc
|| desc
->cbSize
!= sizeof(*desc
))
3769 return E_INVALIDARG
;
3771 TRACE("sf=%p outer=%p callback=%p\n", desc
->pshf
, desc
->psvOuter
, desc
->psfvcb
);
3774 return E_UNEXPECTED
;
3776 *shellview
= IShellView_Constructor(desc
->pshf
);
3778 return E_OUTOFMEMORY
;
3782 IShellFolderView
*view
;
3783 IShellView_QueryInterface(*shellview
, &IID_IShellFolderView
, (void **)&view
);
3784 IShellFolderView_SetCallback(view
, desc
->psfvcb
, NULL
);
3785 IShellFolderView_Release(view
);
3791 /*************************************************************************
3792 * SHCreateShellFolderViewEx [SHELL32.174]
3794 * Create a new instance of the default Shell folder view object.
3798 * Failure: error value
3801 * see IShellFolder::CreateViewObject
3803 HRESULT WINAPI
SHCreateShellFolderViewEx(CSFV
*desc
, IShellView
**shellview
)
3805 TRACE("(%p, %p)\n", desc
, shellview
);
3807 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", desc
->pshf
, desc
->pidl
, desc
->pfnCallback
,
3808 desc
->fvm
, desc
->psvOuter
);
3811 return E_UNEXPECTED
;
3813 *shellview
= IShellView_Constructor(desc
->pshf
);
3815 return E_OUTOFMEMORY
;