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"
47 #define NONAMELESSUNION
60 #include "undocshell.h"
62 #include "wine/debug.h"
66 #include "shell32_main.h"
67 #include "shellfolder.h"
69 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
71 static const WCHAR SV_CLASS_NAME
[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0};
77 }LISTVIEW_SORT_INFO
, *LPLISTVIEW_SORT_INFO
;
81 IShellView3 IShellView3_iface
;
82 IOleCommandTarget IOleCommandTarget_iface
;
83 IDropTarget IDropTarget_iface
;
84 IDropSource IDropSource_iface
;
85 IViewObject IViewObject_iface
;
86 IFolderView2 IFolderView2_iface
;
87 IShellFolderView IShellFolderView_iface
;
88 IShellFolderViewDual3 IShellFolderViewDual3_iface
;
90 IShellFolder
* pSFParent
;
91 IShellFolder2
* pSF2Parent
;
92 IShellBrowser
* pShellBrowser
;
93 ICommDlgBrowser
* pCommDlgBrowser
;
94 HWND hWnd
; /* SHELLDLL_DefView */
95 HWND hWndList
; /* ListView control */
97 FOLDERSETTINGS FolderSettings
;
102 LISTVIEW_SORT_INFO ListViewSortInfo
;
103 ULONG hNotify
; /* change notification handle */
107 IAdviseSink
*pAdvSink
;
108 IDropTarget
* pCurDropTarget
; /* The sub-item, which is currently dragged over */
109 IDataObject
* pCurDataObject
; /* The dragged data-object */
110 LONG iDragOverItem
; /* Dragged over item's index, iff pCurDropTarget != NULL */
111 UINT cScrollDelay
; /* Send a WM_*SCROLL msg every 250 ms during drag-scroll */
112 POINT ptLastMousePos
; /* Mouse position at last DragOver call */
115 static inline IShellViewImpl
*impl_from_IShellView3(IShellView3
*iface
)
117 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellView3_iface
);
120 static inline IShellViewImpl
*impl_from_IOleCommandTarget(IOleCommandTarget
*iface
)
122 return CONTAINING_RECORD(iface
, IShellViewImpl
, IOleCommandTarget_iface
);
125 static inline IShellViewImpl
*impl_from_IDropTarget(IDropTarget
*iface
)
127 return CONTAINING_RECORD(iface
, IShellViewImpl
, IDropTarget_iface
);
130 static inline IShellViewImpl
*impl_from_IDropSource(IDropSource
*iface
)
132 return CONTAINING_RECORD(iface
, IShellViewImpl
, IDropSource_iface
);
135 static inline IShellViewImpl
*impl_from_IViewObject(IViewObject
*iface
)
137 return CONTAINING_RECORD(iface
, IShellViewImpl
, IViewObject_iface
);
140 static inline IShellViewImpl
*impl_from_IFolderView2(IFolderView2
*iface
)
142 return CONTAINING_RECORD(iface
, IShellViewImpl
, IFolderView2_iface
);
145 static inline IShellViewImpl
*impl_from_IShellFolderView(IShellFolderView
*iface
)
147 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellFolderView_iface
);
150 static inline IShellViewImpl
*impl_from_IShellFolderViewDual3(IShellFolderViewDual3
*iface
)
152 return CONTAINING_RECORD(iface
, IShellViewImpl
, IShellFolderViewDual3_iface
);
155 /* ListView Header IDs */
156 #define LISTVIEW_COLUMN_NAME 0
157 #define LISTVIEW_COLUMN_SIZE 1
158 #define LISTVIEW_COLUMN_TYPE 2
159 #define LISTVIEW_COLUMN_TIME 3
160 #define LISTVIEW_COLUMN_ATTRIB 4
163 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
164 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
165 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
167 #define ID_LISTVIEW 1
169 #define SHV_CHANGE_NOTIFY WM_USER + 0x1111
172 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
173 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
174 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
177 Items merged into the toolbar and the filemenu
186 } MYTOOLINFO
, *LPMYTOOLINFO
;
188 static const MYTOOLINFO Tools
[] =
190 { FCIDM_SHVIEW_BIGICON
, 0, 0, IDS_VIEW_LARGE
, TBSTATE_ENABLED
, BTNS_BUTTON
},
191 { FCIDM_SHVIEW_SMALLICON
, 0, 0, IDS_VIEW_SMALL
, TBSTATE_ENABLED
, BTNS_BUTTON
},
192 { FCIDM_SHVIEW_LISTVIEW
, 0, 0, IDS_VIEW_LIST
, TBSTATE_ENABLED
, BTNS_BUTTON
},
193 { FCIDM_SHVIEW_REPORTVIEW
, 0, 0, IDS_VIEW_DETAILS
, TBSTATE_ENABLED
, BTNS_BUTTON
},
197 typedef void (CALLBACK
*PFNSHGETSETTINGSPROC
)(LPSHELLFLAGSTATE lpsfs
, DWORD dwMask
);
199 /**********************************************************
201 * ##### helperfunctions for communication with ICommDlgBrowser #####
203 static BOOL
IsInCommDlg(IShellViewImpl
* This
)
205 return This
->pCommDlgBrowser
!= NULL
;
208 static HRESULT
IncludeObject(IShellViewImpl
* This
, LPCITEMIDLIST pidl
)
212 if (IsInCommDlg(This
))
214 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl
);
215 ret
= ICommDlgBrowser_IncludeObject(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
, pidl
);
216 TRACE("-- returns 0x%08x\n", ret
);
222 static HRESULT
OnDefaultCommand(IShellViewImpl
* This
)
224 HRESULT ret
= S_FALSE
;
226 if (IsInCommDlg(This
))
228 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
229 ret
= ICommDlgBrowser_OnDefaultCommand(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
);
230 TRACE("-- returns 0x%08x\n", ret
);
236 static HRESULT
OnStateChange(IShellViewImpl
* This
, UINT change
)
238 HRESULT ret
= S_FALSE
;
240 if (IsInCommDlg(This
))
242 TRACE("ICommDlgBrowser::OnStateChange change=%d\n", change
);
243 ret
= ICommDlgBrowser_OnStateChange(This
->pCommDlgBrowser
, (IShellView
*)&This
->IShellView3_iface
, change
);
244 TRACE("-- returns 0x%08x\n", ret
);
250 /**********************************************************
251 * set the toolbar of the filedialog buttons
253 * - activates the buttons from the shellbrowser according to
256 static void CheckToolbar(IShellViewImpl
* This
)
262 if (IsInCommDlg(This
))
264 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
265 FCIDM_TB_SMALLICON
, This
->FolderSettings
.ViewMode
== FVM_LIST
, &result
);
266 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
267 FCIDM_TB_REPORTVIEW
, This
->FolderSettings
.ViewMode
== FVM_DETAILS
, &result
);
268 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
269 FCIDM_TB_SMALLICON
, TRUE
, &result
);
270 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
271 FCIDM_TB_REPORTVIEW
, TRUE
, &result
);
275 /**********************************************************
277 * ##### helperfunctions for initializing the view #####
279 /**********************************************************
280 * change the style of the listview control
282 static void SetStyle(IShellViewImpl
* This
, DWORD dwAdd
, DWORD dwRemove
)
286 TRACE("(%p)\n", This
);
288 tmpstyle
= GetWindowLongW(This
->hWndList
, GWL_STYLE
);
289 SetWindowLongW(This
->hWndList
, GWL_STYLE
, dwAdd
| (tmpstyle
& ~dwRemove
));
292 static DWORD
ViewModeToListStyle(UINT ViewMode
)
296 TRACE("%d\n", ViewMode
);
300 case FVM_ICON
: dwStyle
= LVS_ICON
; break;
301 case FVM_DETAILS
: dwStyle
= LVS_REPORT
; break;
302 case FVM_SMALLICON
: dwStyle
= LVS_SMALLICON
; break;
303 case FVM_LIST
: dwStyle
= LVS_LIST
; break;
306 FIXME("ViewMode %d not implemented\n", ViewMode
);
315 /**********************************************************
316 * ShellView_CreateList()
318 * - creates the list view window
320 static BOOL
ShellView_CreateList (IShellViewImpl
* This
)
321 { DWORD dwStyle
, dwExStyle
;
325 dwStyle
= WS_TABSTOP
| WS_VISIBLE
| WS_CHILDWINDOW
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
|
326 LVS_SHAREIMAGELISTS
| LVS_EDITLABELS
| LVS_ALIGNLEFT
| LVS_AUTOARRANGE
;
327 dwExStyle
= WS_EX_CLIENTEDGE
;
329 dwStyle
|= ViewModeToListStyle(This
->FolderSettings
.ViewMode
);
331 if (This
->FolderSettings
.fFlags
& FWF_AUTOARRANGE
) dwStyle
|= LVS_AUTOARRANGE
;
332 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
333 This
->FolderSettings
.fFlags
|= FWF_NOCLIENTEDGE
| FWF_NOSCROLL
;
334 if (This
->FolderSettings
.fFlags
& FWF_SINGLESEL
) dwStyle
|= LVS_SINGLESEL
;
335 if (This
->FolderSettings
.fFlags
& FWF_NOCLIENTEDGE
)
336 dwExStyle
&= ~WS_EX_CLIENTEDGE
;
338 This
->hWndList
=CreateWindowExW( dwExStyle
,
351 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
352 This
->ListViewSortInfo
.nHeaderID
= -1;
353 This
->ListViewSortInfo
.nLastHeaderID
= -1;
355 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
) {
357 * FIXME: look at the registry value
358 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
359 * and activate drop shadows if necessary
362 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, CLR_NONE
);
364 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, GetSysColor(COLOR_DESKTOP
));
366 SendMessageW(This
->hWndList
, LVM_SETTEXTCOLOR
, 0, RGB(255,255,255));
369 /* UpdateShellSettings(); */
373 /**********************************************************
374 * ShellView_InitList()
376 * - adds all needed columns to the shellview
378 static void ShellView_InitList(IShellViewImpl
*This
)
380 IShellDetails
*details
= NULL
;
381 HIMAGELIST big_icons
, small_icons
;
388 TRACE("(%p)\n", This
);
390 Shell_GetImageLists( &big_icons
, &small_icons
);
391 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
392 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_SMALL
, (LPARAM
)small_icons
);
393 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_NORMAL
, (LPARAM
)big_icons
);
395 lvColumn
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_TEXT
;
396 lvColumn
.pszText
= nameW
;
398 if (!This
->pSF2Parent
)
400 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
403 WARN("IShellFolder2/IShellDetails not supported\n");
410 if (This
->pSF2Parent
)
411 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, NULL
, i
, &sd
);
413 hr
= IShellDetails_GetDetailsOf(details
, NULL
, i
, &sd
);
414 if (FAILED(hr
)) break;
416 lvColumn
.fmt
= sd
.fmt
;
417 lvColumn
.cx
= sd
.cxChar
*8; /* chars->pixel */
418 StrRetToStrNW(nameW
, sizeof(nameW
)/sizeof(WCHAR
), &sd
.str
, NULL
);
419 SendMessageW(This
->hWndList
, LVM_INSERTCOLUMNW
, i
, (LPARAM
) &lvColumn
);
422 if (details
) IShellDetails_Release(details
);
425 /**********************************************************
426 * ShellView_CompareItems()
429 * internal, CALLBACK for DSA_Sort
431 static INT CALLBACK
ShellView_CompareItems(LPVOID lParam1
, LPVOID lParam2
, LPARAM lpData
)
434 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1
, lParam2
, (LPVOID
) lpData
);
436 if(!lpData
) return 0;
438 ret
= (SHORT
) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER
)lpData
, 0, (LPITEMIDLIST
)lParam1
, (LPITEMIDLIST
)lParam2
));
439 TRACE("ret=%i\n",ret
);
443 /*************************************************************************
444 * ShellView_ListViewCompareItems
446 * Compare Function for the Listview (FileOpen Dialog)
449 * lParam1 [I] the first ItemIdList to compare with
450 * lParam2 [I] the second ItemIdList to compare with
451 * lpData [I] The column ID for the header Ctrl to process
454 * A negative value if the first item should precede the second,
455 * a positive value if the first item should follow the second,
456 * or zero if the two items are equivalent
459 * FIXME: function does what ShellView_CompareItems is supposed to do.
460 * unify it and figure out how to use the undocumented first parameter
461 * of IShellFolder_CompareIDs to do the job this function does and
462 * move this code to IShellFolder.
463 * make LISTVIEW_SORT_INFO obsolete
464 * the way this function works is only usable if we had only
465 * filesystemfolders (25/10/99 jsch)
467 static INT CALLBACK
ShellView_ListViewCompareItems(LPVOID lParam1
, LPVOID lParam2
, LPARAM lpData
)
471 char strName1
[MAX_PATH
], strName2
[MAX_PATH
];
472 BOOL bIsFolder1
, bIsFolder2
,bIsBothFolder
;
473 LPITEMIDLIST pItemIdList1
= lParam1
;
474 LPITEMIDLIST pItemIdList2
= lParam2
;
475 LISTVIEW_SORT_INFO
*pSortInfo
= (LPLISTVIEW_SORT_INFO
) lpData
;
478 bIsFolder1
= _ILIsFolder(pItemIdList1
);
479 bIsFolder2
= _ILIsFolder(pItemIdList2
);
480 bIsBothFolder
= bIsFolder1
&& bIsFolder2
;
482 /* When sorting between a File and a Folder, the Folder gets sorted first */
483 if( (bIsFolder1
|| bIsFolder2
) && !bIsBothFolder
)
485 nDiff
= bIsFolder1
? -1 : 1;
489 /* Sort by Time: Folders or Files can be sorted */
491 if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TIME
)
493 _ILGetFileDateTime(pItemIdList1
, &fd1
);
494 _ILGetFileDateTime(pItemIdList2
, &fd2
);
495 nDiff
= CompareFileTime(&fd2
, &fd1
);
497 /* Sort by Attribute: Folder or Files can be sorted */
498 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_ATTRIB
)
500 _ILGetFileAttributes(pItemIdList1
, strName1
, MAX_PATH
);
501 _ILGetFileAttributes(pItemIdList2
, strName2
, MAX_PATH
);
502 nDiff
= lstrcmpiA(strName1
, strName2
);
504 /* Sort by FileName: Folder or Files can be sorted */
505 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_NAME
|| bIsBothFolder
)
508 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
509 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
510 nDiff
= lstrcmpiA(strName1
, strName2
);
512 /* Sort by File Size, Only valid for Files */
513 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_SIZE
)
515 nDiff
= (INT
)(_ILGetFileSize(pItemIdList1
, NULL
, 0) - _ILGetFileSize(pItemIdList2
, NULL
, 0));
517 /* Sort by File Type, Only valid for Files */
518 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TYPE
)
521 _ILGetFileType(pItemIdList1
, strName1
, MAX_PATH
);
522 _ILGetFileType(pItemIdList2
, strName2
, MAX_PATH
);
523 nDiff
= lstrcmpiA(strName1
, strName2
);
526 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
530 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
531 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
532 nDiff
= lstrcmpiA(strName1
, strName2
);
535 if(!pSortInfo
->bIsAscending
)
544 /**********************************************************
545 * LV_FindItemByPidl()
547 static int LV_FindItemByPidl(
548 IShellViewImpl
* This
,
553 lvItem
.mask
= LVIF_PARAM
;
554 for(lvItem
.iItem
= 0;
555 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
558 LPITEMIDLIST currentpidl
= (LPITEMIDLIST
) lvItem
.lParam
;
559 HRESULT hr
= IShellFolder_CompareIDs(This
->pSFParent
, 0, pidl
, currentpidl
);
560 if(SUCCEEDED(hr
) && !HRESULT_CODE(hr
))
568 /**********************************************************
571 static BOOLEAN
LV_AddItem(IShellViewImpl
* This
, LPCITEMIDLIST pidl
)
575 TRACE("(%p)(pidl=%p)\n", This
, pidl
);
577 lvItem
.mask
= LVIF_TEXT
| LVIF_IMAGE
| LVIF_PARAM
; /*set the mask*/
578 lvItem
.iItem
= SendMessageW(This
->hWndList
, LVM_GETITEMCOUNT
, 0, 0); /*add the item to the end of the list*/
580 lvItem
.lParam
= (LPARAM
) ILClone(ILFindLastID(pidl
)); /*set the item's data*/
581 lvItem
.pszText
= LPSTR_TEXTCALLBACKW
; /*get text on a callback basis*/
582 lvItem
.iImage
= I_IMAGECALLBACK
; /*get the image on a callback basis*/
583 return ListView_InsertItemW(This
->hWndList
, &lvItem
) != -1;
586 /**********************************************************
589 static BOOLEAN
LV_RenameItem(IShellViewImpl
* This
, LPCITEMIDLIST pidlOld
, LPCITEMIDLIST pidlNew
)
594 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This
, pidlOld
, pidlNew
);
596 nItem
= LV_FindItemByPidl(This
, ILFindLastID(pidlOld
));
599 lvItem
.mask
= LVIF_PARAM
; /* only the pidl */
600 lvItem
.iItem
= nItem
;
601 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
603 SHFree((LPITEMIDLIST
)lvItem
.lParam
);
604 lvItem
.mask
= LVIF_PARAM
;
605 lvItem
.iItem
= nItem
;
606 lvItem
.lParam
= (LPARAM
) ILClone(ILFindLastID(pidlNew
)); /* set the item's data */
607 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
608 SendMessageW(This
->hWndList
, LVM_UPDATE
, nItem
, 0);
609 return TRUE
; /* FIXME: better handling */
613 /**********************************************************
614 * ShellView_FillList()
616 * - gets the objectlist from the shellfolder
618 * - fills the list into the view
621 static INT CALLBACK
fill_list( LPVOID ptr
, LPVOID arg
)
623 LPITEMIDLIST pidl
= ptr
;
624 IShellViewImpl
*This
= arg
;
625 /* in a commdlg This works as a filemask*/
626 if ( IncludeObject(This
, pidl
)==S_OK
) LV_AddItem(This
, pidl
);
631 static HRESULT
ShellView_FillList(IShellViewImpl
*This
)
633 IFolderView2
*folderview
= &This
->IFolderView2_iface
;
634 LPENUMIDLIST pEnumIDList
;
640 TRACE("(%p)\n", This
);
642 /* get the itemlist from the shfolder*/
643 hr
= IShellFolder_EnumObjects(This
->pSFParent
, This
->hWnd
, SHCONTF_NONFOLDERS
| SHCONTF_FOLDERS
, &pEnumIDList
);
644 if (hr
!= S_OK
) return hr
;
646 /* create a pointer array */
647 hdpa
= DPA_Create(16);
650 IEnumIDList_Release(pEnumIDList
);
651 return E_OUTOFMEMORY
;
654 /* copy the items into the array*/
655 while((S_OK
== IEnumIDList_Next(pEnumIDList
, 1, &pidl
, &fetched
)) && fetched
)
657 if (DPA_InsertPtr(hdpa
, DPA_GetPtrCount(hdpa
), pidl
) == -1)
664 DPA_Sort(hdpa
, ShellView_CompareItems
, (LPARAM
)This
->pSFParent
);
666 IFolderView2_SetRedraw(folderview
, FALSE
);
667 DPA_DestroyCallback(hdpa
, fill_list
, This
);
668 IFolderView2_SetRedraw(folderview
, TRUE
);
670 IEnumIDList_Release(pEnumIDList
);
675 /**********************************************************
676 * ShellView_OnCreate()
678 static LRESULT
ShellView_OnCreate(IShellViewImpl
*This
)
680 IShellView3
*iface
= &This
->IShellView3_iface
;
681 static const WCHAR accel_nameW
[] = {'s','h','v','_','a','c','c','e','l',0};
682 IPersistFolder2
*ppf2
;
686 TRACE("(%p)\n", This
);
688 if (ShellView_CreateList(This
))
690 ShellView_InitList(This
);
691 ShellView_FillList(This
);
694 hr
= IShellView3_QueryInterface(iface
, &IID_IDropTarget
, (void**)&pdt
);
697 RegisterDragDrop(This
->hWnd
, pdt
);
698 IDropTarget_Release(pdt
);
701 /* register for receiving notifications */
702 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IPersistFolder2
, (LPVOID
*)&ppf2
);
705 LPITEMIDLIST raw_pidl
;
706 SHChangeNotifyEntry ntreg
;
708 hr
= IPersistFolder2_GetCurFolder(ppf2
, &raw_pidl
);
711 LPITEMIDLIST computer_pidl
;
712 SHGetFolderLocation(NULL
,CSIDL_DRIVES
,NULL
,0,&computer_pidl
);
713 if(ILIsParent(computer_pidl
,raw_pidl
,FALSE
))
715 /* Normalize the pidl to unixfs to workaround an issue with
716 * sending notifications on dos paths
718 WCHAR path
[MAX_PATH
];
719 SHGetPathFromIDListW(raw_pidl
,path
);
720 SHParseDisplayName(path
,NULL
,(LPITEMIDLIST
*)&ntreg
.pidl
,0,NULL
);
724 ntreg
.pidl
= raw_pidl
;
725 ntreg
.fRecursive
= TRUE
;
726 This
->hNotify
= SHChangeNotifyRegister(This
->hWnd
, SHCNRF_InterruptLevel
, SHCNE_ALLEVENTS
,
727 SHV_CHANGE_NOTIFY
, 1, &ntreg
);
728 SHFree((LPITEMIDLIST
)ntreg
.pidl
);
729 SHFree(computer_pidl
);
731 IPersistFolder2_Release(ppf2
);
734 This
->hAccel
= LoadAcceleratorsW(shell32_hInstance
, accel_nameW
);
739 /**********************************************************
740 * #### Handling of the menus ####
743 /**********************************************************
744 * ShellView_BuildFileMenu()
746 static HMENU
ShellView_BuildFileMenu(IShellViewImpl
* This
)
747 { WCHAR szText
[MAX_PATH
];
752 TRACE("(%p)\n",This
);
754 hSubMenu
= CreatePopupMenu();
756 { /*get the number of items in our global array*/
757 for(nTools
= 0; Tools
[nTools
].idCommand
!= -1; nTools
++){}
759 /*add the menu items*/
760 for(i
= 0; i
< nTools
; i
++)
762 LoadStringW(shell32_hInstance
, Tools
[i
].idMenuString
, szText
, MAX_PATH
);
764 ZeroMemory(&mii
, sizeof(mii
));
765 mii
.cbSize
= sizeof(mii
);
766 mii
.fMask
= MIIM_TYPE
| MIIM_ID
| MIIM_STATE
;
768 if(BTNS_SEP
!= Tools
[i
].bStyle
) /* no separator*/
770 mii
.fType
= MFT_STRING
;
771 mii
.fState
= MFS_ENABLED
;
772 mii
.dwTypeData
= szText
;
773 mii
.wID
= Tools
[i
].idCommand
;
777 mii
.fType
= MFT_SEPARATOR
;
779 /* tack This item onto the end of the menu */
780 InsertMenuItemW(hSubMenu
, (UINT
)-1, TRUE
, &mii
);
783 TRACE("-- return (menu=%p)\n",hSubMenu
);
786 /**********************************************************
787 * ShellView_MergeFileMenu()
789 static void ShellView_MergeFileMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
791 TRACE("(%p)->(submenu=%p) stub\n",This
,hSubMenu
);
795 static const WCHAR dummyW
[] = {'d','u','m','m','y','4','5',0};
798 /* insert This item at the beginning of the menu */
800 mii
.cbSize
= sizeof(mii
);
801 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
803 mii
.fType
= MFT_SEPARATOR
;
804 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
806 mii
.cbSize
= sizeof(mii
);
807 mii
.fMask
= MIIM_ID
| MIIM_TYPE
| MIIM_STATE
;
808 mii
.dwTypeData
= (LPWSTR
)dummyW
;
809 mii
.fState
= MFS_ENABLED
;
810 mii
.wID
= IDM_MYFILEITEM
;
811 mii
.fType
= MFT_STRING
;
812 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
818 /**********************************************************
819 * ShellView_MergeViewMenu()
822 static void ShellView_MergeViewMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
824 TRACE("(%p)->(submenu=%p)\n",This
,hSubMenu
);
826 /* add a separator at the correct position in the menu */
829 static const WCHAR menuW
[] = {'M','E','N','U','_','0','0','1',0};
830 static const WCHAR viewW
[] = {'V','i','e','w',0};
833 memset(&mii
, 0, sizeof(mii
));
834 mii
.cbSize
= sizeof(mii
);
835 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
837 mii
.fType
= MFT_SEPARATOR
;
838 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
840 mii
.cbSize
= sizeof(mii
);
841 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_DATA
;
842 mii
.fType
= MFT_STRING
;
843 mii
.dwTypeData
= (LPWSTR
)viewW
;
844 mii
.hSubMenu
= LoadMenuW(shell32_hInstance
, menuW
);
845 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
849 /**********************************************************
850 * ShellView_GetSelections()
852 * - fills the this->apidl list with the selected objects
855 * number of selected items
857 static UINT
ShellView_GetSelections(IShellViewImpl
* This
)
864 This
->cidl
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
865 This
->apidl
= SHAlloc(This
->cidl
* sizeof(LPITEMIDLIST
));
867 TRACE("selected=%i\n", This
->cidl
);
871 TRACE("-- Items selected =%u\n", This
->cidl
);
873 lvItem
.mask
= LVIF_STATE
| LVIF_PARAM
;
874 lvItem
.stateMask
= LVIS_SELECTED
;
878 while(ListView_GetItemW(This
->hWndList
, &lvItem
) && (i
< This
->cidl
))
880 if(lvItem
.state
& LVIS_SELECTED
)
882 This
->apidl
[i
] = (LPITEMIDLIST
)lvItem
.lParam
;
884 TRACE("-- selected Item found\n");
893 /**********************************************************
894 * ShellView_OpenSelectedItems()
896 static HRESULT
ShellView_OpenSelectedItems(IShellViewImpl
* This
)
898 static UINT CF_IDLIST
= 0;
900 IDataObject
* selection
;
904 LPCITEMIDLIST parent_pidl
;
905 WCHAR parent_path
[MAX_PATH
];
906 LPCWSTR parent_dir
= NULL
;
910 if (0 == ShellView_GetSelections(This
))
914 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
,
915 (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,
916 0, (LPVOID
*)&selection
);
922 CF_IDLIST
= RegisterClipboardFormatW(CFSTR_SHELLIDLISTW
);
924 fetc
.cfFormat
= CF_IDLIST
;
926 fetc
.dwAspect
= DVASPECT_CONTENT
;
928 fetc
.tymed
= TYMED_HGLOBAL
;
930 hr
= IDataObject_QueryGetData(selection
, &fetc
);
934 hr
= IDataObject_GetData(selection
, &fetc
, &stgm
);
938 pIDList
= GlobalLock(stgm
.u
.hGlobal
);
940 parent_pidl
= (LPCITEMIDLIST
) ((LPBYTE
)pIDList
+pIDList
->aoffset
[0]);
941 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &parent_pidl
, &attribs
);
942 if (SUCCEEDED(hr
) && (attribs
& SFGAO_FILESYSTEM
) &&
943 SHGetPathFromIDListW(parent_pidl
, parent_path
))
945 parent_dir
= parent_path
;
948 for (i
= pIDList
->cidl
; i
> 0; --i
)
952 pidl
= (LPCITEMIDLIST
)((LPBYTE
)pIDList
+pIDList
->aoffset
[i
]);
954 attribs
= SFGAO_FOLDER
;
955 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &pidl
, &attribs
);
957 if (SUCCEEDED(hr
) && ! (attribs
& SFGAO_FOLDER
))
959 SHELLEXECUTEINFOW shexinfo
;
961 shexinfo
.cbSize
= sizeof(SHELLEXECUTEINFOW
);
962 shexinfo
.fMask
= SEE_MASK_INVOKEIDLIST
; /* SEE_MASK_IDLIST is also possible. */
963 shexinfo
.hwnd
= NULL
;
964 shexinfo
.lpVerb
= NULL
;
965 shexinfo
.lpFile
= NULL
;
966 shexinfo
.lpParameters
= NULL
;
967 shexinfo
.lpDirectory
= parent_dir
;
968 shexinfo
.nShow
= SW_NORMAL
;
969 shexinfo
.lpIDList
= ILCombine(parent_pidl
, pidl
);
971 ShellExecuteExW(&shexinfo
); /* Discard error/success info */
973 ILFree(shexinfo
.lpIDList
);
977 GlobalUnlock(stgm
.u
.hGlobal
);
978 ReleaseStgMedium(&stgm
);
980 IDataObject_Release(selection
);
985 /**********************************************************
986 * ShellView_DoContextMenu()
988 static void ShellView_DoContextMenu(IShellViewImpl
* This
, WORD x
, WORD y
, BOOL bDefault
)
992 BOOL fExplore
= FALSE
;
994 LPCONTEXTMENU pContextMenu
= NULL
;
995 CMINVOKECOMMANDINFO cmi
;
997 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This
, x
, y
, bDefault
);
999 /* look, what's selected and create a context menu object of it*/
1000 if( ShellView_GetSelections(This
) )
1002 IShellFolder_GetUIObjectOf( This
->pSFParent
, This
->hWndParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
,
1003 &IID_IContextMenu
, NULL
, (LPVOID
*)&pContextMenu
);
1007 TRACE("-- pContextMenu\n");
1008 hMenu
= CreatePopupMenu();
1012 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
1013 if(SUCCEEDED(IShellBrowser_GetControlWindow(This
->pShellBrowser
,FCW_TREE
, &hwndTree
)) && hwndTree
)
1015 TRACE("-- explore mode\n");
1019 /* build the flags depending on what we can do with the selected item */
1020 wFlags
= CMF_NORMAL
| (This
->cidl
!= 1 ? 0 : CMF_CANRENAME
) | (fExplore
? CMF_EXPLORE
: 0);
1022 /* let the ContextMenu merge its items in */
1023 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, wFlags
)))
1025 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
1026 SetMenuDefaultItem(hMenu
, FCIDM_SHVIEW_OPEN
, MF_BYCOMMAND
);
1030 TRACE("-- get menu default command\n");
1031 uCommand
= GetMenuDefaultItem(hMenu
, FALSE
, GMDI_GOINTOPOPUPS
);
1035 TRACE("-- track popup\n");
1036 uCommand
= TrackPopupMenu( hMenu
,TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1041 TRACE("-- uCommand=%u\n", uCommand
);
1042 if (uCommand
==FCIDM_SHVIEW_OPEN
&& IsInCommDlg(This
))
1044 TRACE("-- dlg: OnDefaultCommand\n");
1045 if (OnDefaultCommand(This
) != S_OK
)
1047 ShellView_OpenSelectedItems(This
);
1052 TRACE("-- explore -- invoke command\n");
1053 ZeroMemory(&cmi
, sizeof(cmi
));
1054 cmi
.cbSize
= sizeof(cmi
);
1055 cmi
.hwnd
= This
->hWndParent
; /* this window has to answer CWM_GETISHELLBROWSER */
1056 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1057 IContextMenu_InvokeCommand(pContextMenu
, &cmi
);
1064 IContextMenu_Release(pContextMenu
);
1067 else /* background context menu */
1071 hMenu
= CreatePopupMenu();
1073 BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, &IID_IContextMenu2
, (void**)&pCM
);
1074 IContextMenu2_QueryContextMenu(pCM
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, 0);
1076 uCommand
= TrackPopupMenu( hMenu
, TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1079 TRACE("-- (%p)->(uCommand=0x%08x )\n",This
, uCommand
);
1081 ZeroMemory(&cmi
, sizeof(cmi
));
1082 cmi
.cbSize
= sizeof(cmi
);
1083 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1084 cmi
.hwnd
= This
->hWndParent
;
1085 IContextMenu2_InvokeCommand(pCM
, &cmi
);
1087 IContextMenu2_Release(pCM
);
1091 /**********************************************************
1092 * ##### message handling #####
1095 /**********************************************************
1096 * ShellView_OnSize()
1098 static LRESULT
ShellView_OnSize(IShellViewImpl
* This
, WORD wWidth
, WORD wHeight
)
1100 TRACE("%p width=%u height=%u\n",This
, wWidth
,wHeight
);
1102 /*resize the ListView to fit our window*/
1105 MoveWindow(This
->hWndList
, 0, 0, wWidth
, wHeight
, TRUE
);
1110 /**********************************************************
1111 * ShellView_OnDeactivate()
1116 static void ShellView_OnDeactivate(IShellViewImpl
* This
)
1120 if(This
->uState
!= SVUIA_DEACTIVATE
)
1124 IShellBrowser_SetMenuSB(This
->pShellBrowser
,0, 0, 0);
1125 IShellBrowser_RemoveMenusSB(This
->pShellBrowser
,This
->hMenu
);
1126 DestroyMenu(This
->hMenu
);
1130 This
->uState
= SVUIA_DEACTIVATE
;
1134 /**********************************************************
1135 * ShellView_OnActivate()
1137 static LRESULT
ShellView_OnActivate(IShellViewImpl
*This
, UINT uState
)
1139 OLEMENUGROUPWIDTHS omw
= { {0, 0, 0, 0, 0, 0} };
1142 TRACE("(%p) uState=%x\n",This
,uState
);
1144 /* don't do anything if the state isn't really changing */
1145 if (This
->uState
== uState
) return S_OK
;
1147 ShellView_OnDeactivate(This
);
1149 /* only do This if we are active */
1150 if (uState
!= SVUIA_DEACTIVATE
)
1152 /* merge the menus */
1153 This
->hMenu
= CreateMenu();
1157 static const WCHAR dummyW
[] = {'d','u','m','m','y',' ','3','1',0};
1159 IShellBrowser_InsertMenusSB(This
->pShellBrowser
, This
->hMenu
, &omw
);
1160 TRACE("-- after fnInsertMenusSB\n");
1162 mii
.cbSize
= sizeof(mii
);
1163 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_STATE
;
1164 mii
.fType
= MFT_STRING
;
1165 mii
.fState
= MFS_ENABLED
;
1167 mii
.hSubMenu
= ShellView_BuildFileMenu(This
);
1168 mii
.hbmpChecked
= NULL
;
1169 mii
.hbmpUnchecked
= NULL
;
1171 /* build the top level menu get the menu item's text */
1172 mii
.dwTypeData
= (LPWSTR
)dummyW
;
1174 mii
.hbmpItem
= NULL
;
1176 /* insert our menu into the menu bar */
1178 InsertMenuItemW(This
->hMenu
, FCIDM_MENU_HELP
, FALSE
, &mii
);
1180 /* get the view menu so we can merge with it */
1181 memset(&mii
, 0, sizeof(mii
));
1182 mii
.cbSize
= sizeof(mii
);
1183 mii
.fMask
= MIIM_SUBMENU
;
1185 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_VIEW
, FALSE
, &mii
))
1186 ShellView_MergeViewMenu(This
, mii
.hSubMenu
);
1188 /* add the items that should only be added if we have the focus */
1189 if (SVUIA_ACTIVATE_FOCUS
== uState
)
1191 /* get the file menu so we can merge with it */
1192 memset(&mii
, 0, sizeof(mii
));
1193 mii
.cbSize
= sizeof(mii
);
1194 mii
.fMask
= MIIM_SUBMENU
;
1196 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_FILE
, FALSE
, &mii
))
1197 ShellView_MergeFileMenu(This
, mii
.hSubMenu
);
1200 TRACE("-- before fnSetMenuSB\n");
1201 IShellBrowser_SetMenuSB(This
->pShellBrowser
, This
->hMenu
, 0, This
->hWnd
);
1204 This
->uState
= uState
;
1209 /**********************************************************
1210 * ShellView_OnSetFocus()
1213 static LRESULT
ShellView_OnSetFocus(IShellViewImpl
* This
)
1217 /* Tell the browser one of our windows has received the focus. This
1218 should always be done before merging menus (OnActivate merges the
1219 menus) if one of our windows has the focus.*/
1221 IShellBrowser_OnViewWindowActive(This
->pShellBrowser
, (IShellView
*)&This
->IShellView3_iface
);
1222 ShellView_OnActivate(This
, SVUIA_ACTIVATE_FOCUS
);
1224 /* Set the focus to the listview */
1225 SetFocus(This
->hWndList
);
1227 /* Notify the ICommDlgBrowser interface */
1228 OnStateChange(This
,CDBOSC_SETFOCUS
);
1233 /**********************************************************
1234 * ShellView_OnKillFocus()
1236 static LRESULT
ShellView_OnKillFocus(IShellViewImpl
* This
)
1238 TRACE("(%p) stub\n",This
);
1240 ShellView_OnActivate(This
, SVUIA_ACTIVATE_NOFOCUS
);
1241 /* Notify the ICommDlgBrowser */
1242 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1247 /**********************************************************
1248 * ShellView_OnCommand()
1251 * the CmdIDs are the ones from the context menu
1253 static LRESULT
ShellView_OnCommand(IShellViewImpl
* This
,DWORD dwCmdID
, DWORD dwCmd
, HWND hwndCmd
)
1255 TRACE("(%p)->(0x%08x 0x%08x %p) stub\n",This
, dwCmdID
, dwCmd
, hwndCmd
);
1259 case FCIDM_SHVIEW_SMALLICON
:
1260 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
1261 SetStyle (This
, LVS_SMALLICON
, LVS_TYPEMASK
);
1265 case FCIDM_SHVIEW_BIGICON
:
1266 This
->FolderSettings
.ViewMode
= FVM_ICON
;
1267 SetStyle (This
, LVS_ICON
, LVS_TYPEMASK
);
1271 case FCIDM_SHVIEW_LISTVIEW
:
1272 This
->FolderSettings
.ViewMode
= FVM_LIST
;
1273 SetStyle (This
, LVS_LIST
, LVS_TYPEMASK
);
1277 case FCIDM_SHVIEW_REPORTVIEW
:
1278 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
1279 SetStyle (This
, LVS_REPORT
, LVS_TYPEMASK
);
1283 /* the menu IDs for sorting are 0x30... see shell32.rc */
1288 This
->ListViewSortInfo
.nHeaderID
= dwCmdID
- 0x30;
1289 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1290 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1291 SendMessageW(This
->hWndList
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1295 TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID
);
1300 /**********************************************************
1301 * ShellView_OnNotify()
1304 static LRESULT
ShellView_OnNotify(IShellViewImpl
* This
, UINT CtlID
, LPNMHDR lpnmh
)
1305 { LPNMLISTVIEW lpnmlv
= (LPNMLISTVIEW
)lpnmh
;
1306 NMLVDISPINFOW
*lpdi
= (NMLVDISPINFOW
*)lpnmh
;
1309 TRACE("%p CtlID=%u lpnmh->code=%x\n",This
,CtlID
,lpnmh
->code
);
1314 TRACE("-- NM_SETFOCUS %p\n",This
);
1315 ShellView_OnSetFocus(This
);
1319 TRACE("-- NM_KILLFOCUS %p\n",This
);
1320 ShellView_OnDeactivate(This
);
1321 /* Notify the ICommDlgBrowser interface */
1322 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1326 TRACE("-- NM_CUSTOMDRAW %p\n",This
);
1327 return CDRF_DODEFAULT
;
1329 case NM_RELEASEDCAPTURE
:
1330 TRACE("-- NM_RELEASEDCAPTURE %p\n",This
);
1334 TRACE("-- NM_CLICK %p\n",This
);
1338 TRACE("-- NM_RCLICK %p\n",This
);
1342 TRACE("-- NM_DBLCLK %p\n",This
);
1343 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1347 TRACE("-- NM_RETURN %p\n",This
);
1348 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1352 TRACE("-- HDN_ENDTRACKW %p\n",This
);
1353 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1354 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1357 case LVN_DELETEITEM
:
1358 TRACE("-- LVN_DELETEITEM %p\n",This
);
1359 SHFree((LPITEMIDLIST
)lpnmlv
->lParam
); /*delete the pidl because we made a copy of it*/
1362 case LVN_DELETEALLITEMS
:
1363 TRACE("-- LVN_DELETEALLITEMS %p\n",This
);
1366 case LVN_INSERTITEM
:
1367 TRACE("-- LVN_INSERTITEM (STUB)%p\n",This
);
1370 case LVN_ITEMACTIVATE
:
1371 TRACE("-- LVN_ITEMACTIVATE %p\n",This
);
1372 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1375 case LVN_COLUMNCLICK
:
1376 This
->ListViewSortInfo
.nHeaderID
= lpnmlv
->iSubItem
;
1377 if(This
->ListViewSortInfo
.nLastHeaderID
== This
->ListViewSortInfo
.nHeaderID
)
1379 This
->ListViewSortInfo
.bIsAscending
= !This
->ListViewSortInfo
.bIsAscending
;
1383 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1385 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1387 SendMessageW(lpnmlv
->hdr
.hwndFrom
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1390 case LVN_GETDISPINFOA
:
1391 case LVN_GETDISPINFOW
:
1392 TRACE("-- LVN_GETDISPINFO %p\n",This
);
1393 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1395 if(lpdi
->item
.mask
& LVIF_TEXT
) /* text requested */
1397 static WCHAR emptyW
[] = { 0 };
1401 if (This
->pSF2Parent
)
1403 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1407 IShellDetails
*details
;
1409 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
1412 hr
= IShellDetails_GetDetailsOf(details
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1413 IShellDetails_Release(details
);
1416 WARN("IShellFolder2/IShellDetails not supported\n");
1421 /* set to empty on failure */
1422 sd
.str
.uType
= STRRET_WSTR
;
1423 sd
.str
.u
.pOleStr
= emptyW
;
1426 if (lpnmh
->code
== LVN_GETDISPINFOW
)
1428 StrRetToStrNW( lpdi
->item
.pszText
, lpdi
->item
.cchTextMax
, &sd
.str
, NULL
);
1429 TRACE("-- text=%s\n", debugstr_w(lpdi
->item
.pszText
));
1433 /* LVN_GETDISPINFOA - shouldn't happen */
1434 NMLVDISPINFOA
*lpdiA
= (NMLVDISPINFOA
*)lpnmh
;
1435 StrRetToStrNA( lpdiA
->item
.pszText
, lpdiA
->item
.cchTextMax
, &sd
.str
, NULL
);
1436 TRACE("-- text=%s\n", lpdiA
->item
.pszText
);
1440 if(lpdi
->item
.mask
& LVIF_IMAGE
) /* image requested */
1442 lpdi
->item
.iImage
= SHMapPIDLToSystemImageListIndex(This
->pSFParent
, pidl
, 0);
1446 case LVN_ITEMCHANGED
:
1447 TRACE("-- LVN_ITEMCHANGED %p\n",This
);
1448 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1452 case LVN_BEGINRDRAG
:
1453 TRACE("-- LVN_BEGINDRAG\n");
1455 if (ShellView_GetSelections(This
))
1458 DWORD dwAttributes
= SFGAO_CANLINK
;
1459 DWORD dwEffect
= DROPEFFECT_COPY
| DROPEFFECT_MOVE
;
1461 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,0,(LPVOID
*)&pda
)))
1463 IDropSource
*pds
= &This
->IDropSource_iface
; /* own DropSource interface */
1465 if (SUCCEEDED(IShellFolder_GetAttributesOf(This
->pSFParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &dwAttributes
)))
1467 if (dwAttributes
& SFGAO_CANLINK
)
1469 dwEffect
|= DROPEFFECT_LINK
;
1476 DoDragDrop(pda
, pds
, dwEffect
, &dwEffect2
);
1478 IDataObject_Release(pda
);
1483 case LVN_BEGINLABELEDITW
:
1485 DWORD dwAttr
= SFGAO_CANRENAME
;
1486 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1488 TRACE("-- LVN_BEGINLABELEDITW %p\n",This
);
1490 IShellFolder_GetAttributesOf(This
->pSFParent
, 1, (LPCITEMIDLIST
*)&pidl
, &dwAttr
);
1491 if (SFGAO_CANRENAME
& dwAttr
)
1498 case LVN_ENDLABELEDITW
:
1500 TRACE("-- LVN_ENDLABELEDITA %p\n",This
);
1501 if (lpdi
->item
.pszText
)
1506 lvItem
.iItem
= lpdi
->item
.iItem
;
1507 lvItem
.iSubItem
= 0;
1508 lvItem
.mask
= LVIF_PARAM
;
1509 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
1511 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1512 hr
= IShellFolder_SetNameOf(This
->pSFParent
, 0, pidl
, lpdi
->item
.pszText
, SHGDN_INFOLDER
, &pidl
);
1514 if(SUCCEEDED(hr
) && pidl
)
1516 lvItem
.mask
= LVIF_PARAM
;
1517 lvItem
.lParam
= (LPARAM
)pidl
;
1518 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
1527 LPNMLVKEYDOWN plvKeyDown
= (LPNMLVKEYDOWN
) lpnmh
;
1529 /* initiate a rename of the selected file or directory */
1530 switch (plvKeyDown
->wVKey
)
1534 INT i
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
1538 /* get selected item */
1539 i
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, MAKELPARAM (LVNI_SELECTED
, 0));
1541 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, i
, 0);
1542 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, i
, 0);
1551 LPITEMIDLIST
* pItems
;
1555 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_ISFHelper
, (void**)&psfhlp
);
1556 if (hr
!= S_OK
) return 0;
1558 if(!(count
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0)))
1560 ISFHelper_Release(psfhlp
);
1564 /* allocate memory for the pidl array */
1565 pItems
= HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST
) * count
);
1567 /* retrieve all selected items */
1573 /* get selected item */
1574 item_index
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, item_index
,
1575 MAKELPARAM (LVNI_SELECTED
, 0));
1576 item
.iItem
= item_index
;
1577 item
.mask
= LVIF_PARAM
;
1578 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
);
1581 pItems
[i
] = (LPITEMIDLIST
)item
.lParam
;
1586 /* perform the item deletion */
1587 ISFHelper_DeleteItems(psfhlp
, i
, (LPCITEMIDLIST
*)pItems
);
1588 ISFHelper_Release(psfhlp
);
1590 /* free pidl array memory */
1591 HeapFree(GetProcessHeap(), 0, pItems
);
1596 /* Initiate a refresh */
1597 IShellView3_Refresh(&This
->IShellView3_iface
);
1602 LPSHELLBROWSER lpSb
;
1603 if((lpSb
= (LPSHELLBROWSER
)SendMessageW(This
->hWndParent
, CWM_GETISHELLBROWSER
, 0, 0)))
1605 IShellBrowser_BrowseObject(lpSb
, NULL
, SBSP_PARENT
);
1611 FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown
->wVKey
);
1617 TRACE("-- %p WM_COMMAND %x unhandled\n", This
, lpnmh
->code
);
1623 /**********************************************************
1624 * ShellView_OnChange()
1627 static LRESULT
ShellView_OnChange(IShellViewImpl
* This
, const LPCITEMIDLIST
*pidls
, LONG event
)
1631 TRACE("(%p)->(%p, %p, 0x%08x)\n", This
, pidls
[0], pidls
[1], event
);
1637 LV_AddItem(This
, pidls
[0]);
1642 INT i
= LV_FindItemByPidl(This
, ILFindLastID(pidls
[0]));
1643 ret
= SendMessageW(This
->hWndList
, LVM_DELETEITEM
, i
, 0);
1646 case SHCNE_RENAMEFOLDER
:
1647 case SHCNE_RENAMEITEM
:
1648 LV_RenameItem(This
, pidls
[0], pidls
[1]);
1650 case SHCNE_UPDATEITEM
:
1655 /**********************************************************
1659 static LRESULT CALLBACK
ShellView_WndProc(HWND hWnd
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
1661 IShellViewImpl
* pThis
= (IShellViewImpl
*)GetWindowLongPtrW(hWnd
, GWLP_USERDATA
);
1662 LPCREATESTRUCTW lpcs
;
1664 TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd
, uMessage
, wParam
, lParam
);
1669 lpcs
= (LPCREATESTRUCTW
)lParam
;
1670 pThis
= lpcs
->lpCreateParams
;
1671 SetWindowLongPtrW(hWnd
, GWLP_USERDATA
, (ULONG_PTR
)pThis
);
1672 pThis
->hWnd
= hWnd
; /*set the window handle*/
1675 case WM_SIZE
: return ShellView_OnSize(pThis
,LOWORD(lParam
), HIWORD(lParam
));
1676 case WM_SETFOCUS
: return ShellView_OnSetFocus(pThis
);
1677 case WM_KILLFOCUS
: return ShellView_OnKillFocus(pThis
);
1678 case WM_CREATE
: return ShellView_OnCreate(pThis
);
1679 case WM_ACTIVATE
: return ShellView_OnActivate(pThis
, SVUIA_ACTIVATE_FOCUS
);
1680 case WM_NOTIFY
: return ShellView_OnNotify(pThis
,(UINT
)wParam
, (LPNMHDR
)lParam
);
1681 case WM_COMMAND
: return ShellView_OnCommand(pThis
,
1682 GET_WM_COMMAND_ID(wParam
, lParam
),
1683 GET_WM_COMMAND_CMD(wParam
, lParam
),
1684 GET_WM_COMMAND_HWND(wParam
, lParam
));
1685 case SHV_CHANGE_NOTIFY
: return ShellView_OnChange(pThis
, (const LPCITEMIDLIST
*)wParam
, (LONG
)lParam
);
1687 case WM_CONTEXTMENU
: ShellView_DoContextMenu(pThis
, LOWORD(lParam
), HIWORD(lParam
), FALSE
);
1690 case WM_SHOWWINDOW
: UpdateWindow(pThis
->hWndList
);
1693 case WM_GETDLGCODE
: return SendMessageW(pThis
->hWndList
, uMessage
, 0, 0);
1694 case WM_SETFONT
: return SendMessageW(pThis
->hWndList
, WM_SETFONT
, wParam
, lParam
);
1695 case WM_GETFONT
: return SendMessageW(pThis
->hWndList
, WM_GETFONT
, wParam
, lParam
);
1698 RevokeDragDrop(pThis
->hWnd
);
1699 SHChangeNotifyDeregister(pThis
->hNotify
);
1703 if ((pThis
->FolderSettings
.fFlags
& FWF_DESKTOP
) ||
1704 (pThis
->FolderSettings
.fFlags
& FWF_TRANSPARENT
))
1709 return DefWindowProcW(hWnd
, uMessage
, wParam
, lParam
);
1711 /**********************************************************
1714 * The INTERFACE of the IShellView object
1717 **********************************************************
1718 * IShellView_QueryInterface
1720 static HRESULT WINAPI
IShellView_fnQueryInterface(IShellView3
*iface
, REFIID riid
, void **ppvObj
)
1722 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1724 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppvObj
);
1728 if(IsEqualIID(riid
, &IID_IUnknown
) ||
1729 IsEqualIID(riid
, &IID_IShellView
) ||
1730 IsEqualIID(riid
, &IID_IShellView2
) ||
1731 IsEqualIID(riid
, &IID_IShellView3
))
1733 *ppvObj
= &This
->IShellView3_iface
;
1735 else if(IsEqualIID(riid
, &IID_IShellFolderView
))
1737 *ppvObj
= &This
->IShellFolderView_iface
;
1739 else if(IsEqualIID(riid
, &IID_IFolderView
) ||
1740 IsEqualIID(riid
, &IID_IFolderView2
))
1742 *ppvObj
= &This
->IFolderView2_iface
;
1744 else if(IsEqualIID(riid
, &IID_IOleCommandTarget
))
1746 *ppvObj
= &This
->IOleCommandTarget_iface
;
1748 else if(IsEqualIID(riid
, &IID_IDropTarget
))
1750 *ppvObj
= &This
->IDropTarget_iface
;
1752 else if(IsEqualIID(riid
, &IID_IDropSource
))
1754 *ppvObj
= &This
->IDropSource_iface
;
1756 else if(IsEqualIID(riid
, &IID_IViewObject
))
1758 *ppvObj
= &This
->IViewObject_iface
;
1763 IUnknown_AddRef( (IUnknown
*)*ppvObj
);
1764 TRACE("-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
1767 TRACE("-- Interface: E_NOINTERFACE\n");
1768 return E_NOINTERFACE
;
1771 /**********************************************************
1774 static ULONG WINAPI
IShellView_fnAddRef(IShellView3
*iface
)
1776 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1777 ULONG refCount
= InterlockedIncrement(&This
->ref
);
1779 TRACE("(%p)->(count=%u)\n", This
, refCount
- 1);
1783 /**********************************************************
1784 * IShellView_Release
1786 static ULONG WINAPI
IShellView_fnRelease(IShellView3
*iface
)
1788 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1789 ULONG refCount
= InterlockedDecrement(&This
->ref
);
1791 TRACE("(%p)->(count=%i)\n", This
, refCount
+ 1);
1795 TRACE(" destroying IShellView(%p)\n",This
);
1797 DestroyWindow(This
->hWndList
);
1800 IShellFolder_Release(This
->pSFParent
);
1802 if(This
->pSF2Parent
)
1803 IShellFolder2_Release(This
->pSF2Parent
);
1805 SHFree(This
->apidl
);
1808 IAdviseSink_Release(This
->pAdvSink
);
1810 HeapFree(GetProcessHeap(),0,This
);
1815 /**********************************************************
1816 * ShellView_GetWindow
1818 static HRESULT WINAPI
IShellView_fnGetWindow(IShellView3
*iface
, HWND
*phWnd
)
1820 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1822 TRACE("(%p)\n", This
);
1824 *phWnd
= This
->hWnd
;
1828 static HRESULT WINAPI
IShellView_fnContextSensitiveHelp(IShellView3
*iface
, BOOL mode
)
1830 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1831 TRACE("(%p)->(%d)\n", This
, mode
);
1835 /**********************************************************
1836 * IShellView_TranslateAccelerator
1839 * use the accel functions
1841 static HRESULT WINAPI
IShellView_fnTranslateAccelerator(IShellView3
*iface
, MSG
*lpmsg
)
1844 IShellViewImpl
*This
= (IShellViewImpl
*)iface
;
1846 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%x wp=%x) stub\n",This
,lpmsg
, lpmsg
->hwnd
, lpmsg
->message
, lpmsg
->lParam
, lpmsg
->wParam
);
1849 if ((lpmsg
->message
>=WM_KEYFIRST
) && (lpmsg
->message
>=WM_KEYLAST
))
1851 TRACE("-- key=0x04%lx\n",lpmsg
->wParam
) ;
1853 return S_FALSE
; /* not handled */
1856 static HRESULT WINAPI
IShellView_fnEnableModeless(IShellView3
*iface
, BOOL fEnable
)
1858 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1860 FIXME("(%p) stub\n", This
);
1865 static HRESULT WINAPI
IShellView_fnUIActivate(IShellView3
*iface
, UINT uState
)
1867 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1870 CHAR szName[MAX_PATH];
1873 int nPartArray
[1] = {-1};
1875 TRACE("(%p)->(state=%x) stub\n",This
, uState
);
1877 /*don't do anything if the state isn't really changing*/
1878 if(This
->uState
== uState
)
1883 /*OnActivate handles the menu merging and internal state*/
1884 ShellView_OnActivate(This
, uState
);
1886 /*only do This if we are active*/
1887 if(uState
!= SVUIA_DEACTIVATE
)
1891 GetFolderPath is not a method of IShellFolder
1892 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1894 /* set the number of parts */
1895 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_STATUS
, SB_SETPARTS
, 1,
1896 (LPARAM
)nPartArray
, &lResult
);
1898 /* set the text for the parts */
1900 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1901 0, (LPARAM)szName, &lResult);
1908 static HRESULT WINAPI
IShellView_fnRefresh(IShellView3
*iface
)
1910 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1912 TRACE("(%p)\n", This
);
1914 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
1915 ShellView_FillList(This
);
1920 static HRESULT WINAPI
IShellView_fnCreateViewWindow(IShellView3
*iface
, IShellView
*prev_view
,
1921 const FOLDERSETTINGS
*settings
, IShellBrowser
*owner
, RECT
*rect
, HWND
*hWnd
)
1923 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1924 TRACE("(%p)->(%p %p %p %p %p)\n", This
, prev_view
, settings
, owner
, rect
, hWnd
);
1925 return IShellView3_CreateViewWindow3(iface
, owner
, prev_view
, SV3CVW3_DEFAULT
,
1926 settings
->fFlags
, settings
->fFlags
, settings
->ViewMode
, NULL
, rect
, hWnd
);
1929 static HRESULT WINAPI
IShellView_fnDestroyViewWindow(IShellView3
*iface
)
1931 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1933 TRACE("(%p)\n", This
);
1938 /* Make absolutely sure all our UI is cleaned up. */
1939 IShellView3_UIActivate(iface
, SVUIA_DEACTIVATE
);
1942 DestroyMenu(This
->hMenu
);
1944 DestroyWindow(This
->hWnd
);
1945 if (This
->pShellBrowser
) IShellBrowser_Release(This
->pShellBrowser
);
1946 if (This
->pCommDlgBrowser
) ICommDlgBrowser_Release(This
->pCommDlgBrowser
);
1950 This
->pShellBrowser
= NULL
;
1951 This
->pCommDlgBrowser
= NULL
;
1956 static HRESULT WINAPI
IShellView_fnGetCurrentInfo(IShellView3
*iface
, LPFOLDERSETTINGS lpfs
)
1958 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1960 TRACE("(%p)->(%p) vmode=%x flags=%x\n", This
, lpfs
,
1961 This
->FolderSettings
.ViewMode
, This
->FolderSettings
.fFlags
);
1963 if (!lpfs
) return E_INVALIDARG
;
1964 *lpfs
= This
->FolderSettings
;
1968 static HRESULT WINAPI
IShellView_fnAddPropertySheetPages(IShellView3
*iface
, DWORD dwReserved
,
1969 LPFNADDPROPSHEETPAGE lpfn
, LPARAM lparam
)
1971 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1972 FIXME("(%p) stub\n", This
);
1976 static HRESULT WINAPI
IShellView_fnSaveViewState(IShellView3
*iface
)
1978 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1979 FIXME("(%p) stub\n", This
);
1983 static HRESULT WINAPI
IShellView_fnSelectItem(IShellView3
*iface
, LPCITEMIDLIST pidl
, UINT flags
)
1985 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1988 TRACE("(%p)->(pidl=%p, 0x%08x)\n",This
, pidl
, flags
);
1990 i
= LV_FindItemByPidl(This
, pidl
);
1991 if (i
== -1) return S_OK
;
1993 return IFolderView2_SelectItem(&This
->IFolderView2_iface
, i
, flags
);
1996 static HRESULT WINAPI
IShellView_fnGetItemObject(IShellView3
*iface
, UINT uItem
, REFIID riid
,
1999 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2000 HRESULT hr
= E_NOINTERFACE
;
2002 TRACE("(%p)->(0x%08x, %s, %p)\n",This
, uItem
, debugstr_guid(riid
), ppvOut
);
2008 case SVGIO_BACKGROUND
:
2010 if (IsEqualIID(&IID_IContextMenu
, riid
))
2011 return BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, riid
, ppvOut
);
2012 else if (IsEqualIID(&IID_IDispatch
, riid
)) {
2013 *ppvOut
= &This
->IShellFolderViewDual3_iface
;
2014 IShellFolderViewDual3_AddRef(&This
->IShellFolderViewDual3_iface
);
2018 FIXME("unsupported interface requested %s\n", debugstr_guid(riid
));
2022 case SVGIO_SELECTION
:
2023 ShellView_GetSelections(This
);
2024 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, riid
, 0, ppvOut
);
2028 FIXME("unimplemented for uItem = 0x%08x\n", uItem
);
2030 TRACE("-- (%p)->(interface=%p)\n",This
, *ppvOut
);
2035 static HRESULT WINAPI
IShellView2_fnGetView(IShellView3
*iface
, SHELLVIEWID
*view_guid
, ULONG view_type
)
2037 FIXME("(%p)->(%s, %#x) stub!\n", iface
, debugstr_guid(view_guid
), view_type
);
2041 static HRESULT WINAPI
IShellView2_fnCreateViewWindow2(IShellView3
*iface
, SV2CVW2_PARAMS
*view_params
)
2043 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2044 TRACE("(%p)->(%p)\n", This
, view_params
);
2045 return IShellView3_CreateViewWindow3(iface
, view_params
->psbOwner
, view_params
->psvPrev
,
2046 SV3CVW3_DEFAULT
, view_params
->pfs
->fFlags
, view_params
->pfs
->fFlags
,
2047 view_params
->pfs
->ViewMode
, view_params
->pvid
, view_params
->prcView
, &view_params
->hwndView
);
2050 static HRESULT WINAPI
IShellView2_fnHandleRename(IShellView3
*iface
, LPCITEMIDLIST new_pidl
)
2052 FIXME("(%p)->(new_pidl %p) stub!\n", iface
, new_pidl
);
2056 static HRESULT WINAPI
IShellView2_fnSelectAndPositionItem(IShellView3
*iface
, LPCITEMIDLIST item
,
2057 UINT flags
, POINT
*point
)
2059 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2060 TRACE("(%p)->(item %p, flags %#x, point %p)\n", This
, item
, flags
, point
);
2061 return IFolderView2_SelectAndPositionItems(&This
->IFolderView2_iface
, 1, &item
, point
, flags
);
2064 static HRESULT WINAPI
IShellView3_fnCreateViewWindow3(IShellView3
*iface
, IShellBrowser
*owner
,
2065 IShellView
*prev_view
, SV3CVW3_FLAGS view_flags
, FOLDERFLAGS mask
, FOLDERFLAGS flags
,
2066 FOLDERVIEWMODE mode
, const SHELLVIEWID
*view_id
, const RECT
*rect
, HWND
*hwnd
)
2068 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2069 INITCOMMONCONTROLSEX icex
;
2074 TRACE("(%p)->(%p %p 0x%08x 0x%08x 0x%08x %d %s %s %p)\n", This
, owner
, prev_view
, view_flags
,
2075 mask
, flags
, mode
, debugstr_guid(view_id
), wine_dbgstr_rect(rect
), hwnd
);
2077 icex
.dwSize
= sizeof(icex
);
2078 icex
.dwICC
= ICC_LISTVIEW_CLASSES
;
2079 InitCommonControlsEx(&icex
);
2083 if (!owner
|| This
->hWnd
)
2084 return E_UNEXPECTED
;
2086 if (view_flags
!= SV3CVW3_DEFAULT
)
2087 FIXME("unsupported view flags 0x%08x\n", view_flags
);
2089 /* Set up the member variables */
2090 This
->pShellBrowser
= owner
;
2091 This
->FolderSettings
.ViewMode
= mode
;
2092 This
->FolderSettings
.fFlags
= mask
& flags
;
2096 if (IsEqualGUID(view_id
, &VID_LargeIcons
))
2097 This
->FolderSettings
.ViewMode
= FVM_ICON
;
2098 else if (IsEqualGUID(view_id
, &VID_SmallIcons
))
2099 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
2100 else if (IsEqualGUID(view_id
, &VID_List
))
2101 This
->FolderSettings
.ViewMode
= FVM_LIST
;
2102 else if (IsEqualGUID(view_id
, &VID_Details
))
2103 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
2104 else if (IsEqualGUID(view_id
, &VID_Thumbnails
))
2105 This
->FolderSettings
.ViewMode
= FVM_THUMBNAIL
;
2106 else if (IsEqualGUID(view_id
, &VID_Tile
))
2107 This
->FolderSettings
.ViewMode
= FVM_TILE
;
2108 else if (IsEqualGUID(view_id
, &VID_ThumbStrip
))
2109 This
->FolderSettings
.ViewMode
= FVM_THUMBSTRIP
;
2111 FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id
));
2114 /* Get our parent window */
2115 IShellBrowser_AddRef(This
->pShellBrowser
);
2116 IShellBrowser_GetWindow(This
->pShellBrowser
, &This
->hWndParent
);
2118 /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2119 This
->pCommDlgBrowser
= NULL
;
2120 hr
= IShellBrowser_QueryInterface(This
->pShellBrowser
, &IID_ICommDlgBrowser
, (void **)&This
->pCommDlgBrowser
);
2122 TRACE("-- CommDlgBrowser %p\n", This
->pCommDlgBrowser
);
2124 /* If our window class has not been registered, then do so */
2125 if (!GetClassInfoW(shell32_hInstance
, SV_CLASS_NAME
, &wc
))
2127 wc
.style
= CS_HREDRAW
| CS_VREDRAW
;
2128 wc
.lpfnWndProc
= ShellView_WndProc
;
2131 wc
.hInstance
= shell32_hInstance
;
2133 wc
.hCursor
= LoadCursorW(0, (LPWSTR
)IDC_ARROW
);
2134 wc
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
2135 wc
.lpszMenuName
= NULL
;
2136 wc
.lpszClassName
= SV_CLASS_NAME
;
2138 if (!RegisterClassW(&wc
)) return E_FAIL
;
2141 wnd
= CreateWindowExW(0, SV_CLASS_NAME
, NULL
, WS_CHILD
| WS_TABSTOP
,
2142 rect
->left
, rect
->top
,
2143 rect
->right
- rect
->left
,
2144 rect
->bottom
- rect
->top
,
2145 This
->hWndParent
, 0, shell32_hInstance
, This
);
2151 IShellBrowser_Release(This
->pShellBrowser
);
2155 SetWindowPos(wnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
| SWP_SHOWWINDOW
);
2163 static const IShellView3Vtbl shellviewvtbl
=
2165 IShellView_fnQueryInterface
,
2166 IShellView_fnAddRef
,
2167 IShellView_fnRelease
,
2168 IShellView_fnGetWindow
,
2169 IShellView_fnContextSensitiveHelp
,
2170 IShellView_fnTranslateAccelerator
,
2171 IShellView_fnEnableModeless
,
2172 IShellView_fnUIActivate
,
2173 IShellView_fnRefresh
,
2174 IShellView_fnCreateViewWindow
,
2175 IShellView_fnDestroyViewWindow
,
2176 IShellView_fnGetCurrentInfo
,
2177 IShellView_fnAddPropertySheetPages
,
2178 IShellView_fnSaveViewState
,
2179 IShellView_fnSelectItem
,
2180 IShellView_fnGetItemObject
,
2181 IShellView2_fnGetView
,
2182 IShellView2_fnCreateViewWindow2
,
2183 IShellView2_fnHandleRename
,
2184 IShellView2_fnSelectAndPositionItem
,
2185 IShellView3_fnCreateViewWindow3
2189 /**********************************************************
2190 * ISVOleCmdTarget_QueryInterface (IUnknown)
2192 static HRESULT WINAPI
ISVOleCmdTarget_QueryInterface(IOleCommandTarget
*iface
, REFIID iid
, void **ppvObj
)
2194 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2195 return IShellView3_QueryInterface(&This
->IShellView3_iface
, iid
, ppvObj
);
2198 /**********************************************************
2199 * ISVOleCmdTarget_AddRef (IUnknown)
2201 static ULONG WINAPI
ISVOleCmdTarget_AddRef(IOleCommandTarget
*iface
)
2203 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2204 return IShellView3_AddRef(&This
->IShellView3_iface
);
2207 /**********************************************************
2208 * ISVOleCmdTarget_Release (IUnknown)
2210 static ULONG WINAPI
ISVOleCmdTarget_Release(IOleCommandTarget
*iface
)
2212 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2213 return IShellView3_Release(&This
->IShellView3_iface
);
2216 /**********************************************************
2217 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2219 static HRESULT WINAPI
ISVOleCmdTarget_QueryStatus(
2220 IOleCommandTarget
*iface
,
2221 const GUID
*pguidCmdGroup
,
2224 OLECMDTEXT
*pCmdText
)
2226 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2229 FIXME("(%p)->(%s %d %p %p)\n",
2230 This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
, pCmdText
);
2233 return E_INVALIDARG
;
2234 for (i
= 0; i
< cCmds
; i
++)
2236 FIXME("\tprgCmds[%d].cmdID = %d\n", i
, prgCmds
[i
].cmdID
);
2237 prgCmds
[i
].cmdf
= 0;
2239 return OLECMDERR_E_UNKNOWNGROUP
;
2242 /**********************************************************
2243 * ISVOleCmdTarget_Exec (IOleCommandTarget)
2245 * nCmdID is the OLECMDID_* enumeration
2247 static HRESULT WINAPI
ISVOleCmdTarget_Exec(
2248 IOleCommandTarget
*iface
,
2249 const GUID
* pguidCmdGroup
,
2255 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2257 FIXME("(%p)->(%s %d 0x%08x %s %p)\n",
2258 This
, debugstr_guid(pguidCmdGroup
), nCmdID
, nCmdexecopt
, debugstr_variant(pvaIn
), pvaOut
);
2261 return OLECMDERR_E_UNKNOWNGROUP
;
2263 if (IsEqualIID(pguidCmdGroup
, &CGID_Explorer
) &&
2264 (nCmdID
== OLECMDID_SHOWMESSAGE
) &&
2265 (nCmdexecopt
== 4) && pvaOut
)
2267 if (IsEqualIID(pguidCmdGroup
, &CGID_ShellDocView
) &&
2268 (nCmdID
== OLECMDID_SPELL
) &&
2269 (nCmdexecopt
== OLECMDEXECOPT_DODEFAULT
))
2272 return OLECMDERR_E_UNKNOWNGROUP
;
2275 static const IOleCommandTargetVtbl olecommandtargetvtbl
=
2277 ISVOleCmdTarget_QueryInterface
,
2278 ISVOleCmdTarget_AddRef
,
2279 ISVOleCmdTarget_Release
,
2280 ISVOleCmdTarget_QueryStatus
,
2281 ISVOleCmdTarget_Exec
2284 /**********************************************************
2285 * ISVDropTarget implementation
2288 static HRESULT WINAPI
ISVDropTarget_QueryInterface(IDropTarget
*iface
, REFIID riid
, void **ppvObj
)
2290 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2291 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2294 static ULONG WINAPI
ISVDropTarget_AddRef(IDropTarget
*iface
)
2296 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2297 return IShellView3_AddRef(&This
->IShellView3_iface
);
2300 static ULONG WINAPI
ISVDropTarget_Release(IDropTarget
*iface
)
2302 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2303 return IShellView3_Release(&This
->IShellView3_iface
);
2306 /******************************************************************************
2307 * drag_notify_subitem [Internal]
2309 * Figure out the shellfolder object, which is currently under the mouse cursor
2310 * and notify it via the IDropTarget interface.
2313 #define SCROLLAREAWIDTH 20
2315 static HRESULT
drag_notify_subitem(IShellViewImpl
*This
, DWORD grfKeyState
, POINTL pt
,
2318 LVHITTESTINFO htinfo
;
2324 /* Map from global to client coordinates and query the index of the listview-item, which is
2325 * currently under the mouse cursor. */
2328 htinfo
.flags
= LVHT_ONITEM
;
2329 ScreenToClient(This
->hWndList
, &htinfo
.pt
);
2330 lResult
= SendMessageW(This
->hWndList
, LVM_HITTEST
, 0, (LPARAM
)&htinfo
);
2332 /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
2333 GetClientRect(This
->hWndList
, &clientRect
);
2334 if (htinfo
.pt
.x
== This
->ptLastMousePos
.x
&& htinfo
.pt
.y
== This
->ptLastMousePos
.y
&&
2335 (htinfo
.pt
.x
< SCROLLAREAWIDTH
|| htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
||
2336 htinfo
.pt
.y
< SCROLLAREAWIDTH
|| htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
))
2338 This
->cScrollDelay
= (This
->cScrollDelay
+ 1) % 5; /* DragOver is called every 50 ms */
2339 if (This
->cScrollDelay
== 0) { /* Mouse did hover another 250 ms over the scroll-area */
2340 if (htinfo
.pt
.x
< SCROLLAREAWIDTH
)
2341 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEUP
, 0);
2342 if (htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
)
2343 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEDOWN
, 0);
2344 if (htinfo
.pt
.y
< SCROLLAREAWIDTH
)
2345 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEUP
, 0);
2346 if (htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
)
2347 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEDOWN
, 0);
2350 This
->cScrollDelay
= 0; /* Reset, if the cursor is not over the listview's scroll-area */
2352 This
->ptLastMousePos
= htinfo
.pt
;
2354 /* If we are still over the previous sub-item, notify it via DragOver and return. */
2355 if (This
->pCurDropTarget
&& lResult
== This
->iDragOverItem
)
2356 return IDropTarget_DragOver(This
->pCurDropTarget
, grfKeyState
, pt
, pdwEffect
);
2358 /* We've left the previous sub-item, notify it via DragLeave and Release it. */
2359 if (This
->pCurDropTarget
) {
2360 IDropTarget_DragLeave(This
->pCurDropTarget
);
2361 IDropTarget_Release(This
->pCurDropTarget
);
2362 This
->pCurDropTarget
= NULL
;
2365 This
->iDragOverItem
= lResult
;
2366 if (lResult
== -1) {
2367 /* We are not above one of the listview's subitems. Bind to the parent folder's
2368 * DropTarget interface. */
2369 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IDropTarget
,
2370 (LPVOID
*)&This
->pCurDropTarget
);
2372 /* Query the relative PIDL of the shellfolder object represented by the currently
2373 * dragged over listview-item ... */
2374 lvItem
.mask
= LVIF_PARAM
;
2375 lvItem
.iItem
= lResult
;
2376 lvItem
.iSubItem
= 0;
2377 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
2379 /* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */
2380 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWndList
, 1,
2381 (LPCITEMIDLIST
*)&lvItem
.lParam
, &IID_IDropTarget
, NULL
, (LPVOID
*)&This
->pCurDropTarget
);
2384 /* If anything failed, pCurDropTarget should be NULL now, which ought to be a save state. */
2388 /* Notify the item just entered via DragEnter. */
2389 return IDropTarget_DragEnter(This
->pCurDropTarget
, This
->pCurDataObject
, grfKeyState
, pt
, pdwEffect
);
2392 static HRESULT WINAPI
ISVDropTarget_DragEnter(IDropTarget
*iface
, IDataObject
*pDataObject
,
2393 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2395 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2397 /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
2398 This
->pCurDataObject
= pDataObject
;
2399 IDataObject_AddRef(pDataObject
);
2401 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2404 static HRESULT WINAPI
ISVDropTarget_DragOver(IDropTarget
*iface
, DWORD grfKeyState
, POINTL pt
,
2407 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2408 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2411 static HRESULT WINAPI
ISVDropTarget_DragLeave(IDropTarget
*iface
)
2413 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2415 if (This
->pCurDropTarget
)
2417 IDropTarget_DragLeave(This
->pCurDropTarget
);
2418 IDropTarget_Release(This
->pCurDropTarget
);
2419 This
->pCurDropTarget
= NULL
;
2422 if (This
->pCurDataObject
)
2424 IDataObject_Release(This
->pCurDataObject
);
2425 This
->pCurDataObject
= NULL
;
2428 This
->iDragOverItem
= 0;
2433 static HRESULT WINAPI
ISVDropTarget_Drop(IDropTarget
*iface
, IDataObject
* pDataObject
,
2434 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2436 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2438 if (!This
->pCurDropTarget
) return DRAGDROP_E_INVALIDHWND
;
2440 IDropTarget_Drop(This
->pCurDropTarget
, pDataObject
, grfKeyState
, pt
, pdwEffect
);
2442 IDropTarget_Release(This
->pCurDropTarget
);
2443 IDataObject_Release(This
->pCurDataObject
);
2444 This
->pCurDataObject
= NULL
;
2445 This
->pCurDropTarget
= NULL
;
2446 This
->iDragOverItem
= 0;
2451 static const IDropTargetVtbl droptargetvtbl
=
2453 ISVDropTarget_QueryInterface
,
2454 ISVDropTarget_AddRef
,
2455 ISVDropTarget_Release
,
2456 ISVDropTarget_DragEnter
,
2457 ISVDropTarget_DragOver
,
2458 ISVDropTarget_DragLeave
,
2462 /**********************************************************
2463 * ISVDropSource implementation
2466 static HRESULT WINAPI
ISVDropSource_QueryInterface(IDropSource
*iface
, REFIID riid
, void **ppvObj
)
2468 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2469 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2472 static ULONG WINAPI
ISVDropSource_AddRef(IDropSource
*iface
)
2474 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2475 return IShellView3_AddRef(&This
->IShellView3_iface
);
2478 static ULONG WINAPI
ISVDropSource_Release(IDropSource
*iface
)
2480 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2481 return IShellView3_Release(&This
->IShellView3_iface
);
2484 static HRESULT WINAPI
ISVDropSource_QueryContinueDrag(
2486 BOOL fEscapePressed
,
2489 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2490 TRACE("(%p)\n",This
);
2493 return DRAGDROP_S_CANCEL
;
2494 else if (!(grfKeyState
& MK_LBUTTON
) && !(grfKeyState
& MK_RBUTTON
))
2495 return DRAGDROP_S_DROP
;
2500 static HRESULT WINAPI
ISVDropSource_GiveFeedback(
2504 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2505 TRACE("(%p)\n",This
);
2507 return DRAGDROP_S_USEDEFAULTCURSORS
;
2510 static const IDropSourceVtbl dropsourcevtbl
=
2512 ISVDropSource_QueryInterface
,
2513 ISVDropSource_AddRef
,
2514 ISVDropSource_Release
,
2515 ISVDropSource_QueryContinueDrag
,
2516 ISVDropSource_GiveFeedback
2518 /**********************************************************
2519 * ISVViewObject implementation
2522 static HRESULT WINAPI
ISVViewObject_QueryInterface(IViewObject
*iface
, REFIID riid
, void **ppvObj
)
2524 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2525 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2528 static ULONG WINAPI
ISVViewObject_AddRef(IViewObject
*iface
)
2530 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2531 return IShellView3_AddRef(&This
->IShellView3_iface
);
2534 static ULONG WINAPI
ISVViewObject_Release(IViewObject
*iface
)
2536 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2537 return IShellView3_Release(&This
->IShellView3_iface
);
2540 static HRESULT WINAPI
ISVViewObject_Draw(
2545 DVTARGETDEVICE
* ptd
,
2548 LPCRECTL lprcBounds
,
2549 LPCRECTL lprcWBounds
,
2550 BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
),
2551 ULONG_PTR dwContinue
)
2554 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2556 FIXME("Stub: This=%p\n",This
);
2560 static HRESULT WINAPI
ISVViewObject_GetColorSet(
2565 DVTARGETDEVICE
* ptd
,
2566 HDC hicTargetDevice
,
2567 LOGPALETTE
** ppColorSet
)
2570 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2572 FIXME("Stub: This=%p\n",This
);
2576 static HRESULT WINAPI
ISVViewObject_Freeze(
2584 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2586 FIXME("Stub: This=%p\n",This
);
2590 static HRESULT WINAPI
ISVViewObject_Unfreeze(
2595 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2597 FIXME("Stub: This=%p\n",This
);
2601 static HRESULT WINAPI
ISVViewObject_SetAdvise(
2605 IAdviseSink
* pAdvSink
)
2608 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2610 FIXME("partial stub: %p %08x %08x %p\n",
2611 This
, aspects
, advf
, pAdvSink
);
2613 /* FIXME: we set the AdviseSink, but never use it to send any advice */
2614 This
->pAdvSink
= pAdvSink
;
2615 This
->dwAspects
= aspects
;
2616 This
->dwAdvf
= advf
;
2621 static HRESULT WINAPI
ISVViewObject_GetAdvise(
2625 IAdviseSink
** ppAdvSink
)
2628 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2630 TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
2631 This
, pAspects
, pAdvf
, ppAdvSink
);
2635 IAdviseSink_AddRef( This
->pAdvSink
);
2636 *ppAdvSink
= This
->pAdvSink
;
2639 *pAspects
= This
->dwAspects
;
2641 *pAdvf
= This
->dwAdvf
;
2647 static const IViewObjectVtbl viewobjectvtbl
=
2649 ISVViewObject_QueryInterface
,
2650 ISVViewObject_AddRef
,
2651 ISVViewObject_Release
,
2653 ISVViewObject_GetColorSet
,
2654 ISVViewObject_Freeze
,
2655 ISVViewObject_Unfreeze
,
2656 ISVViewObject_SetAdvise
,
2657 ISVViewObject_GetAdvise
2661 static HRESULT WINAPI
FolderView_QueryInterface(IFolderView2
*iface
, REFIID riid
, void **ppvObj
)
2663 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2664 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2667 static ULONG WINAPI
FolderView_AddRef(IFolderView2
*iface
)
2669 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2670 return IShellView3_AddRef(&This
->IShellView3_iface
);
2673 static ULONG WINAPI
FolderView_Release(IFolderView2
*iface
)
2675 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2676 return IShellView3_Release(&This
->IShellView3_iface
);
2679 static HRESULT WINAPI
FolderView_GetCurrentViewMode(IFolderView2
*iface
, UINT
*mode
)
2681 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2682 TRACE("(%p)->(%p), stub\n", This
, mode
);
2685 return E_INVALIDARG
;
2687 *mode
= This
->FolderSettings
.ViewMode
;
2691 static HRESULT WINAPI
FolderView_SetCurrentViewMode(IFolderView2
*iface
, UINT mode
)
2693 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2695 TRACE("(%p)->(%u), stub\n", This
, mode
);
2697 if((mode
< FVM_FIRST
|| mode
> FVM_LAST
) &&
2699 return E_INVALIDARG
;
2701 /* Windows before Vista uses LVM_SETVIEW and possibly
2702 LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2703 while later versions seem to accomplish this through other
2705 dwStyle
= ViewModeToListStyle(mode
);
2706 SetStyle(This
, dwStyle
, LVS_TYPEMASK
);
2708 /* This will not necessarily be the actual mode set above.
2709 This mimics the behavior of Windows XP. */
2710 This
->FolderSettings
.ViewMode
= mode
;
2715 static HRESULT WINAPI
FolderView_GetFolder(IFolderView2
*iface
, REFIID riid
, void **ppv
)
2717 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2719 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppv
);
2721 return IShellFolder_QueryInterface(This
->pSFParent
, riid
, ppv
);
2724 static HRESULT WINAPI
FolderView_Item(IFolderView2
*iface
, int index
, PITEMID_CHILD
*ppidl
)
2726 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2729 TRACE("(%p)->(%d %p)\n", This
, index
, ppidl
);
2731 item
.mask
= LVIF_PARAM
;
2734 if (SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
))
2736 *ppidl
= ILClone((PITEMID_CHILD
)item
.lParam
);
2742 return E_INVALIDARG
;
2746 static HRESULT WINAPI
FolderView_ItemCount(IFolderView2
*iface
, UINT flags
, int *items
)
2748 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2750 TRACE("(%p)->(%u %p)\n", This
, flags
, items
);
2752 if (flags
!= SVGIO_ALLVIEW
)
2753 FIXME("some flags unsupported, %x\n", flags
& ~SVGIO_ALLVIEW
);
2755 *items
= SendMessageW(This
->hWndList
, LVM_GETITEMCOUNT
, 0, 0);
2760 static HRESULT WINAPI
FolderView_Items(IFolderView2
*iface
, UINT flags
, REFIID riid
, void **ppv
)
2762 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2763 FIXME("(%p)->(%u %s %p), stub\n", This
, flags
, debugstr_guid(riid
), ppv
);
2767 static HRESULT WINAPI
FolderView_GetSelectionMarkedItem(IFolderView2
*iface
, int *item
)
2769 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2771 TRACE("(%p)->(%p)\n", This
, item
);
2773 *item
= SendMessageW(This
->hWndList
, LVM_GETSELECTIONMARK
, 0, 0);
2778 static HRESULT WINAPI
FolderView_GetFocusedItem(IFolderView2
*iface
, int *item
)
2780 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2782 TRACE("(%p)->(%p)\n", This
, item
);
2784 *item
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, LVNI_FOCUSED
);
2789 static HRESULT WINAPI
FolderView_GetItemPosition(IFolderView2
*iface
, PCUITEMID_CHILD pidl
, POINT
*ppt
)
2791 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2792 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, ppt
);
2796 static HRESULT WINAPI
FolderView_GetSpacing(IFolderView2
*iface
, POINT
*pt
)
2798 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2800 TRACE("(%p)->(%p)\n", This
, pt
);
2802 if (!This
->hWndList
) return S_FALSE
;
2807 ret
= SendMessageW(This
->hWndList
, LVM_GETITEMSPACING
, 0, 0);
2809 pt
->x
= LOWORD(ret
);
2810 pt
->y
= HIWORD(ret
);
2816 static HRESULT WINAPI
FolderView_GetDefaultSpacing(IFolderView2
*iface
, POINT
*pt
)
2818 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2819 FIXME("(%p)->(%p), stub\n", This
, pt
);
2823 static HRESULT WINAPI
FolderView_GetAutoArrange(IFolderView2
*iface
)
2825 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2826 FIXME("(%p), stub\n", This
);
2830 static HRESULT WINAPI
FolderView_SelectItem(IFolderView2
*iface
, int item
, DWORD flags
)
2832 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2835 TRACE("(%p)->(%d, %x)\n", This
, item
, flags
);
2838 lvItem
.stateMask
= LVIS_SELECTED
;
2840 if (flags
& SVSI_ENSUREVISIBLE
)
2841 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, item
, 0);
2844 if (flags
& SVSI_DESELECTOTHERS
)
2845 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, -1, (LPARAM
)&lvItem
);
2848 if (flags
& SVSI_SELECT
)
2849 lvItem
.state
|= LVIS_SELECTED
;
2851 if (flags
& SVSI_FOCUSED
)
2852 lvItem
.stateMask
|= LVIS_FOCUSED
;
2854 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, item
, (LPARAM
)&lvItem
);
2856 if (flags
& SVSI_EDIT
)
2857 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, item
, 0);
2862 static HRESULT WINAPI
FolderView_SelectAndPositionItems(IFolderView2
*iface
, UINT cidl
,
2863 PCUITEMID_CHILD_ARRAY apidl
, POINT
*apt
, DWORD flags
)
2865 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2866 FIXME("(%p)->(%u %p %p %x), stub\n", This
, cidl
, apidl
, apt
, flags
);
2870 static HRESULT WINAPI
FolderView2_SetGroupBy(IFolderView2
*iface
, REFPROPERTYKEY key
, BOOL ascending
)
2872 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2873 FIXME("(%p)->(%p %d), stub\n", This
, key
, ascending
);
2877 static HRESULT WINAPI
FolderView2_GetGroupBy(IFolderView2
*iface
, PROPERTYKEY
*pkey
, BOOL
*ascending
)
2879 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2880 FIXME("(%p)->(%p %p), stub\n", This
, pkey
, ascending
);
2884 static HRESULT WINAPI
FolderView2_SetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2885 REFPROPERTYKEY propkey
, REFPROPVARIANT propvar
)
2887 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2888 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2892 static HRESULT WINAPI
FolderView2_GetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2893 REFPROPERTYKEY propkey
, PROPVARIANT
*propvar
)
2895 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2896 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2900 static HRESULT WINAPI
FolderView2_SetTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2903 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2904 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2908 static HRESULT WINAPI
FolderView2_SetExtendedTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2911 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2912 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2916 static HRESULT WINAPI
FolderView2_SetText(IFolderView2
*iface
, FVTEXTTYPE type
, LPCWSTR text
)
2918 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2919 FIXME("(%p)->(%d %s), stub\n", This
, type
, debugstr_w(text
));
2923 static HRESULT WINAPI
FolderView2_SetCurrentFolderFlags(IFolderView2
*iface
, DWORD mask
, DWORD flags
)
2925 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2926 FIXME("(%p)->(0x%08x 0x%08x), stub\n", This
, mask
, flags
);
2930 static HRESULT WINAPI
FolderView2_GetCurrentFolderFlags(IFolderView2
*iface
, DWORD
*flags
)
2932 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2933 FIXME("(%p)->(%p), stub\n", This
, flags
);
2937 static HRESULT WINAPI
FolderView2_GetSortColumnCount(IFolderView2
*iface
, int *columns
)
2939 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2940 FIXME("(%p)->(%p), stub\n", This
, columns
);
2944 static HRESULT WINAPI
FolderView2_SetSortColumns(IFolderView2
*iface
, const SORTCOLUMN
*columns
,
2947 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2948 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2952 static HRESULT WINAPI
FolderView2_GetSortColumns(IFolderView2
*iface
, SORTCOLUMN
*columns
,
2955 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2956 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2960 static HRESULT WINAPI
FolderView2_GetItem(IFolderView2
*iface
, int item
, REFIID riid
, void **ppv
)
2962 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2963 FIXME("(%p)->(%d %s %p), stub\n", This
, item
, debugstr_guid(riid
), ppv
);
2967 static HRESULT WINAPI
FolderView2_GetVisibleItem(IFolderView2
*iface
, int start
, BOOL previous
,
2970 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2971 FIXME("(%p)->(%d %d %p), stub\n", This
, start
, previous
, item
);
2975 static HRESULT WINAPI
FolderView2_GetSelectedItem(IFolderView2
*iface
, int start
, int *item
)
2977 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2978 FIXME("(%p)->(%d %p), stub\n", This
, start
, item
);
2982 static HRESULT WINAPI
FolderView2_GetSelection(IFolderView2
*iface
, BOOL none_implies_folder
,
2983 IShellItemArray
**array
)
2985 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2986 FIXME("(%p)->(%d %p), stub\n", This
, none_implies_folder
, array
);
2990 static HRESULT WINAPI
FolderView2_GetSelectionState(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2993 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2994 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, flags
);
2998 static HRESULT WINAPI
FolderView2_InvokeVerbOnSelection(IFolderView2
*iface
, LPCSTR verb
)
3000 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3001 FIXME("(%p)->(%s), stub\n", This
, debugstr_a(verb
));
3005 static HRESULT WINAPI
FolderView2_SetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE mode
,
3008 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3009 FIXME("(%p)->(%d %d), stub\n", This
, mode
, size
);
3013 static HRESULT WINAPI
FolderView2_GetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE
*mode
,
3016 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3017 FIXME("(%p)->(%p %p), stub\n", This
, mode
, size
);
3021 static HRESULT WINAPI
FolderView2_SetGroupSubsetCount(IFolderView2
*iface
, UINT visible_rows
)
3023 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3024 FIXME("(%p)->(%u), stub\n", This
, visible_rows
);
3028 static HRESULT WINAPI
FolderView2_GetGroupSubsetCount(IFolderView2
*iface
, UINT
*visible_rows
)
3030 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3031 FIXME("(%p)->(%p), stub\n", This
, visible_rows
);
3035 static HRESULT WINAPI
FolderView2_SetRedraw(IFolderView2
*iface
, BOOL redraw
)
3037 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3038 TRACE("(%p)->(%d)\n", This
, redraw
);
3039 SendMessageW(This
->hWndList
, WM_SETREDRAW
, redraw
, 0);
3043 static HRESULT WINAPI
FolderView2_IsMoveInSameFolder(IFolderView2
*iface
)
3045 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3046 FIXME("(%p), stub\n", This
);
3050 static HRESULT WINAPI
FolderView2_DoRename(IFolderView2
*iface
)
3052 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3053 FIXME("(%p), stub\n", This
);
3057 static const IFolderView2Vtbl folderviewvtbl
=
3059 FolderView_QueryInterface
,
3062 FolderView_GetCurrentViewMode
,
3063 FolderView_SetCurrentViewMode
,
3064 FolderView_GetFolder
,
3066 FolderView_ItemCount
,
3068 FolderView_GetSelectionMarkedItem
,
3069 FolderView_GetFocusedItem
,
3070 FolderView_GetItemPosition
,
3071 FolderView_GetSpacing
,
3072 FolderView_GetDefaultSpacing
,
3073 FolderView_GetAutoArrange
,
3074 FolderView_SelectItem
,
3075 FolderView_SelectAndPositionItems
,
3076 FolderView2_SetGroupBy
,
3077 FolderView2_GetGroupBy
,
3078 FolderView2_SetViewProperty
,
3079 FolderView2_GetViewProperty
,
3080 FolderView2_SetTileViewProperties
,
3081 FolderView2_SetExtendedTileViewProperties
,
3082 FolderView2_SetText
,
3083 FolderView2_SetCurrentFolderFlags
,
3084 FolderView2_GetCurrentFolderFlags
,
3085 FolderView2_GetSortColumnCount
,
3086 FolderView2_SetSortColumns
,
3087 FolderView2_GetSortColumns
,
3088 FolderView2_GetItem
,
3089 FolderView2_GetVisibleItem
,
3090 FolderView2_GetSelectedItem
,
3091 FolderView2_GetSelection
,
3092 FolderView2_GetSelectionState
,
3093 FolderView2_InvokeVerbOnSelection
,
3094 FolderView2_SetViewModeAndIconSize
,
3095 FolderView2_GetViewModeAndIconSize
,
3096 FolderView2_SetGroupSubsetCount
,
3097 FolderView2_GetGroupSubsetCount
,
3098 FolderView2_SetRedraw
,
3099 FolderView2_IsMoveInSameFolder
,
3100 FolderView2_DoRename
3103 /* IShellFolderView */
3104 static HRESULT WINAPI
IShellFolderView_fnQueryInterface(IShellFolderView
*iface
, REFIID riid
, void **ppvObj
)
3106 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3107 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
3110 static ULONG WINAPI
IShellFolderView_fnAddRef(IShellFolderView
*iface
)
3112 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3113 return IShellView3_AddRef(&This
->IShellView3_iface
);
3116 static ULONG WINAPI
IShellFolderView_fnRelease(IShellFolderView
*iface
)
3118 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3119 return IShellView3_Release(&This
->IShellView3_iface
);
3122 static HRESULT WINAPI
IShellFolderView_fnRearrange(IShellFolderView
*iface
, LPARAM sort
)
3124 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3125 FIXME("(%p)->(%ld) stub\n", This
, sort
);
3129 static HRESULT WINAPI
IShellFolderView_fnGetArrangeParam(IShellFolderView
*iface
, LPARAM
*sort
)
3131 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3132 FIXME("(%p)->(%p) stub\n", This
, sort
);
3136 static HRESULT WINAPI
IShellFolderView_fnArrangeGrid(IShellFolderView
*iface
)
3138 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3139 FIXME("(%p) stub\n", This
);
3143 static HRESULT WINAPI
IShellFolderView_fnAutoArrange(IShellFolderView
*iface
)
3145 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3146 TRACE("(%p)\n", This
);
3147 return IFolderView2_SetCurrentFolderFlags(&This
->IFolderView2_iface
, FWF_AUTOARRANGE
, FWF_AUTOARRANGE
);
3150 static HRESULT WINAPI
IShellFolderView_fnGetAutoArrange(IShellFolderView
*iface
)
3152 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3153 TRACE("(%p)\n", This
);
3154 return IFolderView2_GetAutoArrange(&This
->IFolderView2_iface
);
3157 static HRESULT WINAPI
IShellFolderView_fnAddObject(
3158 IShellFolderView
*iface
,
3162 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3163 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3167 static HRESULT WINAPI
IShellFolderView_fnGetObject(
3168 IShellFolderView
*iface
,
3169 PITEMID_CHILD
*pidl
,
3172 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3173 TRACE("(%p)->(%p %d)\n", This
, pidl
, item
);
3174 return IFolderView2_Item(&This
->IFolderView2_iface
, item
, pidl
);
3177 static HRESULT WINAPI
IShellFolderView_fnRemoveObject(
3178 IShellFolderView
*iface
,
3182 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3184 TRACE("(%p)->(%p %p)\n", This
, pidl
, item
);
3188 *item
= LV_FindItemByPidl(This
, ILFindLastID(pidl
));
3189 SendMessageW(This
->hWndList
, LVM_DELETEITEM
, *item
, 0);
3194 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
3200 static HRESULT WINAPI
IShellFolderView_fnGetObjectCount(
3201 IShellFolderView
*iface
,
3204 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3205 TRACE("(%p)->(%p)\n", This
, count
);
3206 return IFolderView2_ItemCount(&This
->IFolderView2_iface
, SVGIO_ALLVIEW
, (INT
*)count
);
3209 static HRESULT WINAPI
IShellFolderView_fnSetObjectCount(
3210 IShellFolderView
*iface
,
3214 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3215 FIXME("(%p)->(%d %x) stub\n", This
, count
, flags
);
3219 static HRESULT WINAPI
IShellFolderView_fnUpdateObject(
3220 IShellFolderView
*iface
,
3221 PITEMID_CHILD pidl_old
,
3222 PITEMID_CHILD pidl_new
,
3225 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3226 FIXME("(%p)->(%p %p %p) stub\n", This
, pidl_old
, pidl_new
, item
);
3230 static HRESULT WINAPI
IShellFolderView_fnRefreshObject(
3231 IShellFolderView
*iface
,
3235 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3236 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3240 static HRESULT WINAPI
IShellFolderView_fnSetRedraw(
3241 IShellFolderView
*iface
,
3244 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3245 TRACE("(%p)->(%d)\n", This
, redraw
);
3246 return IFolderView2_SetRedraw(&This
->IFolderView2_iface
, redraw
);
3249 static HRESULT WINAPI
IShellFolderView_fnGetSelectedCount(
3250 IShellFolderView
*iface
,
3253 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3254 IShellItemArray
*selection
;
3257 TRACE("(%p)->(%p)\n", This
, count
);
3260 hr
= IFolderView2_GetSelection(&This
->IFolderView2_iface
, FALSE
, &selection
);
3264 hr
= IShellItemArray_GetCount(selection
, count
);
3265 IShellItemArray_Release(selection
);
3269 static HRESULT WINAPI
IShellFolderView_fnGetSelectedObjects(
3270 IShellFolderView
*iface
,
3271 PCITEMID_CHILD
**pidl
,
3274 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3276 TRACE("(%p)->(%p %p)\n", This
, pidl
, items
);
3278 *items
= ShellView_GetSelections( This
);
3282 *pidl
= LocalAlloc(0, *items
*sizeof(LPITEMIDLIST
));
3283 if (!*pidl
) return E_OUTOFMEMORY
;
3285 /* it's documented that caller shouldn't free PIDLs, only array itself */
3286 memcpy((PITEMID_CHILD
*)*pidl
, This
->apidl
, *items
*sizeof(LPITEMIDLIST
));
3292 static HRESULT WINAPI
IShellFolderView_fnIsDropOnSource(
3293 IShellFolderView
*iface
,
3294 IDropTarget
*drop_target
)
3296 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3297 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3301 static HRESULT WINAPI
IShellFolderView_fnGetDragPoint(
3302 IShellFolderView
*iface
,
3305 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3306 FIXME("(%p)->(%p) stub\n", This
, pt
);
3310 static HRESULT WINAPI
IShellFolderView_fnGetDropPoint(
3311 IShellFolderView
*iface
,
3314 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3315 FIXME("(%p)->(%p) stub\n", This
, pt
);
3319 static HRESULT WINAPI
IShellFolderView_fnMoveIcons(
3320 IShellFolderView
*iface
,
3323 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3324 TRACE("(%p)->(%p)\n", This
, obj
);
3328 static HRESULT WINAPI
IShellFolderView_fnSetItemPos(
3329 IShellFolderView
*iface
,
3330 PCUITEMID_CHILD pidl
,
3333 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3334 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, pt
);
3338 static HRESULT WINAPI
IShellFolderView_fnIsBkDropTarget(
3339 IShellFolderView
*iface
,
3340 IDropTarget
*drop_target
)
3342 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3343 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3347 static HRESULT WINAPI
IShellFolderView_fnSetClipboard(
3348 IShellFolderView
*iface
,
3351 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3352 FIXME("(%p)->(%d) stub\n", This
, move
);
3356 static HRESULT WINAPI
IShellFolderView_fnSetPoints(
3357 IShellFolderView
*iface
,
3360 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3361 FIXME("(%p)->(%p) stub\n", This
, obj
);
3365 static HRESULT WINAPI
IShellFolderView_fnGetItemSpacing(
3366 IShellFolderView
*iface
,
3367 ITEMSPACING
*spacing
)
3369 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3370 FIXME("(%p)->(%p) stub\n", This
, spacing
);
3374 static HRESULT WINAPI
IShellFolderView_fnSetCallback(
3375 IShellFolderView
*iface
,
3376 IShellFolderViewCB
*new_cb
,
3377 IShellFolderViewCB
**old_cb
)
3380 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3381 FIXME("(%p)->(%p %p) stub\n", This
, new_cb
, old_cb
);
3385 static HRESULT WINAPI
IShellFolderView_fnSelect(
3386 IShellFolderView
*iface
,
3389 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3390 FIXME("(%p)->(%d) stub\n", This
, flags
);
3394 static HRESULT WINAPI
IShellFolderView_fnQuerySupport(
3395 IShellFolderView
*iface
,
3398 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3399 TRACE("(%p)->(%p)\n", This
, support
);
3403 static HRESULT WINAPI
IShellFolderView_fnSetAutomationObject(
3404 IShellFolderView
*iface
,
3407 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3408 FIXME("(%p)->(%p) stub\n", This
, disp
);
3412 static const IShellFolderViewVtbl shellfolderviewvtbl
=
3414 IShellFolderView_fnQueryInterface
,
3415 IShellFolderView_fnAddRef
,
3416 IShellFolderView_fnRelease
,
3417 IShellFolderView_fnRearrange
,
3418 IShellFolderView_fnGetArrangeParam
,
3419 IShellFolderView_fnArrangeGrid
,
3420 IShellFolderView_fnAutoArrange
,
3421 IShellFolderView_fnGetAutoArrange
,
3422 IShellFolderView_fnAddObject
,
3423 IShellFolderView_fnGetObject
,
3424 IShellFolderView_fnRemoveObject
,
3425 IShellFolderView_fnGetObjectCount
,
3426 IShellFolderView_fnSetObjectCount
,
3427 IShellFolderView_fnUpdateObject
,
3428 IShellFolderView_fnRefreshObject
,
3429 IShellFolderView_fnSetRedraw
,
3430 IShellFolderView_fnGetSelectedCount
,
3431 IShellFolderView_fnGetSelectedObjects
,
3432 IShellFolderView_fnIsDropOnSource
,
3433 IShellFolderView_fnGetDragPoint
,
3434 IShellFolderView_fnGetDropPoint
,
3435 IShellFolderView_fnMoveIcons
,
3436 IShellFolderView_fnSetItemPos
,
3437 IShellFolderView_fnIsBkDropTarget
,
3438 IShellFolderView_fnSetClipboard
,
3439 IShellFolderView_fnSetPoints
,
3440 IShellFolderView_fnGetItemSpacing
,
3441 IShellFolderView_fnSetCallback
,
3442 IShellFolderView_fnSelect
,
3443 IShellFolderView_fnQuerySupport
,
3444 IShellFolderView_fnSetAutomationObject
3447 static HRESULT WINAPI
shellfolderviewdual_QueryInterface(IShellFolderViewDual3
*iface
, REFIID riid
, void **ppvObj
)
3449 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3451 TRACE("(%p)->(IID:%s,%p)\n", This
, debugstr_guid(riid
), ppvObj
);
3453 if (IsEqualIID(riid
, &IID_IShellFolderViewDual3
) ||
3454 IsEqualIID(riid
, &IID_IShellFolderViewDual2
) ||
3455 IsEqualIID(riid
, &IID_IShellFolderViewDual
) ||
3456 IsEqualIID(riid
, &IID_IDispatch
) ||
3457 IsEqualIID(riid
, &IID_IUnknown
))
3460 IShellFolderViewDual3_AddRef(iface
);
3464 WARN("unsupported interface %s\n", debugstr_guid(riid
));
3465 return E_NOINTERFACE
;
3468 static ULONG WINAPI
shellfolderviewdual_AddRef(IShellFolderViewDual3
*iface
)
3470 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3471 return IShellView3_AddRef(&This
->IShellView3_iface
);
3474 static ULONG WINAPI
shellfolderviewdual_Release(IShellFolderViewDual3
*iface
)
3476 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3477 return IShellView3_Release(&This
->IShellView3_iface
);
3480 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfoCount(IShellFolderViewDual3
*iface
, UINT
*pctinfo
)
3482 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3483 TRACE("%p %p\n", This
, pctinfo
);
3488 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfo(IShellFolderViewDual3
*iface
,
3489 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
3491 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3494 TRACE("(%p,%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3496 hr
= get_typeinfo(IShellFolderViewDual3_tid
, ppTInfo
);
3498 ITypeInfo_AddRef(*ppTInfo
);
3502 static HRESULT WINAPI
shellfolderviewdual_GetIDsOfNames(
3503 IShellFolderViewDual3
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT
3504 cNames
, LCID lcid
, DISPID
*rgDispId
)
3506 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3510 TRACE("(%p, %s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
,
3511 cNames
, lcid
, rgDispId
);
3513 hr
= get_typeinfo(IShellFolderViewDual3_tid
, &ti
);
3515 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3519 static HRESULT WINAPI
shellfolderviewdual_Invoke(IShellFolderViewDual3
*iface
,
3520 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
,
3521 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
3524 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3528 TRACE("(%p, %d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3529 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3530 pExcepInfo
, puArgErr
);
3532 hr
= get_typeinfo(IShellFolderViewDual3_tid
, &ti
);
3534 hr
= ITypeInfo_Invoke(ti
, &This
->IShellFolderViewDual3_iface
, dispIdMember
, wFlags
, pDispParams
,
3535 pVarResult
, pExcepInfo
, puArgErr
);
3540 static HRESULT WINAPI
shellfolderviewdual_get_Application(IShellFolderViewDual3
*iface
,
3543 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3545 TRACE("%p %p\n", This
, disp
);
3548 return E_INVALIDARG
;
3550 return IShellDispatch_Constructor(NULL
, &IID_IDispatch
, (void**)disp
);
3553 static HRESULT WINAPI
shellfolderviewdual_get_Parent(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3555 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3556 FIXME("%p %p\n", This
, disp
);
3560 static HRESULT WINAPI
shellfolderviewdual_get_Folder(IShellFolderViewDual3
*iface
, Folder
**folder
)
3562 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3563 FIXME("%p %p\n", This
, folder
);
3567 static HRESULT WINAPI
shellfolderviewdual_SelectedItems(IShellFolderViewDual3
*iface
, FolderItems
**items
)
3569 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3570 FIXME("%p %p\n", This
, items
);
3574 static HRESULT WINAPI
shellfolderviewdual_get_FocusedItem(IShellFolderViewDual3
*iface
,
3577 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3578 FIXME("%p %p\n", This
, item
);
3582 static HRESULT WINAPI
shellfolderviewdual_SelectItem(IShellFolderViewDual3
*iface
,
3583 VARIANT
*v
, int flags
)
3585 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3586 FIXME("%p %s %x\n", This
, debugstr_variant(v
), flags
);
3590 static HRESULT WINAPI
shellfolderviewdual_PopupItemMenu(IShellFolderViewDual3
*iface
,
3591 FolderItem
*item
, VARIANT vx
, VARIANT vy
, BSTR
*command
)
3593 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3594 FIXME("%p %p %s %s %p\n", This
, item
, debugstr_variant(&vx
), debugstr_variant(&vy
), command
);
3598 static HRESULT WINAPI
shellfolderviewdual_get_Script(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3600 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3601 FIXME("%p %p\n", This
, disp
);
3605 static HRESULT WINAPI
shellfolderviewdual_get_ViewOptions(IShellFolderViewDual3
*iface
, LONG
*options
)
3607 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3608 FIXME("%p %p\n", This
, options
);
3612 static HRESULT WINAPI
shellfolderviewdual_get_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT
*mode
)
3614 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3615 FIXME("%p %p\n", This
, mode
);
3619 static HRESULT WINAPI
shellfolderviewdual_put_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT mode
)
3621 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3622 FIXME("%p %u\n", This
, mode
);
3626 static HRESULT WINAPI
shellfolderviewdual_SelectItemRelative(IShellFolderViewDual3
*iface
, int relative
)
3628 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3629 FIXME("%p %d\n", This
, relative
);
3633 static HRESULT WINAPI
shellfolderviewdual_get_GroupBy(IShellFolderViewDual3
*iface
, BSTR
*groupby
)
3635 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3636 FIXME("%p %p\n", This
, groupby
);
3640 static HRESULT WINAPI
shellfolderviewdual_put_GroupBy(IShellFolderViewDual3
*iface
, BSTR groupby
)
3642 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3643 FIXME("%p %s\n", This
, debugstr_w(groupby
));
3647 static HRESULT WINAPI
shellfolderviewdual_get_FolderFlags(IShellFolderViewDual3
*iface
, DWORD
*flags
)
3649 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3650 FIXME("%p %p\n", This
, flags
);
3654 static HRESULT WINAPI
shellfolderviewdual_put_FolderFlags(IShellFolderViewDual3
*iface
, DWORD flags
)
3656 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3657 FIXME("%p 0x%08x\n", This
, flags
);
3661 static HRESULT WINAPI
shellfolderviewdual_get_SortColumns(IShellFolderViewDual3
*iface
, BSTR
*sortcolumns
)
3663 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3664 FIXME("%p %p\n", This
, sortcolumns
);
3668 static HRESULT WINAPI
shellfolderviewdual_put_SortColumns(IShellFolderViewDual3
*iface
, BSTR sortcolumns
)
3670 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3671 FIXME("%p %s\n", This
, debugstr_w(sortcolumns
));
3675 static HRESULT WINAPI
shellfolderviewdual_put_IconSize(IShellFolderViewDual3
*iface
, int icon_size
)
3677 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3678 FIXME("%p %d\n", This
, icon_size
);
3682 static HRESULT WINAPI
shellfolderviewdual_get_IconSize(IShellFolderViewDual3
*iface
, int *icon_size
)
3684 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3685 FIXME("%p %p\n", This
, icon_size
);
3689 static HRESULT WINAPI
shellfolderviewdual_FilterView(IShellFolderViewDual3
*iface
, BSTR filter_text
)
3691 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3692 FIXME("%p %s\n", This
, debugstr_w(filter_text
));
3696 static const IShellFolderViewDual3Vtbl shellfolderviewdualvtbl
=
3698 shellfolderviewdual_QueryInterface
,
3699 shellfolderviewdual_AddRef
,
3700 shellfolderviewdual_Release
,
3701 shellfolderviewdual_GetTypeInfoCount
,
3702 shellfolderviewdual_GetTypeInfo
,
3703 shellfolderviewdual_GetIDsOfNames
,
3704 shellfolderviewdual_Invoke
,
3705 shellfolderviewdual_get_Application
,
3706 shellfolderviewdual_get_Parent
,
3707 shellfolderviewdual_get_Folder
,
3708 shellfolderviewdual_SelectedItems
,
3709 shellfolderviewdual_get_FocusedItem
,
3710 shellfolderviewdual_SelectItem
,
3711 shellfolderviewdual_PopupItemMenu
,
3712 shellfolderviewdual_get_Script
,
3713 shellfolderviewdual_get_ViewOptions
,
3714 shellfolderviewdual_get_CurrentViewMode
,
3715 shellfolderviewdual_put_CurrentViewMode
,
3716 shellfolderviewdual_SelectItemRelative
,
3717 shellfolderviewdual_get_GroupBy
,
3718 shellfolderviewdual_put_GroupBy
,
3719 shellfolderviewdual_get_FolderFlags
,
3720 shellfolderviewdual_put_FolderFlags
,
3721 shellfolderviewdual_get_SortColumns
,
3722 shellfolderviewdual_put_SortColumns
,
3723 shellfolderviewdual_put_IconSize
,
3724 shellfolderviewdual_get_IconSize
,
3725 shellfolderviewdual_FilterView
3728 /**********************************************************
3729 * IShellView_Constructor
3731 IShellView
*IShellView_Constructor(IShellFolder
*folder
)
3735 sv
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IShellViewImpl
));
3740 sv
->IShellView3_iface
.lpVtbl
= &shellviewvtbl
;
3741 sv
->IOleCommandTarget_iface
.lpVtbl
= &olecommandtargetvtbl
;
3742 sv
->IDropTarget_iface
.lpVtbl
= &droptargetvtbl
;
3743 sv
->IDropSource_iface
.lpVtbl
= &dropsourcevtbl
;
3744 sv
->IViewObject_iface
.lpVtbl
= &viewobjectvtbl
;
3745 sv
->IFolderView2_iface
.lpVtbl
= &folderviewvtbl
;
3746 sv
->IShellFolderView_iface
.lpVtbl
= &shellfolderviewvtbl
;
3747 sv
->IShellFolderViewDual3_iface
.lpVtbl
= &shellfolderviewdualvtbl
;
3749 sv
->pSFParent
= folder
;
3750 if (folder
) IShellFolder_AddRef(folder
);
3751 IShellFolder_QueryInterface(sv
->pSFParent
, &IID_IShellFolder2
, (void**)&sv
->pSF2Parent
);
3753 sv
->pCurDropTarget
= NULL
;
3754 sv
->pCurDataObject
= NULL
;
3755 sv
->iDragOverItem
= 0;
3756 sv
->cScrollDelay
= 0;
3757 sv
->ptLastMousePos
.x
= 0;
3758 sv
->ptLastMousePos
.y
= 0;
3760 TRACE("(%p)->(%p)\n", sv
, folder
);
3761 return (IShellView
*)&sv
->IShellView3_iface
;