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
)
204 { return(This
->pCommDlgBrowser
!= NULL
);
207 static HRESULT
IncludeObject(IShellViewImpl
* This
, LPCITEMIDLIST pidl
)
211 if ( IsInCommDlg(This
) )
213 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl
);
214 ret
= ICommDlgBrowser_IncludeObject(This
->pCommDlgBrowser
, (IShellView
*)This
, pidl
);
215 TRACE("--0x%08x\n", ret
);
220 static HRESULT
OnDefaultCommand(IShellViewImpl
* This
)
222 HRESULT ret
= S_FALSE
;
224 if (IsInCommDlg(This
))
226 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
227 ret
= ICommDlgBrowser_OnDefaultCommand(This
->pCommDlgBrowser
, (IShellView
*)This
);
228 TRACE("-- returns %08x\n", ret
);
233 static HRESULT
OnStateChange(IShellViewImpl
* This
, UINT uFlags
)
235 HRESULT ret
= S_FALSE
;
237 if (IsInCommDlg(This
))
239 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags
);
240 ret
= ICommDlgBrowser_OnStateChange(This
->pCommDlgBrowser
, (IShellView
*)This
, uFlags
);
245 /**********************************************************
246 * set the toolbar of the filedialog buttons
248 * - activates the buttons from the shellbrowser according to
251 static void CheckToolbar(IShellViewImpl
* This
)
257 if (IsInCommDlg(This
))
259 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
260 FCIDM_TB_SMALLICON
, This
->FolderSettings
.ViewMode
== FVM_LIST
, &result
);
261 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_CHECKBUTTON
,
262 FCIDM_TB_REPORTVIEW
, This
->FolderSettings
.ViewMode
== FVM_DETAILS
, &result
);
263 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
264 FCIDM_TB_SMALLICON
, TRUE
, &result
);
265 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_TOOLBAR
, TB_ENABLEBUTTON
,
266 FCIDM_TB_REPORTVIEW
, TRUE
, &result
);
270 /**********************************************************
272 * ##### helperfunctions for initializing the view #####
274 /**********************************************************
275 * change the style of the listview control
277 static void SetStyle(IShellViewImpl
* This
, DWORD dwAdd
, DWORD dwRemove
)
281 TRACE("(%p)\n", This
);
283 tmpstyle
= GetWindowLongW(This
->hWndList
, GWL_STYLE
);
284 SetWindowLongW(This
->hWndList
, GWL_STYLE
, dwAdd
| (tmpstyle
& ~dwRemove
));
287 static DWORD
ViewModeToListStyle(UINT ViewMode
)
291 TRACE("%d\n", ViewMode
);
295 case FVM_ICON
: dwStyle
= LVS_ICON
; break;
296 case FVM_DETAILS
: dwStyle
= LVS_REPORT
; break;
297 case FVM_SMALLICON
: dwStyle
= LVS_SMALLICON
; break;
298 case FVM_LIST
: dwStyle
= LVS_LIST
; break;
301 FIXME("ViewMode %d not implemented\n", ViewMode
);
310 /**********************************************************
311 * ShellView_CreateList()
313 * - creates the list view window
315 static BOOL
ShellView_CreateList (IShellViewImpl
* This
)
316 { DWORD dwStyle
, dwExStyle
;
320 dwStyle
= WS_TABSTOP
| WS_VISIBLE
| WS_CHILDWINDOW
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
|
321 LVS_SHAREIMAGELISTS
| LVS_EDITLABELS
| LVS_ALIGNLEFT
| LVS_AUTOARRANGE
;
322 dwExStyle
= WS_EX_CLIENTEDGE
;
324 dwStyle
|= ViewModeToListStyle(This
->FolderSettings
.ViewMode
);
326 if (This
->FolderSettings
.fFlags
& FWF_AUTOARRANGE
) dwStyle
|= LVS_AUTOARRANGE
;
327 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
328 This
->FolderSettings
.fFlags
|= FWF_NOCLIENTEDGE
| FWF_NOSCROLL
;
329 if (This
->FolderSettings
.fFlags
& FWF_SINGLESEL
) dwStyle
|= LVS_SINGLESEL
;
330 if (This
->FolderSettings
.fFlags
& FWF_NOCLIENTEDGE
)
331 dwExStyle
&= ~WS_EX_CLIENTEDGE
;
333 This
->hWndList
=CreateWindowExW( dwExStyle
,
346 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
347 This
->ListViewSortInfo
.nHeaderID
= -1;
348 This
->ListViewSortInfo
.nLastHeaderID
= -1;
350 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
) {
352 * FIXME: look at the registry value
353 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow
354 * and activate drop shadows if necessary
357 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, CLR_NONE
);
359 SendMessageW(This
->hWndList
, LVM_SETTEXTBKCOLOR
, 0, GetSysColor(COLOR_DESKTOP
));
361 SendMessageW(This
->hWndList
, LVM_SETTEXTCOLOR
, 0, RGB(255,255,255));
364 /* UpdateShellSettings(); */
368 /**********************************************************
369 * ShellView_InitList()
371 * - adds all needed columns to the shellview
373 static void ShellView_InitList(IShellViewImpl
*This
)
375 IShellDetails
*details
= NULL
;
376 HIMAGELIST big_icons
, small_icons
;
383 TRACE("(%p)\n", This
);
385 Shell_GetImageLists( &big_icons
, &small_icons
);
386 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
387 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_SMALL
, (LPARAM
)small_icons
);
388 SendMessageW(This
->hWndList
, LVM_SETIMAGELIST
, LVSIL_NORMAL
, (LPARAM
)big_icons
);
390 lvColumn
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_TEXT
;
391 lvColumn
.pszText
= nameW
;
393 if (!This
->pSF2Parent
)
395 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
398 WARN("IShellFolder2/IShellDetails not supported\n");
405 if (This
->pSF2Parent
)
406 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, NULL
, i
, &sd
);
408 hr
= IShellDetails_GetDetailsOf(details
, NULL
, i
, &sd
);
409 if (FAILED(hr
)) break;
411 lvColumn
.fmt
= sd
.fmt
;
412 lvColumn
.cx
= sd
.cxChar
*8; /* chars->pixel */
413 StrRetToStrNW(nameW
, sizeof(nameW
)/sizeof(WCHAR
), &sd
.str
, NULL
);
414 SendMessageW(This
->hWndList
, LVM_INSERTCOLUMNW
, i
, (LPARAM
) &lvColumn
);
417 if (details
) IShellDetails_Release(details
);
420 /**********************************************************
421 * ShellView_CompareItems()
424 * internal, CALLBACK for DSA_Sort
426 static INT CALLBACK
ShellView_CompareItems(LPVOID lParam1
, LPVOID lParam2
, LPARAM lpData
)
429 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1
, lParam2
, (LPVOID
) lpData
);
431 if(!lpData
) return 0;
433 ret
= (SHORT
) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER
)lpData
, 0, (LPITEMIDLIST
)lParam1
, (LPITEMIDLIST
)lParam2
));
434 TRACE("ret=%i\n",ret
);
438 /*************************************************************************
439 * ShellView_ListViewCompareItems
441 * Compare Function for the Listview (FileOpen Dialog)
444 * lParam1 [I] the first ItemIdList to compare with
445 * lParam2 [I] the second ItemIdList to compare with
446 * lpData [I] The column ID for the header Ctrl to process
449 * A negative value if the first item should precede the second,
450 * a positive value if the first item should follow the second,
451 * or zero if the two items are equivalent
454 * FIXME: function does what ShellView_CompareItems is supposed to do.
455 * unify it and figure out how to use the undocumented first parameter
456 * of IShellFolder_CompareIDs to do the job this function does and
457 * move this code to IShellFolder.
458 * make LISTVIEW_SORT_INFO obsolete
459 * the way this function works is only usable if we had only
460 * filesystemfolders (25/10/99 jsch)
462 static INT CALLBACK
ShellView_ListViewCompareItems(LPVOID lParam1
, LPVOID lParam2
, LPARAM lpData
)
466 char strName1
[MAX_PATH
], strName2
[MAX_PATH
];
467 BOOL bIsFolder1
, bIsFolder2
,bIsBothFolder
;
468 LPITEMIDLIST pItemIdList1
= lParam1
;
469 LPITEMIDLIST pItemIdList2
= lParam2
;
470 LISTVIEW_SORT_INFO
*pSortInfo
= (LPLISTVIEW_SORT_INFO
) lpData
;
473 bIsFolder1
= _ILIsFolder(pItemIdList1
);
474 bIsFolder2
= _ILIsFolder(pItemIdList2
);
475 bIsBothFolder
= bIsFolder1
&& bIsFolder2
;
477 /* When sorting between a File and a Folder, the Folder gets sorted first */
478 if( (bIsFolder1
|| bIsFolder2
) && !bIsBothFolder
)
480 nDiff
= bIsFolder1
? -1 : 1;
484 /* Sort by Time: Folders or Files can be sorted */
486 if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TIME
)
488 _ILGetFileDateTime(pItemIdList1
, &fd1
);
489 _ILGetFileDateTime(pItemIdList2
, &fd2
);
490 nDiff
= CompareFileTime(&fd2
, &fd1
);
492 /* Sort by Attribute: Folder or Files can be sorted */
493 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_ATTRIB
)
495 _ILGetFileAttributes(pItemIdList1
, strName1
, MAX_PATH
);
496 _ILGetFileAttributes(pItemIdList2
, strName2
, MAX_PATH
);
497 nDiff
= lstrcmpiA(strName1
, strName2
);
499 /* Sort by FileName: Folder or Files can be sorted */
500 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_NAME
|| bIsBothFolder
)
503 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
504 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
505 nDiff
= lstrcmpiA(strName1
, strName2
);
507 /* Sort by File Size, Only valid for Files */
508 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_SIZE
)
510 nDiff
= (INT
)(_ILGetFileSize(pItemIdList1
, NULL
, 0) - _ILGetFileSize(pItemIdList2
, NULL
, 0));
512 /* Sort by File Type, Only valid for Files */
513 else if(pSortInfo
->nHeaderID
== LISTVIEW_COLUMN_TYPE
)
516 _ILGetFileType(pItemIdList1
, strName1
, MAX_PATH
);
517 _ILGetFileType(pItemIdList2
, strName2
, MAX_PATH
);
518 nDiff
= lstrcmpiA(strName1
, strName2
);
521 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
525 _ILSimpleGetText(pItemIdList1
, strName1
, MAX_PATH
);
526 _ILSimpleGetText(pItemIdList2
, strName2
, MAX_PATH
);
527 nDiff
= lstrcmpiA(strName1
, strName2
);
530 if(!pSortInfo
->bIsAscending
)
539 /**********************************************************
540 * LV_FindItemByPidl()
542 static int LV_FindItemByPidl(
543 IShellViewImpl
* This
,
548 lvItem
.mask
= LVIF_PARAM
;
549 for(lvItem
.iItem
= 0;
550 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
553 LPITEMIDLIST currentpidl
= (LPITEMIDLIST
) lvItem
.lParam
;
554 HRESULT hr
= IShellFolder_CompareIDs(This
->pSFParent
, 0, pidl
, currentpidl
);
555 if(SUCCEEDED(hr
) && !HRESULT_CODE(hr
))
563 /**********************************************************
566 static BOOLEAN
LV_AddItem(IShellViewImpl
* This
, LPCITEMIDLIST pidl
)
570 TRACE("(%p)(pidl=%p)\n", This
, pidl
);
572 lvItem
.mask
= LVIF_TEXT
| LVIF_IMAGE
| LVIF_PARAM
; /*set the mask*/
573 lvItem
.iItem
= SendMessageW(This
->hWndList
, LVM_GETITEMCOUNT
, 0, 0); /*add the item to the end of the list*/
575 lvItem
.lParam
= (LPARAM
) ILClone(ILFindLastID(pidl
)); /*set the item's data*/
576 lvItem
.pszText
= LPSTR_TEXTCALLBACKW
; /*get text on a callback basis*/
577 lvItem
.iImage
= I_IMAGECALLBACK
; /*get the image on a callback basis*/
578 return ListView_InsertItemW(This
->hWndList
, &lvItem
) != -1;
581 /**********************************************************
584 static BOOLEAN
LV_RenameItem(IShellViewImpl
* This
, LPCITEMIDLIST pidlOld
, LPCITEMIDLIST pidlNew
)
589 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This
, pidlOld
, pidlNew
);
591 nItem
= LV_FindItemByPidl(This
, ILFindLastID(pidlOld
));
594 lvItem
.mask
= LVIF_PARAM
; /* only the pidl */
595 lvItem
.iItem
= nItem
;
596 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
598 SHFree((LPITEMIDLIST
)lvItem
.lParam
);
599 lvItem
.mask
= LVIF_PARAM
;
600 lvItem
.iItem
= nItem
;
601 lvItem
.lParam
= (LPARAM
) ILClone(ILFindLastID(pidlNew
)); /* set the item's data */
602 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
603 SendMessageW(This
->hWndList
, LVM_UPDATE
, nItem
, 0);
604 return TRUE
; /* FIXME: better handling */
608 /**********************************************************
609 * ShellView_FillList()
611 * - gets the objectlist from the shellfolder
613 * - fills the list into the view
616 static INT CALLBACK
fill_list( LPVOID ptr
, LPVOID arg
)
618 LPITEMIDLIST pidl
= ptr
;
619 IShellViewImpl
*This
= arg
;
620 /* in a commdlg This works as a filemask*/
621 if ( IncludeObject(This
, pidl
)==S_OK
) LV_AddItem(This
, pidl
);
626 static HRESULT
ShellView_FillList(IShellViewImpl
*This
)
628 IShellFolderView
*folderview
= &This
->IShellFolderView_iface
;
629 LPENUMIDLIST pEnumIDList
;
635 TRACE("(%p)\n", This
);
637 /* get the itemlist from the shfolder*/
638 hr
= IShellFolder_EnumObjects(This
->pSFParent
, This
->hWnd
, SHCONTF_NONFOLDERS
| SHCONTF_FOLDERS
, &pEnumIDList
);
639 if (hr
!= S_OK
) return hr
;
641 /* create a pointer array */
642 hdpa
= DPA_Create(16);
645 IEnumIDList_Release(pEnumIDList
);
646 return E_OUTOFMEMORY
;
649 /* copy the items into the array*/
650 while((S_OK
== IEnumIDList_Next(pEnumIDList
, 1, &pidl
, &fetched
)) && fetched
)
652 if (DPA_InsertPtr(hdpa
, DPA_GetPtrCount(hdpa
), pidl
) == -1)
659 DPA_Sort(hdpa
, ShellView_CompareItems
, (LPARAM
)This
->pSFParent
);
661 IShellFolderView_SetRedraw(folderview
, FALSE
);
662 DPA_DestroyCallback(hdpa
, fill_list
, This
);
663 IShellFolderView_SetRedraw(folderview
, TRUE
);
665 IEnumIDList_Release(pEnumIDList
);
670 /**********************************************************
671 * ShellView_OnCreate()
673 static LRESULT
ShellView_OnCreate(IShellViewImpl
*This
)
675 IShellView3
*iface
= &This
->IShellView3_iface
;
676 static const WCHAR accel_nameW
[] = {'s','h','v','_','a','c','c','e','l',0};
677 IPersistFolder2
*ppf2
;
681 TRACE("(%p)\n", This
);
683 if (ShellView_CreateList(This
))
685 ShellView_InitList(This
);
686 ShellView_FillList(This
);
689 hr
= IShellView3_QueryInterface(iface
, &IID_IDropTarget
, (void**)&pdt
);
692 RegisterDragDrop(This
->hWnd
, pdt
);
693 IDropTarget_Release(pdt
);
696 /* register for receiving notifications */
697 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IPersistFolder2
, (LPVOID
*)&ppf2
);
700 LPITEMIDLIST raw_pidl
;
701 SHChangeNotifyEntry ntreg
;
703 hr
= IPersistFolder2_GetCurFolder(ppf2
, &raw_pidl
);
706 LPITEMIDLIST computer_pidl
;
707 SHGetFolderLocation(NULL
,CSIDL_DRIVES
,NULL
,0,&computer_pidl
);
708 if(ILIsParent(computer_pidl
,raw_pidl
,FALSE
))
710 /* Normalize the pidl to unixfs to workaround an issue with
711 * sending notifications on dos paths
713 WCHAR path
[MAX_PATH
];
714 SHGetPathFromIDListW(raw_pidl
,path
);
715 SHParseDisplayName(path
,NULL
,(LPITEMIDLIST
*)&ntreg
.pidl
,0,NULL
);
719 ntreg
.pidl
= raw_pidl
;
720 ntreg
.fRecursive
= TRUE
;
721 This
->hNotify
= SHChangeNotifyRegister(This
->hWnd
, SHCNRF_InterruptLevel
, SHCNE_ALLEVENTS
,
722 SHV_CHANGE_NOTIFY
, 1, &ntreg
);
723 SHFree((LPITEMIDLIST
)ntreg
.pidl
);
724 SHFree(computer_pidl
);
726 IPersistFolder2_Release(ppf2
);
729 This
->hAccel
= LoadAcceleratorsW(shell32_hInstance
, accel_nameW
);
734 /**********************************************************
735 * #### Handling of the menus ####
738 /**********************************************************
739 * ShellView_BuildFileMenu()
741 static HMENU
ShellView_BuildFileMenu(IShellViewImpl
* This
)
742 { WCHAR szText
[MAX_PATH
];
747 TRACE("(%p)\n",This
);
749 hSubMenu
= CreatePopupMenu();
751 { /*get the number of items in our global array*/
752 for(nTools
= 0; Tools
[nTools
].idCommand
!= -1; nTools
++){}
754 /*add the menu items*/
755 for(i
= 0; i
< nTools
; i
++)
757 LoadStringW(shell32_hInstance
, Tools
[i
].idMenuString
, szText
, MAX_PATH
);
759 ZeroMemory(&mii
, sizeof(mii
));
760 mii
.cbSize
= sizeof(mii
);
761 mii
.fMask
= MIIM_TYPE
| MIIM_ID
| MIIM_STATE
;
763 if(BTNS_SEP
!= Tools
[i
].bStyle
) /* no separator*/
765 mii
.fType
= MFT_STRING
;
766 mii
.fState
= MFS_ENABLED
;
767 mii
.dwTypeData
= szText
;
768 mii
.wID
= Tools
[i
].idCommand
;
772 mii
.fType
= MFT_SEPARATOR
;
774 /* tack This item onto the end of the menu */
775 InsertMenuItemW(hSubMenu
, (UINT
)-1, TRUE
, &mii
);
778 TRACE("-- return (menu=%p)\n",hSubMenu
);
781 /**********************************************************
782 * ShellView_MergeFileMenu()
784 static void ShellView_MergeFileMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
786 TRACE("(%p)->(submenu=%p) stub\n",This
,hSubMenu
);
790 static const WCHAR dummyW
[] = {'d','u','m','m','y','4','5',0};
793 /* insert This item at the beginning of the menu */
795 mii
.cbSize
= sizeof(mii
);
796 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
798 mii
.fType
= MFT_SEPARATOR
;
799 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
801 mii
.cbSize
= sizeof(mii
);
802 mii
.fMask
= MIIM_ID
| MIIM_TYPE
| MIIM_STATE
;
803 mii
.dwTypeData
= (LPWSTR
)dummyW
;
804 mii
.fState
= MFS_ENABLED
;
805 mii
.wID
= IDM_MYFILEITEM
;
806 mii
.fType
= MFT_STRING
;
807 InsertMenuItemW(hSubMenu
, 0, TRUE
, &mii
);
813 /**********************************************************
814 * ShellView_MergeViewMenu()
817 static void ShellView_MergeViewMenu(IShellViewImpl
*This
, HMENU hSubMenu
)
819 TRACE("(%p)->(submenu=%p)\n",This
,hSubMenu
);
821 /* add a separator at the correct position in the menu */
824 static const WCHAR menuW
[] = {'M','E','N','U','_','0','0','1',0};
825 static const WCHAR viewW
[] = {'V','i','e','w',0};
828 memset(&mii
, 0, sizeof(mii
));
829 mii
.cbSize
= sizeof(mii
);
830 mii
.fMask
= MIIM_ID
| MIIM_TYPE
;
832 mii
.fType
= MFT_SEPARATOR
;
833 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
835 mii
.cbSize
= sizeof(mii
);
836 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_DATA
;
837 mii
.fType
= MFT_STRING
;
838 mii
.dwTypeData
= (LPWSTR
)viewW
;
839 mii
.hSubMenu
= LoadMenuW(shell32_hInstance
, menuW
);
840 InsertMenuItemW(hSubMenu
, FCIDM_MENU_VIEW_SEP_OPTIONS
, FALSE
, &mii
);
844 /**********************************************************
845 * ShellView_GetSelections()
847 * - fills the this->apidl list with the selected objects
850 * number of selected items
852 static UINT
ShellView_GetSelections(IShellViewImpl
* This
)
859 This
->cidl
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
860 This
->apidl
= SHAlloc(This
->cidl
* sizeof(LPITEMIDLIST
));
862 TRACE("selected=%i\n", This
->cidl
);
866 TRACE("-- Items selected =%u\n", This
->cidl
);
868 lvItem
.mask
= LVIF_STATE
| LVIF_PARAM
;
869 lvItem
.stateMask
= LVIS_SELECTED
;
873 while(ListView_GetItemW(This
->hWndList
, &lvItem
) && (i
< This
->cidl
))
875 if(lvItem
.state
& LVIS_SELECTED
)
877 This
->apidl
[i
] = (LPITEMIDLIST
)lvItem
.lParam
;
879 TRACE("-- selected Item found\n");
888 /**********************************************************
889 * ShellView_OpenSelectedItems()
891 static HRESULT
ShellView_OpenSelectedItems(IShellViewImpl
* This
)
893 static UINT CF_IDLIST
= 0;
895 IDataObject
* selection
;
899 LPCITEMIDLIST parent_pidl
;
900 WCHAR parent_path
[MAX_PATH
];
901 LPCWSTR parent_dir
= NULL
;
905 if (0 == ShellView_GetSelections(This
))
909 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
,
910 (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,
911 0, (LPVOID
*)&selection
);
917 CF_IDLIST
= RegisterClipboardFormatW(CFSTR_SHELLIDLISTW
);
919 fetc
.cfFormat
= CF_IDLIST
;
921 fetc
.dwAspect
= DVASPECT_CONTENT
;
923 fetc
.tymed
= TYMED_HGLOBAL
;
925 hr
= IDataObject_QueryGetData(selection
, &fetc
);
929 hr
= IDataObject_GetData(selection
, &fetc
, &stgm
);
933 pIDList
= GlobalLock(stgm
.u
.hGlobal
);
935 parent_pidl
= (LPCITEMIDLIST
) ((LPBYTE
)pIDList
+pIDList
->aoffset
[0]);
936 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &parent_pidl
, &attribs
);
937 if (SUCCEEDED(hr
) && (attribs
& SFGAO_FILESYSTEM
) &&
938 SHGetPathFromIDListW(parent_pidl
, parent_path
))
940 parent_dir
= parent_path
;
943 for (i
= pIDList
->cidl
; i
> 0; --i
)
947 pidl
= (LPCITEMIDLIST
)((LPBYTE
)pIDList
+pIDList
->aoffset
[i
]);
949 attribs
= SFGAO_FOLDER
;
950 hr
= IShellFolder_GetAttributesOf(This
->pSFParent
, 1, &pidl
, &attribs
);
952 if (SUCCEEDED(hr
) && ! (attribs
& SFGAO_FOLDER
))
954 SHELLEXECUTEINFOW shexinfo
;
956 shexinfo
.cbSize
= sizeof(SHELLEXECUTEINFOW
);
957 shexinfo
.fMask
= SEE_MASK_INVOKEIDLIST
; /* SEE_MASK_IDLIST is also possible. */
958 shexinfo
.hwnd
= NULL
;
959 shexinfo
.lpVerb
= NULL
;
960 shexinfo
.lpFile
= NULL
;
961 shexinfo
.lpParameters
= NULL
;
962 shexinfo
.lpDirectory
= parent_dir
;
963 shexinfo
.nShow
= SW_NORMAL
;
964 shexinfo
.lpIDList
= ILCombine(parent_pidl
, pidl
);
966 ShellExecuteExW(&shexinfo
); /* Discard error/success info */
968 ILFree(shexinfo
.lpIDList
);
972 GlobalUnlock(stgm
.u
.hGlobal
);
973 ReleaseStgMedium(&stgm
);
975 IDataObject_Release(selection
);
980 /**********************************************************
981 * ShellView_DoContextMenu()
983 static void ShellView_DoContextMenu(IShellViewImpl
* This
, WORD x
, WORD y
, BOOL bDefault
)
987 BOOL fExplore
= FALSE
;
989 LPCONTEXTMENU pContextMenu
= NULL
;
990 CMINVOKECOMMANDINFO cmi
;
992 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This
, x
, y
, bDefault
);
994 /* look, what's selected and create a context menu object of it*/
995 if( ShellView_GetSelections(This
) )
997 IShellFolder_GetUIObjectOf( This
->pSFParent
, This
->hWndParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
,
998 &IID_IContextMenu
, NULL
, (LPVOID
*)&pContextMenu
);
1002 TRACE("-- pContextMenu\n");
1003 hMenu
= CreatePopupMenu();
1007 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
1008 if(SUCCEEDED(IShellBrowser_GetControlWindow(This
->pShellBrowser
,FCW_TREE
, &hwndTree
)) && hwndTree
)
1010 TRACE("-- explore mode\n");
1014 /* build the flags depending on what we can do with the selected item */
1015 wFlags
= CMF_NORMAL
| (This
->cidl
!= 1 ? 0 : CMF_CANRENAME
) | (fExplore
? CMF_EXPLORE
: 0);
1017 /* let the ContextMenu merge its items in */
1018 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, wFlags
)))
1020 if (This
->FolderSettings
.fFlags
& FWF_DESKTOP
)
1021 SetMenuDefaultItem(hMenu
, FCIDM_SHVIEW_OPEN
, MF_BYCOMMAND
);
1025 TRACE("-- get menu default command\n");
1026 uCommand
= GetMenuDefaultItem(hMenu
, FALSE
, GMDI_GOINTOPOPUPS
);
1030 TRACE("-- track popup\n");
1031 uCommand
= TrackPopupMenu( hMenu
,TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1036 TRACE("-- uCommand=%u\n", uCommand
);
1037 if (uCommand
==FCIDM_SHVIEW_OPEN
&& IsInCommDlg(This
))
1039 TRACE("-- dlg: OnDefaultCommand\n");
1040 if (OnDefaultCommand(This
) != S_OK
)
1042 ShellView_OpenSelectedItems(This
);
1047 TRACE("-- explore -- invoke command\n");
1048 ZeroMemory(&cmi
, sizeof(cmi
));
1049 cmi
.cbSize
= sizeof(cmi
);
1050 cmi
.hwnd
= This
->hWndParent
; /* this window has to answer CWM_GETISHELLBROWSER */
1051 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1052 IContextMenu_InvokeCommand(pContextMenu
, &cmi
);
1059 IContextMenu_Release(pContextMenu
);
1062 else /* background context menu */
1066 hMenu
= CreatePopupMenu();
1068 BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, &IID_IContextMenu2
, (void**)&pCM
);
1069 IContextMenu2_QueryContextMenu(pCM
, hMenu
, 0, FCIDM_SHVIEWFIRST
, FCIDM_SHVIEWLAST
, 0);
1071 uCommand
= TrackPopupMenu( hMenu
, TPM_LEFTALIGN
| TPM_RETURNCMD
,x
,y
,0,This
->hWnd
,NULL
);
1074 TRACE("-- (%p)->(uCommand=0x%08x )\n",This
, uCommand
);
1076 ZeroMemory(&cmi
, sizeof(cmi
));
1077 cmi
.cbSize
= sizeof(cmi
);
1078 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
1079 cmi
.hwnd
= This
->hWndParent
;
1080 IContextMenu2_InvokeCommand(pCM
, &cmi
);
1082 IContextMenu2_Release(pCM
);
1086 /**********************************************************
1087 * ##### message handling #####
1090 /**********************************************************
1091 * ShellView_OnSize()
1093 static LRESULT
ShellView_OnSize(IShellViewImpl
* This
, WORD wWidth
, WORD wHeight
)
1095 TRACE("%p width=%u height=%u\n",This
, wWidth
,wHeight
);
1097 /*resize the ListView to fit our window*/
1100 MoveWindow(This
->hWndList
, 0, 0, wWidth
, wHeight
, TRUE
);
1105 /**********************************************************
1106 * ShellView_OnDeactivate()
1111 static void ShellView_OnDeactivate(IShellViewImpl
* This
)
1115 if(This
->uState
!= SVUIA_DEACTIVATE
)
1119 IShellBrowser_SetMenuSB(This
->pShellBrowser
,0, 0, 0);
1120 IShellBrowser_RemoveMenusSB(This
->pShellBrowser
,This
->hMenu
);
1121 DestroyMenu(This
->hMenu
);
1125 This
->uState
= SVUIA_DEACTIVATE
;
1129 /**********************************************************
1130 * ShellView_OnActivate()
1132 static LRESULT
ShellView_OnActivate(IShellViewImpl
*This
, UINT uState
)
1134 OLEMENUGROUPWIDTHS omw
= { {0, 0, 0, 0, 0, 0} };
1137 TRACE("(%p) uState=%x\n",This
,uState
);
1139 /* don't do anything if the state isn't really changing */
1140 if (This
->uState
== uState
) return S_OK
;
1142 ShellView_OnDeactivate(This
);
1144 /* only do This if we are active */
1145 if (uState
!= SVUIA_DEACTIVATE
)
1147 /* merge the menus */
1148 This
->hMenu
= CreateMenu();
1152 static const WCHAR dummyW
[] = {'d','u','m','m','y',' ','3','1',0};
1154 IShellBrowser_InsertMenusSB(This
->pShellBrowser
, This
->hMenu
, &omw
);
1155 TRACE("-- after fnInsertMenusSB\n");
1157 mii
.cbSize
= sizeof(mii
);
1158 mii
.fMask
= MIIM_SUBMENU
| MIIM_TYPE
| MIIM_STATE
;
1159 mii
.fType
= MFT_STRING
;
1160 mii
.fState
= MFS_ENABLED
;
1162 mii
.hSubMenu
= ShellView_BuildFileMenu(This
);
1163 mii
.hbmpChecked
= NULL
;
1164 mii
.hbmpUnchecked
= NULL
;
1166 /* build the top level menu get the menu item's text */
1167 mii
.dwTypeData
= (LPWSTR
)dummyW
;
1169 mii
.hbmpItem
= NULL
;
1171 /* insert our menu into the menu bar */
1173 InsertMenuItemW(This
->hMenu
, FCIDM_MENU_HELP
, FALSE
, &mii
);
1175 /* get the view menu so we can merge with it */
1176 memset(&mii
, 0, sizeof(mii
));
1177 mii
.cbSize
= sizeof(mii
);
1178 mii
.fMask
= MIIM_SUBMENU
;
1180 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_VIEW
, FALSE
, &mii
))
1181 ShellView_MergeViewMenu(This
, mii
.hSubMenu
);
1183 /* add the items that should only be added if we have the focus */
1184 if (SVUIA_ACTIVATE_FOCUS
== uState
)
1186 /* get the file menu so we can merge with it */
1187 memset(&mii
, 0, sizeof(mii
));
1188 mii
.cbSize
= sizeof(mii
);
1189 mii
.fMask
= MIIM_SUBMENU
;
1191 if (GetMenuItemInfoW(This
->hMenu
, FCIDM_MENU_FILE
, FALSE
, &mii
))
1192 ShellView_MergeFileMenu(This
, mii
.hSubMenu
);
1195 TRACE("-- before fnSetMenuSB\n");
1196 IShellBrowser_SetMenuSB(This
->pShellBrowser
, This
->hMenu
, 0, This
->hWnd
);
1199 This
->uState
= uState
;
1204 /**********************************************************
1205 * ShellView_OnSetFocus()
1208 static LRESULT
ShellView_OnSetFocus(IShellViewImpl
* This
)
1212 /* Tell the browser one of our windows has received the focus. This
1213 should always be done before merging menus (OnActivate merges the
1214 menus) if one of our windows has the focus.*/
1216 IShellBrowser_OnViewWindowActive(This
->pShellBrowser
,(IShellView
*) This
);
1217 ShellView_OnActivate(This
, SVUIA_ACTIVATE_FOCUS
);
1219 /* Set the focus to the listview */
1220 SetFocus(This
->hWndList
);
1222 /* Notify the ICommDlgBrowser interface */
1223 OnStateChange(This
,CDBOSC_SETFOCUS
);
1228 /**********************************************************
1229 * ShellView_OnKillFocus()
1231 static LRESULT
ShellView_OnKillFocus(IShellViewImpl
* This
)
1233 TRACE("(%p) stub\n",This
);
1235 ShellView_OnActivate(This
, SVUIA_ACTIVATE_NOFOCUS
);
1236 /* Notify the ICommDlgBrowser */
1237 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1242 /**********************************************************
1243 * ShellView_OnCommand()
1246 * the CmdIDs are the ones from the context menu
1248 static LRESULT
ShellView_OnCommand(IShellViewImpl
* This
,DWORD dwCmdID
, DWORD dwCmd
, HWND hwndCmd
)
1250 TRACE("(%p)->(0x%08x 0x%08x %p) stub\n",This
, dwCmdID
, dwCmd
, hwndCmd
);
1254 case FCIDM_SHVIEW_SMALLICON
:
1255 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
1256 SetStyle (This
, LVS_SMALLICON
, LVS_TYPEMASK
);
1260 case FCIDM_SHVIEW_BIGICON
:
1261 This
->FolderSettings
.ViewMode
= FVM_ICON
;
1262 SetStyle (This
, LVS_ICON
, LVS_TYPEMASK
);
1266 case FCIDM_SHVIEW_LISTVIEW
:
1267 This
->FolderSettings
.ViewMode
= FVM_LIST
;
1268 SetStyle (This
, LVS_LIST
, LVS_TYPEMASK
);
1272 case FCIDM_SHVIEW_REPORTVIEW
:
1273 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
1274 SetStyle (This
, LVS_REPORT
, LVS_TYPEMASK
);
1278 /* the menu IDs for sorting are 0x30... see shell32.rc */
1283 This
->ListViewSortInfo
.nHeaderID
= dwCmdID
- 0x30;
1284 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1285 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1286 SendMessageW(This
->hWndList
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1290 TRACE("-- COMMAND 0x%04x unhandled\n", dwCmdID
);
1295 /**********************************************************
1296 * ShellView_OnNotify()
1299 static LRESULT
ShellView_OnNotify(IShellViewImpl
* This
, UINT CtlID
, LPNMHDR lpnmh
)
1300 { LPNMLISTVIEW lpnmlv
= (LPNMLISTVIEW
)lpnmh
;
1301 NMLVDISPINFOW
*lpdi
= (NMLVDISPINFOW
*)lpnmh
;
1304 TRACE("%p CtlID=%u lpnmh->code=%x\n",This
,CtlID
,lpnmh
->code
);
1309 TRACE("-- NM_SETFOCUS %p\n",This
);
1310 ShellView_OnSetFocus(This
);
1314 TRACE("-- NM_KILLFOCUS %p\n",This
);
1315 ShellView_OnDeactivate(This
);
1316 /* Notify the ICommDlgBrowser interface */
1317 OnStateChange(This
,CDBOSC_KILLFOCUS
);
1321 TRACE("-- NM_CUSTOMDRAW %p\n",This
);
1322 return CDRF_DODEFAULT
;
1324 case NM_RELEASEDCAPTURE
:
1325 TRACE("-- NM_RELEASEDCAPTURE %p\n",This
);
1329 TRACE("-- NM_CLICK %p\n",This
);
1333 TRACE("-- NM_RCLICK %p\n",This
);
1337 TRACE("-- NM_DBLCLK %p\n",This
);
1338 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1342 TRACE("-- NM_RETURN %p\n",This
);
1343 if (OnDefaultCommand(This
) != S_OK
) ShellView_OpenSelectedItems(This
);
1347 TRACE("-- HDN_ENDTRACKW %p\n",This
);
1348 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1349 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1352 case LVN_DELETEITEM
:
1353 TRACE("-- LVN_DELETEITEM %p\n",This
);
1354 SHFree((LPITEMIDLIST
)lpnmlv
->lParam
); /*delete the pidl because we made a copy of it*/
1357 case LVN_DELETEALLITEMS
:
1358 TRACE("-- LVN_DELETEALLITEMS %p\n",This
);
1361 case LVN_INSERTITEM
:
1362 TRACE("-- LVN_INSERTITEM (STUB)%p\n",This
);
1365 case LVN_ITEMACTIVATE
:
1366 TRACE("-- LVN_ITEMACTIVATE %p\n",This
);
1367 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1370 case LVN_COLUMNCLICK
:
1371 This
->ListViewSortInfo
.nHeaderID
= lpnmlv
->iSubItem
;
1372 if(This
->ListViewSortInfo
.nLastHeaderID
== This
->ListViewSortInfo
.nHeaderID
)
1374 This
->ListViewSortInfo
.bIsAscending
= !This
->ListViewSortInfo
.bIsAscending
;
1378 This
->ListViewSortInfo
.bIsAscending
= TRUE
;
1380 This
->ListViewSortInfo
.nLastHeaderID
= This
->ListViewSortInfo
.nHeaderID
;
1382 SendMessageW(lpnmlv
->hdr
.hwndFrom
, LVM_SORTITEMS
, (WPARAM
) &This
->ListViewSortInfo
, (LPARAM
)ShellView_ListViewCompareItems
);
1385 case LVN_GETDISPINFOA
:
1386 case LVN_GETDISPINFOW
:
1387 TRACE("-- LVN_GETDISPINFO %p\n",This
);
1388 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1390 if(lpdi
->item
.mask
& LVIF_TEXT
) /* text requested */
1392 static WCHAR emptyW
[] = { 0 };
1396 if (This
->pSF2Parent
)
1398 hr
= IShellFolder2_GetDetailsOf(This
->pSF2Parent
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1402 IShellDetails
*details
;
1404 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IShellDetails
, (void**)&details
);
1407 hr
= IShellDetails_GetDetailsOf(details
, pidl
, lpdi
->item
.iSubItem
, &sd
);
1408 IShellDetails_Release(details
);
1411 WARN("IShellFolder2/IShellDetails not supported\n");
1416 /* set to empty on failure */
1417 sd
.str
.uType
= STRRET_WSTR
;
1418 sd
.str
.u
.pOleStr
= emptyW
;
1421 if (lpnmh
->code
== LVN_GETDISPINFOW
)
1423 StrRetToStrNW( lpdi
->item
.pszText
, lpdi
->item
.cchTextMax
, &sd
.str
, NULL
);
1424 TRACE("-- text=%s\n", debugstr_w(lpdi
->item
.pszText
));
1428 /* LVN_GETDISPINFOA - shouldn't happen */
1429 NMLVDISPINFOA
*lpdiA
= (NMLVDISPINFOA
*)lpnmh
;
1430 StrRetToStrNA( lpdiA
->item
.pszText
, lpdiA
->item
.cchTextMax
, &sd
.str
, NULL
);
1431 TRACE("-- text=%s\n", lpdiA
->item
.pszText
);
1435 if(lpdi
->item
.mask
& LVIF_IMAGE
) /* image requested */
1437 lpdi
->item
.iImage
= SHMapPIDLToSystemImageListIndex(This
->pSFParent
, pidl
, 0);
1441 case LVN_ITEMCHANGED
:
1442 TRACE("-- LVN_ITEMCHANGED %p\n",This
);
1443 OnStateChange(This
, CDBOSC_SELCHANGE
); /* the browser will get the IDataObject now */
1447 case LVN_BEGINRDRAG
:
1448 TRACE("-- LVN_BEGINDRAG\n");
1450 if (ShellView_GetSelections(This
))
1453 DWORD dwAttributes
= SFGAO_CANLINK
;
1454 DWORD dwEffect
= DROPEFFECT_COPY
| DROPEFFECT_MOVE
;
1456 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &IID_IDataObject
,0,(LPVOID
*)&pda
)))
1458 IDropSource
*pds
= &This
->IDropSource_iface
; /* own DropSource interface */
1460 if (SUCCEEDED(IShellFolder_GetAttributesOf(This
->pSFParent
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, &dwAttributes
)))
1462 if (dwAttributes
& SFGAO_CANLINK
)
1464 dwEffect
|= DROPEFFECT_LINK
;
1471 DoDragDrop(pda
, pds
, dwEffect
, &dwEffect2
);
1473 IDataObject_Release(pda
);
1478 case LVN_BEGINLABELEDITW
:
1480 DWORD dwAttr
= SFGAO_CANRENAME
;
1481 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1483 TRACE("-- LVN_BEGINLABELEDITW %p\n",This
);
1485 IShellFolder_GetAttributesOf(This
->pSFParent
, 1, (LPCITEMIDLIST
*)&pidl
, &dwAttr
);
1486 if (SFGAO_CANRENAME
& dwAttr
)
1493 case LVN_ENDLABELEDITW
:
1495 TRACE("-- LVN_ENDLABELEDITA %p\n",This
);
1496 if (lpdi
->item
.pszText
)
1501 lvItem
.iItem
= lpdi
->item
.iItem
;
1502 lvItem
.iSubItem
= 0;
1503 lvItem
.mask
= LVIF_PARAM
;
1504 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
1506 pidl
= (LPITEMIDLIST
)lpdi
->item
.lParam
;
1507 hr
= IShellFolder_SetNameOf(This
->pSFParent
, 0, pidl
, lpdi
->item
.pszText
, SHGDN_INFOLDER
, &pidl
);
1509 if(SUCCEEDED(hr
) && pidl
)
1511 lvItem
.mask
= LVIF_PARAM
;
1512 lvItem
.lParam
= (LPARAM
)pidl
;
1513 SendMessageW(This
->hWndList
, LVM_SETITEMW
, 0, (LPARAM
) &lvItem
);
1522 LPNMLVKEYDOWN plvKeyDown
= (LPNMLVKEYDOWN
) lpnmh
;
1524 /* initiate a rename of the selected file or directory */
1525 switch (plvKeyDown
->wVKey
)
1529 INT i
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0);
1533 /* get selected item */
1534 i
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, MAKELPARAM (LVNI_SELECTED
, 0));
1536 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, i
, 0);
1537 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, i
, 0);
1546 LPITEMIDLIST
* pItems
;
1550 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_ISFHelper
, (void**)&psfhlp
);
1551 if (hr
!= S_OK
) return 0;
1553 if(!(count
= SendMessageW(This
->hWndList
, LVM_GETSELECTEDCOUNT
, 0, 0)))
1555 ISFHelper_Release(psfhlp
);
1559 /* allocate memory for the pidl array */
1560 pItems
= HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST
) * count
);
1562 /* retrieve all selected items */
1568 /* get selected item */
1569 item_index
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, item_index
,
1570 MAKELPARAM (LVNI_SELECTED
, 0));
1571 item
.iItem
= item_index
;
1572 item
.mask
= LVIF_PARAM
;
1573 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
);
1576 pItems
[i
] = (LPITEMIDLIST
)item
.lParam
;
1581 /* perform the item deletion */
1582 ISFHelper_DeleteItems(psfhlp
, i
, (LPCITEMIDLIST
*)pItems
);
1583 ISFHelper_Release(psfhlp
);
1585 /* free pidl array memory */
1586 HeapFree(GetProcessHeap(), 0, pItems
);
1591 /* Initiate a refresh */
1592 IShellView_Refresh((IShellView
*)This
);
1597 LPSHELLBROWSER lpSb
;
1598 if((lpSb
= (LPSHELLBROWSER
)SendMessageW(This
->hWndParent
, CWM_GETISHELLBROWSER
, 0, 0)))
1600 IShellBrowser_BrowseObject(lpSb
, NULL
, SBSP_PARENT
);
1606 FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown
->wVKey
);
1612 TRACE("-- %p WM_COMMAND %x unhandled\n", This
, lpnmh
->code
);
1618 /**********************************************************
1619 * ShellView_OnChange()
1622 static LRESULT
ShellView_OnChange(IShellViewImpl
* This
, const LPCITEMIDLIST
*pidls
, LONG event
)
1626 TRACE("(%p)->(%p, %p, 0x%08x)\n", This
, pidls
[0], pidls
[1], event
);
1632 LV_AddItem(This
, pidls
[0]);
1637 INT i
= LV_FindItemByPidl(This
, ILFindLastID(pidls
[0]));
1638 ret
= SendMessageW(This
->hWndList
, LVM_DELETEITEM
, i
, 0);
1641 case SHCNE_RENAMEFOLDER
:
1642 case SHCNE_RENAMEITEM
:
1643 LV_RenameItem(This
, pidls
[0], pidls
[1]);
1645 case SHCNE_UPDATEITEM
:
1650 /**********************************************************
1654 static LRESULT CALLBACK
ShellView_WndProc(HWND hWnd
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
1656 IShellViewImpl
* pThis
= (IShellViewImpl
*)GetWindowLongPtrW(hWnd
, GWLP_USERDATA
);
1657 LPCREATESTRUCTW lpcs
;
1659 TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd
, uMessage
, wParam
, lParam
);
1664 lpcs
= (LPCREATESTRUCTW
)lParam
;
1665 pThis
= lpcs
->lpCreateParams
;
1666 SetWindowLongPtrW(hWnd
, GWLP_USERDATA
, (ULONG_PTR
)pThis
);
1667 pThis
->hWnd
= hWnd
; /*set the window handle*/
1670 case WM_SIZE
: return ShellView_OnSize(pThis
,LOWORD(lParam
), HIWORD(lParam
));
1671 case WM_SETFOCUS
: return ShellView_OnSetFocus(pThis
);
1672 case WM_KILLFOCUS
: return ShellView_OnKillFocus(pThis
);
1673 case WM_CREATE
: return ShellView_OnCreate(pThis
);
1674 case WM_ACTIVATE
: return ShellView_OnActivate(pThis
, SVUIA_ACTIVATE_FOCUS
);
1675 case WM_NOTIFY
: return ShellView_OnNotify(pThis
,(UINT
)wParam
, (LPNMHDR
)lParam
);
1676 case WM_COMMAND
: return ShellView_OnCommand(pThis
,
1677 GET_WM_COMMAND_ID(wParam
, lParam
),
1678 GET_WM_COMMAND_CMD(wParam
, lParam
),
1679 GET_WM_COMMAND_HWND(wParam
, lParam
));
1680 case SHV_CHANGE_NOTIFY
: return ShellView_OnChange(pThis
, (const LPCITEMIDLIST
*)wParam
, (LONG
)lParam
);
1682 case WM_CONTEXTMENU
: ShellView_DoContextMenu(pThis
, LOWORD(lParam
), HIWORD(lParam
), FALSE
);
1685 case WM_SHOWWINDOW
: UpdateWindow(pThis
->hWndList
);
1688 case WM_GETDLGCODE
: return SendMessageW(pThis
->hWndList
, uMessage
, 0, 0);
1689 case WM_SETFONT
: return SendMessageW(pThis
->hWndList
, WM_SETFONT
, wParam
, lParam
);
1690 case WM_GETFONT
: return SendMessageW(pThis
->hWndList
, WM_GETFONT
, wParam
, lParam
);
1693 RevokeDragDrop(pThis
->hWnd
);
1694 SHChangeNotifyDeregister(pThis
->hNotify
);
1698 if ((pThis
->FolderSettings
.fFlags
& FWF_DESKTOP
) ||
1699 (pThis
->FolderSettings
.fFlags
& FWF_TRANSPARENT
))
1704 return DefWindowProcW(hWnd
, uMessage
, wParam
, lParam
);
1706 /**********************************************************
1709 * The INTERFACE of the IShellView object
1712 **********************************************************
1713 * IShellView_QueryInterface
1715 static HRESULT WINAPI
IShellView_fnQueryInterface(IShellView3
*iface
, REFIID riid
, void **ppvObj
)
1717 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1719 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppvObj
);
1723 if(IsEqualIID(riid
, &IID_IUnknown
) ||
1724 IsEqualIID(riid
, &IID_IShellView
) ||
1725 IsEqualIID(riid
, &IID_IShellView2
) ||
1726 IsEqualIID(riid
, &IID_IShellView3
))
1728 *ppvObj
= &This
->IShellView3_iface
;
1730 else if(IsEqualIID(riid
, &IID_IShellFolderView
))
1732 *ppvObj
= &This
->IShellFolderView_iface
;
1734 else if(IsEqualIID(riid
, &IID_IFolderView
) ||
1735 IsEqualIID(riid
, &IID_IFolderView2
))
1737 *ppvObj
= &This
->IFolderView2_iface
;
1739 else if(IsEqualIID(riid
, &IID_IOleCommandTarget
))
1741 *ppvObj
= &This
->IOleCommandTarget_iface
;
1743 else if(IsEqualIID(riid
, &IID_IDropTarget
))
1745 *ppvObj
= &This
->IDropTarget_iface
;
1747 else if(IsEqualIID(riid
, &IID_IDropSource
))
1749 *ppvObj
= &This
->IDropSource_iface
;
1751 else if(IsEqualIID(riid
, &IID_IViewObject
))
1753 *ppvObj
= &This
->IViewObject_iface
;
1758 IUnknown_AddRef( (IUnknown
*)*ppvObj
);
1759 TRACE("-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
1762 TRACE("-- Interface: E_NOINTERFACE\n");
1763 return E_NOINTERFACE
;
1766 /**********************************************************
1769 static ULONG WINAPI
IShellView_fnAddRef(IShellView3
*iface
)
1771 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1772 ULONG refCount
= InterlockedIncrement(&This
->ref
);
1774 TRACE("(%p)->(count=%u)\n", This
, refCount
- 1);
1778 /**********************************************************
1779 * IShellView_Release
1781 static ULONG WINAPI
IShellView_fnRelease(IShellView3
*iface
)
1783 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1784 ULONG refCount
= InterlockedDecrement(&This
->ref
);
1786 TRACE("(%p)->(count=%i)\n", This
, refCount
+ 1);
1790 TRACE(" destroying IShellView(%p)\n",This
);
1792 DestroyWindow(This
->hWndList
);
1795 IShellFolder_Release(This
->pSFParent
);
1797 if(This
->pSF2Parent
)
1798 IShellFolder2_Release(This
->pSF2Parent
);
1800 SHFree(This
->apidl
);
1803 IAdviseSink_Release(This
->pAdvSink
);
1805 HeapFree(GetProcessHeap(),0,This
);
1810 /**********************************************************
1811 * ShellView_GetWindow
1813 static HRESULT WINAPI
IShellView_fnGetWindow(IShellView3
*iface
, HWND
*phWnd
)
1815 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1817 TRACE("(%p)\n", This
);
1819 *phWnd
= This
->hWnd
;
1823 static HRESULT WINAPI
IShellView_fnContextSensitiveHelp(IShellView3
*iface
, BOOL mode
)
1825 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1826 TRACE("(%p)->(%d)\n", This
, mode
);
1830 /**********************************************************
1831 * IShellView_TranslateAccelerator
1834 * use the accel functions
1836 static HRESULT WINAPI
IShellView_fnTranslateAccelerator(IShellView3
*iface
, MSG
*lpmsg
)
1839 IShellViewImpl
*This
= (IShellViewImpl
*)iface
;
1841 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%x wp=%x) stub\n",This
,lpmsg
, lpmsg
->hwnd
, lpmsg
->message
, lpmsg
->lParam
, lpmsg
->wParam
);
1844 if ((lpmsg
->message
>=WM_KEYFIRST
) && (lpmsg
->message
>=WM_KEYLAST
))
1846 TRACE("-- key=0x04%lx\n",lpmsg
->wParam
) ;
1848 return S_FALSE
; /* not handled */
1851 static HRESULT WINAPI
IShellView_fnEnableModeless(IShellView3
*iface
, BOOL fEnable
)
1853 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1855 FIXME("(%p) stub\n", This
);
1860 static HRESULT WINAPI
IShellView_fnUIActivate(IShellView3
*iface
, UINT uState
)
1862 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1865 CHAR szName[MAX_PATH];
1868 int nPartArray
[1] = {-1};
1870 TRACE("(%p)->(state=%x) stub\n",This
, uState
);
1872 /*don't do anything if the state isn't really changing*/
1873 if(This
->uState
== uState
)
1878 /*OnActivate handles the menu merging and internal state*/
1879 ShellView_OnActivate(This
, uState
);
1881 /*only do This if we are active*/
1882 if(uState
!= SVUIA_DEACTIVATE
)
1886 GetFolderPath is not a method of IShellFolder
1887 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1889 /* set the number of parts */
1890 IShellBrowser_SendControlMsg(This
->pShellBrowser
, FCW_STATUS
, SB_SETPARTS
, 1,
1891 (LPARAM
)nPartArray
, &lResult
);
1893 /* set the text for the parts */
1895 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1896 0, (LPARAM)szName, &lResult);
1903 static HRESULT WINAPI
IShellView_fnRefresh(IShellView3
*iface
)
1905 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1907 TRACE("(%p)\n", This
);
1909 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
1910 ShellView_FillList(This
);
1915 static HRESULT WINAPI
IShellView_fnCreateViewWindow(IShellView3
*iface
, IShellView
*prev_view
,
1916 const FOLDERSETTINGS
*settings
, IShellBrowser
*owner
, RECT
*rect
, HWND
*hWnd
)
1918 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1919 TRACE("(%p)->(%p %p %p %p %p)\n", This
, prev_view
, settings
, owner
, rect
, hWnd
);
1920 return IShellView3_CreateViewWindow3(iface
, owner
, prev_view
, SV3CVW3_DEFAULT
,
1921 settings
->fFlags
, settings
->fFlags
, settings
->ViewMode
, NULL
, rect
, hWnd
);
1924 static HRESULT WINAPI
IShellView_fnDestroyViewWindow(IShellView3
*iface
)
1926 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1928 TRACE("(%p)\n", This
);
1933 /* Make absolutely sure all our UI is cleaned up. */
1934 IShellView3_UIActivate(iface
, SVUIA_DEACTIVATE
);
1937 DestroyMenu(This
->hMenu
);
1939 DestroyWindow(This
->hWnd
);
1940 if (This
->pShellBrowser
) IShellBrowser_Release(This
->pShellBrowser
);
1941 if (This
->pCommDlgBrowser
) ICommDlgBrowser_Release(This
->pCommDlgBrowser
);
1945 This
->pShellBrowser
= NULL
;
1946 This
->pCommDlgBrowser
= NULL
;
1951 static HRESULT WINAPI
IShellView_fnGetCurrentInfo(IShellView3
*iface
, LPFOLDERSETTINGS lpfs
)
1953 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1955 TRACE("(%p)->(%p) vmode=%x flags=%x\n", This
, lpfs
,
1956 This
->FolderSettings
.ViewMode
, This
->FolderSettings
.fFlags
);
1958 if (!lpfs
) return E_INVALIDARG
;
1959 *lpfs
= This
->FolderSettings
;
1963 static HRESULT WINAPI
IShellView_fnAddPropertySheetPages(IShellView3
*iface
, DWORD dwReserved
,
1964 LPFNADDPROPSHEETPAGE lpfn
, LPARAM lparam
)
1966 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1967 FIXME("(%p) stub\n", This
);
1971 static HRESULT WINAPI
IShellView_fnSaveViewState(IShellView3
*iface
)
1973 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1974 FIXME("(%p) stub\n", This
);
1978 static HRESULT WINAPI
IShellView_fnSelectItem(IShellView3
*iface
, LPCITEMIDLIST pidl
, UINT flags
)
1980 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1983 TRACE("(%p)->(pidl=%p, 0x%08x)\n",This
, pidl
, flags
);
1985 i
= LV_FindItemByPidl(This
, pidl
);
1986 if (i
== -1) return S_OK
;
1988 return IFolderView2_SelectItem(&This
->IFolderView2_iface
, i
, flags
);
1991 static HRESULT WINAPI
IShellView_fnGetItemObject(IShellView3
*iface
, UINT uItem
, REFIID riid
,
1994 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
1995 HRESULT hr
= E_NOINTERFACE
;
1997 TRACE("(%p)->(0x%08x, %s, %p)\n",This
, uItem
, debugstr_guid(riid
), ppvOut
);
2003 case SVGIO_BACKGROUND
:
2005 if (IsEqualIID(&IID_IContextMenu
, riid
))
2006 return BackgroundMenu_Constructor(This
->pSFParent
, FALSE
, riid
, ppvOut
);
2007 else if (IsEqualIID(&IID_IDispatch
, riid
)) {
2008 *ppvOut
= &This
->IShellFolderViewDual3_iface
;
2009 IShellFolderViewDual3_AddRef(&This
->IShellFolderViewDual3_iface
);
2013 FIXME("unsupported interface requested %s\n", debugstr_guid(riid
));
2017 case SVGIO_SELECTION
:
2018 ShellView_GetSelections(This
);
2019 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWnd
, This
->cidl
, (LPCITEMIDLIST
*)This
->apidl
, riid
, 0, ppvOut
);
2023 FIXME("unimplemented for uItem = 0x%08x\n", uItem
);
2025 TRACE("-- (%p)->(interface=%p)\n",This
, *ppvOut
);
2030 static HRESULT WINAPI
IShellView2_fnGetView(IShellView3
*iface
, SHELLVIEWID
*view_guid
, ULONG view_type
)
2032 FIXME("(%p)->(%s, %#x) stub!\n", iface
, debugstr_guid(view_guid
), view_type
);
2036 static HRESULT WINAPI
IShellView2_fnCreateViewWindow2(IShellView3
*iface
, SV2CVW2_PARAMS
*view_params
)
2038 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2039 TRACE("(%p)->(%p)\n", This
, view_params
);
2040 return IShellView3_CreateViewWindow3(iface
, view_params
->psbOwner
, view_params
->psvPrev
,
2041 SV3CVW3_DEFAULT
, view_params
->pfs
->fFlags
, view_params
->pfs
->fFlags
,
2042 view_params
->pfs
->ViewMode
, view_params
->pvid
, view_params
->prcView
, &view_params
->hwndView
);
2045 static HRESULT WINAPI
IShellView2_fnHandleRename(IShellView3
*iface
, LPCITEMIDLIST new_pidl
)
2047 FIXME("(%p)->(new_pidl %p) stub!\n", iface
, new_pidl
);
2051 static HRESULT WINAPI
IShellView2_fnSelectAndPositionItem(IShellView3
*iface
, LPCITEMIDLIST item
,
2052 UINT flags
, POINT
*point
)
2054 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2055 TRACE("(%p)->(item %p, flags %#x, point %p)\n", This
, item
, flags
, point
);
2056 return IFolderView2_SelectAndPositionItems(&This
->IFolderView2_iface
, 1, &item
, point
, flags
);
2059 static HRESULT WINAPI
IShellView3_fnCreateViewWindow3(IShellView3
*iface
, IShellBrowser
*owner
,
2060 IShellView
*prev_view
, SV3CVW3_FLAGS view_flags
, FOLDERFLAGS mask
, FOLDERFLAGS flags
,
2061 FOLDERVIEWMODE mode
, const SHELLVIEWID
*view_id
, const RECT
*rect
, HWND
*hwnd
)
2063 IShellViewImpl
*This
= impl_from_IShellView3(iface
);
2064 INITCOMMONCONTROLSEX icex
;
2069 TRACE("(%p)->(%p %p 0x%08x 0x%08x 0x%08x %d %s %s %p)\n", This
, owner
, prev_view
, view_flags
,
2070 mask
, flags
, mode
, debugstr_guid(view_id
), wine_dbgstr_rect(rect
), hwnd
);
2072 icex
.dwSize
= sizeof(icex
);
2073 icex
.dwICC
= ICC_LISTVIEW_CLASSES
;
2074 InitCommonControlsEx(&icex
);
2078 if (!owner
|| This
->hWnd
)
2079 return E_UNEXPECTED
;
2081 if (view_flags
!= SV3CVW3_DEFAULT
)
2082 FIXME("unsupported view flags 0x%08x\n", view_flags
);
2084 /* Set up the member variables */
2085 This
->pShellBrowser
= owner
;
2086 This
->FolderSettings
.ViewMode
= mode
;
2087 This
->FolderSettings
.fFlags
= mask
& flags
;
2091 if (IsEqualGUID(view_id
, &VID_LargeIcons
))
2092 This
->FolderSettings
.ViewMode
= FVM_ICON
;
2093 else if (IsEqualGUID(view_id
, &VID_SmallIcons
))
2094 This
->FolderSettings
.ViewMode
= FVM_SMALLICON
;
2095 else if (IsEqualGUID(view_id
, &VID_List
))
2096 This
->FolderSettings
.ViewMode
= FVM_LIST
;
2097 else if (IsEqualGUID(view_id
, &VID_Details
))
2098 This
->FolderSettings
.ViewMode
= FVM_DETAILS
;
2099 else if (IsEqualGUID(view_id
, &VID_Thumbnails
))
2100 This
->FolderSettings
.ViewMode
= FVM_THUMBNAIL
;
2101 else if (IsEqualGUID(view_id
, &VID_Tile
))
2102 This
->FolderSettings
.ViewMode
= FVM_TILE
;
2103 else if (IsEqualGUID(view_id
, &VID_ThumbStrip
))
2104 This
->FolderSettings
.ViewMode
= FVM_THUMBSTRIP
;
2106 FIXME("Ignoring unrecognized VID %s\n", debugstr_guid(view_id
));
2109 /* Get our parent window */
2110 IShellBrowser_AddRef(This
->pShellBrowser
);
2111 IShellBrowser_GetWindow(This
->pShellBrowser
, &This
->hWndParent
);
2113 /* Try to get the ICommDlgBrowserInterface, adds a reference !!! */
2114 This
->pCommDlgBrowser
= NULL
;
2115 hr
= IShellBrowser_QueryInterface(This
->pShellBrowser
, &IID_ICommDlgBrowser
, (void **)&This
->pCommDlgBrowser
);
2117 TRACE("-- CommDlgBrowser %p\n", This
->pCommDlgBrowser
);
2119 /* If our window class has not been registered, then do so */
2120 if (!GetClassInfoW(shell32_hInstance
, SV_CLASS_NAME
, &wc
))
2122 wc
.style
= CS_HREDRAW
| CS_VREDRAW
;
2123 wc
.lpfnWndProc
= ShellView_WndProc
;
2126 wc
.hInstance
= shell32_hInstance
;
2128 wc
.hCursor
= LoadCursorW(0, (LPWSTR
)IDC_ARROW
);
2129 wc
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
2130 wc
.lpszMenuName
= NULL
;
2131 wc
.lpszClassName
= SV_CLASS_NAME
;
2133 if (!RegisterClassW(&wc
)) return E_FAIL
;
2136 wnd
= CreateWindowExW(0, SV_CLASS_NAME
, NULL
, WS_CHILD
| WS_TABSTOP
,
2137 rect
->left
, rect
->top
,
2138 rect
->right
- rect
->left
,
2139 rect
->bottom
- rect
->top
,
2140 This
->hWndParent
, 0, shell32_hInstance
, This
);
2146 IShellBrowser_Release(This
->pShellBrowser
);
2150 SetWindowPos(wnd
, HWND_TOP
, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
| SWP_SHOWWINDOW
);
2158 static const IShellView3Vtbl shellviewvtbl
=
2160 IShellView_fnQueryInterface
,
2161 IShellView_fnAddRef
,
2162 IShellView_fnRelease
,
2163 IShellView_fnGetWindow
,
2164 IShellView_fnContextSensitiveHelp
,
2165 IShellView_fnTranslateAccelerator
,
2166 IShellView_fnEnableModeless
,
2167 IShellView_fnUIActivate
,
2168 IShellView_fnRefresh
,
2169 IShellView_fnCreateViewWindow
,
2170 IShellView_fnDestroyViewWindow
,
2171 IShellView_fnGetCurrentInfo
,
2172 IShellView_fnAddPropertySheetPages
,
2173 IShellView_fnSaveViewState
,
2174 IShellView_fnSelectItem
,
2175 IShellView_fnGetItemObject
,
2176 IShellView2_fnGetView
,
2177 IShellView2_fnCreateViewWindow2
,
2178 IShellView2_fnHandleRename
,
2179 IShellView2_fnSelectAndPositionItem
,
2180 IShellView3_fnCreateViewWindow3
2184 /**********************************************************
2185 * ISVOleCmdTarget_QueryInterface (IUnknown)
2187 static HRESULT WINAPI
ISVOleCmdTarget_QueryInterface(IOleCommandTarget
*iface
, REFIID iid
, void **ppvObj
)
2189 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2190 return IShellView3_QueryInterface(&This
->IShellView3_iface
, iid
, ppvObj
);
2193 /**********************************************************
2194 * ISVOleCmdTarget_AddRef (IUnknown)
2196 static ULONG WINAPI
ISVOleCmdTarget_AddRef(IOleCommandTarget
*iface
)
2198 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2199 return IShellView3_AddRef(&This
->IShellView3_iface
);
2202 /**********************************************************
2203 * ISVOleCmdTarget_Release (IUnknown)
2205 static ULONG WINAPI
ISVOleCmdTarget_Release(IOleCommandTarget
*iface
)
2207 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2208 return IShellView3_Release(&This
->IShellView3_iface
);
2211 /**********************************************************
2212 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
2214 static HRESULT WINAPI
ISVOleCmdTarget_QueryStatus(
2215 IOleCommandTarget
*iface
,
2216 const GUID
*pguidCmdGroup
,
2219 OLECMDTEXT
*pCmdText
)
2221 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2224 FIXME("(%p)->(%s %d %p %p)\n",
2225 This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
, pCmdText
);
2228 return E_INVALIDARG
;
2229 for (i
= 0; i
< cCmds
; i
++)
2231 FIXME("\tprgCmds[%d].cmdID = %d\n", i
, prgCmds
[i
].cmdID
);
2232 prgCmds
[i
].cmdf
= 0;
2234 return OLECMDERR_E_UNKNOWNGROUP
;
2237 /**********************************************************
2238 * ISVOleCmdTarget_Exec (IOleCommandTarget)
2240 * nCmdID is the OLECMDID_* enumeration
2242 static HRESULT WINAPI
ISVOleCmdTarget_Exec(
2243 IOleCommandTarget
*iface
,
2244 const GUID
* pguidCmdGroup
,
2250 IShellViewImpl
*This
= impl_from_IOleCommandTarget(iface
);
2252 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
2253 This
, debugstr_guid(pguidCmdGroup
), nCmdID
, nCmdexecopt
, pvaIn
, pvaOut
);
2256 return OLECMDERR_E_UNKNOWNGROUP
;
2257 if (IsEqualIID(pguidCmdGroup
, &CGID_Explorer
) &&
2259 (nCmdexecopt
== 4) && pvaOut
)
2261 if (IsEqualIID(pguidCmdGroup
, &CGID_ShellDocView
) &&
2266 return OLECMDERR_E_UNKNOWNGROUP
;
2269 static const IOleCommandTargetVtbl olecommandtargetvtbl
=
2271 ISVOleCmdTarget_QueryInterface
,
2272 ISVOleCmdTarget_AddRef
,
2273 ISVOleCmdTarget_Release
,
2274 ISVOleCmdTarget_QueryStatus
,
2275 ISVOleCmdTarget_Exec
2278 /**********************************************************
2279 * ISVDropTarget implementation
2282 static HRESULT WINAPI
ISVDropTarget_QueryInterface(IDropTarget
*iface
, REFIID riid
, void **ppvObj
)
2284 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2285 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2288 static ULONG WINAPI
ISVDropTarget_AddRef(IDropTarget
*iface
)
2290 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2291 return IShellView3_AddRef(&This
->IShellView3_iface
);
2294 static ULONG WINAPI
ISVDropTarget_Release(IDropTarget
*iface
)
2296 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2297 return IShellView3_Release(&This
->IShellView3_iface
);
2300 /******************************************************************************
2301 * drag_notify_subitem [Internal]
2303 * Figure out the shellfolder object, which is currently under the mouse cursor
2304 * and notify it via the IDropTarget interface.
2307 #define SCROLLAREAWIDTH 20
2309 static HRESULT
drag_notify_subitem(IShellViewImpl
*This
, DWORD grfKeyState
, POINTL pt
,
2312 LVHITTESTINFO htinfo
;
2318 /* Map from global to client coordinates and query the index of the listview-item, which is
2319 * currently under the mouse cursor. */
2322 htinfo
.flags
= LVHT_ONITEM
;
2323 ScreenToClient(This
->hWndList
, &htinfo
.pt
);
2324 lResult
= SendMessageW(This
->hWndList
, LVM_HITTEST
, 0, (LPARAM
)&htinfo
);
2326 /* Send WM_*SCROLL messages every 250 ms during drag-scrolling */
2327 GetClientRect(This
->hWndList
, &clientRect
);
2328 if (htinfo
.pt
.x
== This
->ptLastMousePos
.x
&& htinfo
.pt
.y
== This
->ptLastMousePos
.y
&&
2329 (htinfo
.pt
.x
< SCROLLAREAWIDTH
|| htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
||
2330 htinfo
.pt
.y
< SCROLLAREAWIDTH
|| htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
))
2332 This
->cScrollDelay
= (This
->cScrollDelay
+ 1) % 5; /* DragOver is called every 50 ms */
2333 if (This
->cScrollDelay
== 0) { /* Mouse did hover another 250 ms over the scroll-area */
2334 if (htinfo
.pt
.x
< SCROLLAREAWIDTH
)
2335 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEUP
, 0);
2336 if (htinfo
.pt
.x
> clientRect
.right
- SCROLLAREAWIDTH
)
2337 SendMessageW(This
->hWndList
, WM_HSCROLL
, SB_LINEDOWN
, 0);
2338 if (htinfo
.pt
.y
< SCROLLAREAWIDTH
)
2339 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEUP
, 0);
2340 if (htinfo
.pt
.y
> clientRect
.bottom
- SCROLLAREAWIDTH
)
2341 SendMessageW(This
->hWndList
, WM_VSCROLL
, SB_LINEDOWN
, 0);
2344 This
->cScrollDelay
= 0; /* Reset, if the cursor is not over the listview's scroll-area */
2346 This
->ptLastMousePos
= htinfo
.pt
;
2348 /* If we are still over the previous sub-item, notify it via DragOver and return. */
2349 if (This
->pCurDropTarget
&& lResult
== This
->iDragOverItem
)
2350 return IDropTarget_DragOver(This
->pCurDropTarget
, grfKeyState
, pt
, pdwEffect
);
2352 /* We've left the previous sub-item, notify it via DragLeave and Release it. */
2353 if (This
->pCurDropTarget
) {
2354 IDropTarget_DragLeave(This
->pCurDropTarget
);
2355 IDropTarget_Release(This
->pCurDropTarget
);
2356 This
->pCurDropTarget
= NULL
;
2359 This
->iDragOverItem
= lResult
;
2360 if (lResult
== -1) {
2361 /* We are not above one of the listview's subitems. Bind to the parent folder's
2362 * DropTarget interface. */
2363 hr
= IShellFolder_QueryInterface(This
->pSFParent
, &IID_IDropTarget
,
2364 (LPVOID
*)&This
->pCurDropTarget
);
2366 /* Query the relative PIDL of the shellfolder object represented by the currently
2367 * dragged over listview-item ... */
2368 lvItem
.mask
= LVIF_PARAM
;
2369 lvItem
.iItem
= lResult
;
2370 lvItem
.iSubItem
= 0;
2371 SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
) &lvItem
);
2373 /* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */
2374 hr
= IShellFolder_GetUIObjectOf(This
->pSFParent
, This
->hWndList
, 1,
2375 (LPCITEMIDLIST
*)&lvItem
.lParam
, &IID_IDropTarget
, NULL
, (LPVOID
*)&This
->pCurDropTarget
);
2378 /* If anything failed, pCurDropTarget should be NULL now, which ought to be a save state. */
2382 /* Notify the item just entered via DragEnter. */
2383 return IDropTarget_DragEnter(This
->pCurDropTarget
, This
->pCurDataObject
, grfKeyState
, pt
, pdwEffect
);
2386 static HRESULT WINAPI
ISVDropTarget_DragEnter(IDropTarget
*iface
, IDataObject
*pDataObject
,
2387 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2389 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2391 /* Get a hold on the data object for later calls to DragEnter on the sub-folders */
2392 This
->pCurDataObject
= pDataObject
;
2393 IDataObject_AddRef(pDataObject
);
2395 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2398 static HRESULT WINAPI
ISVDropTarget_DragOver(IDropTarget
*iface
, DWORD grfKeyState
, POINTL pt
,
2401 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2402 return drag_notify_subitem(This
, grfKeyState
, pt
, pdwEffect
);
2405 static HRESULT WINAPI
ISVDropTarget_DragLeave(IDropTarget
*iface
)
2407 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2409 if (This
->pCurDropTarget
)
2411 IDropTarget_DragLeave(This
->pCurDropTarget
);
2412 IDropTarget_Release(This
->pCurDropTarget
);
2413 This
->pCurDropTarget
= NULL
;
2416 if (This
->pCurDataObject
)
2418 IDataObject_Release(This
->pCurDataObject
);
2419 This
->pCurDataObject
= NULL
;
2422 This
->iDragOverItem
= 0;
2427 static HRESULT WINAPI
ISVDropTarget_Drop(IDropTarget
*iface
, IDataObject
* pDataObject
,
2428 DWORD grfKeyState
, POINTL pt
, DWORD
*pdwEffect
)
2430 IShellViewImpl
*This
= impl_from_IDropTarget(iface
);
2432 if (!This
->pCurDropTarget
) return DRAGDROP_E_INVALIDHWND
;
2434 IDropTarget_Drop(This
->pCurDropTarget
, pDataObject
, grfKeyState
, pt
, pdwEffect
);
2436 IDropTarget_Release(This
->pCurDropTarget
);
2437 IDataObject_Release(This
->pCurDataObject
);
2438 This
->pCurDataObject
= NULL
;
2439 This
->pCurDropTarget
= NULL
;
2440 This
->iDragOverItem
= 0;
2445 static const IDropTargetVtbl droptargetvtbl
=
2447 ISVDropTarget_QueryInterface
,
2448 ISVDropTarget_AddRef
,
2449 ISVDropTarget_Release
,
2450 ISVDropTarget_DragEnter
,
2451 ISVDropTarget_DragOver
,
2452 ISVDropTarget_DragLeave
,
2456 /**********************************************************
2457 * ISVDropSource implementation
2460 static HRESULT WINAPI
ISVDropSource_QueryInterface(IDropSource
*iface
, REFIID riid
, void **ppvObj
)
2462 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2463 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2466 static ULONG WINAPI
ISVDropSource_AddRef(IDropSource
*iface
)
2468 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2469 return IShellView3_AddRef(&This
->IShellView3_iface
);
2472 static ULONG WINAPI
ISVDropSource_Release(IDropSource
*iface
)
2474 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2475 return IShellView3_Release(&This
->IShellView3_iface
);
2478 static HRESULT WINAPI
ISVDropSource_QueryContinueDrag(
2480 BOOL fEscapePressed
,
2483 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2484 TRACE("(%p)\n",This
);
2487 return DRAGDROP_S_CANCEL
;
2488 else if (!(grfKeyState
& MK_LBUTTON
) && !(grfKeyState
& MK_RBUTTON
))
2489 return DRAGDROP_S_DROP
;
2494 static HRESULT WINAPI
ISVDropSource_GiveFeedback(
2498 IShellViewImpl
*This
= impl_from_IDropSource(iface
);
2499 TRACE("(%p)\n",This
);
2501 return DRAGDROP_S_USEDEFAULTCURSORS
;
2504 static const IDropSourceVtbl dropsourcevtbl
=
2506 ISVDropSource_QueryInterface
,
2507 ISVDropSource_AddRef
,
2508 ISVDropSource_Release
,
2509 ISVDropSource_QueryContinueDrag
,
2510 ISVDropSource_GiveFeedback
2512 /**********************************************************
2513 * ISVViewObject implementation
2516 static HRESULT WINAPI
ISVViewObject_QueryInterface(IViewObject
*iface
, REFIID riid
, void **ppvObj
)
2518 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2519 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2522 static ULONG WINAPI
ISVViewObject_AddRef(IViewObject
*iface
)
2524 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2525 return IShellView3_AddRef(&This
->IShellView3_iface
);
2528 static ULONG WINAPI
ISVViewObject_Release(IViewObject
*iface
)
2530 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2531 return IShellView3_Release(&This
->IShellView3_iface
);
2534 static HRESULT WINAPI
ISVViewObject_Draw(
2539 DVTARGETDEVICE
* ptd
,
2542 LPCRECTL lprcBounds
,
2543 LPCRECTL lprcWBounds
,
2544 BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
),
2545 ULONG_PTR dwContinue
)
2548 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2550 FIXME("Stub: This=%p\n",This
);
2554 static HRESULT WINAPI
ISVViewObject_GetColorSet(
2559 DVTARGETDEVICE
* ptd
,
2560 HDC hicTargetDevice
,
2561 LOGPALETTE
** ppColorSet
)
2564 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2566 FIXME("Stub: This=%p\n",This
);
2570 static HRESULT WINAPI
ISVViewObject_Freeze(
2578 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2580 FIXME("Stub: This=%p\n",This
);
2584 static HRESULT WINAPI
ISVViewObject_Unfreeze(
2589 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2591 FIXME("Stub: This=%p\n",This
);
2595 static HRESULT WINAPI
ISVViewObject_SetAdvise(
2599 IAdviseSink
* pAdvSink
)
2602 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2604 FIXME("partial stub: %p %08x %08x %p\n",
2605 This
, aspects
, advf
, pAdvSink
);
2607 /* FIXME: we set the AdviseSink, but never use it to send any advice */
2608 This
->pAdvSink
= pAdvSink
;
2609 This
->dwAspects
= aspects
;
2610 This
->dwAdvf
= advf
;
2615 static HRESULT WINAPI
ISVViewObject_GetAdvise(
2619 IAdviseSink
** ppAdvSink
)
2622 IShellViewImpl
*This
= impl_from_IViewObject(iface
);
2624 TRACE("This=%p pAspects=%p pAdvf=%p ppAdvSink=%p\n",
2625 This
, pAspects
, pAdvf
, ppAdvSink
);
2629 IAdviseSink_AddRef( This
->pAdvSink
);
2630 *ppAdvSink
= This
->pAdvSink
;
2633 *pAspects
= This
->dwAspects
;
2635 *pAdvf
= This
->dwAdvf
;
2641 static const IViewObjectVtbl viewobjectvtbl
=
2643 ISVViewObject_QueryInterface
,
2644 ISVViewObject_AddRef
,
2645 ISVViewObject_Release
,
2647 ISVViewObject_GetColorSet
,
2648 ISVViewObject_Freeze
,
2649 ISVViewObject_Unfreeze
,
2650 ISVViewObject_SetAdvise
,
2651 ISVViewObject_GetAdvise
2655 static HRESULT WINAPI
FolderView_QueryInterface(IFolderView2
*iface
, REFIID riid
, void **ppvObj
)
2657 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2658 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
2661 static ULONG WINAPI
FolderView_AddRef(IFolderView2
*iface
)
2663 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2664 return IShellView3_AddRef(&This
->IShellView3_iface
);
2667 static ULONG WINAPI
FolderView_Release(IFolderView2
*iface
)
2669 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2670 return IShellView3_Release(&This
->IShellView3_iface
);
2673 static HRESULT WINAPI
FolderView_GetCurrentViewMode(IFolderView2
*iface
, UINT
*mode
)
2675 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2676 TRACE("(%p)->(%p), stub\n", This
, mode
);
2679 return E_INVALIDARG
;
2681 *mode
= This
->FolderSettings
.ViewMode
;
2685 static HRESULT WINAPI
FolderView_SetCurrentViewMode(IFolderView2
*iface
, UINT mode
)
2687 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2689 TRACE("(%p)->(%u), stub\n", This
, mode
);
2691 if((mode
< FVM_FIRST
|| mode
> FVM_LAST
) &&
2693 return E_INVALIDARG
;
2695 /* Windows before Vista uses LVM_SETVIEW and possibly
2696 LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
2697 while later versions seem to accomplish this through other
2699 dwStyle
= ViewModeToListStyle(mode
);
2700 SetStyle(This
, dwStyle
, LVS_TYPEMASK
);
2702 /* This will not necessarily be the actual mode set above.
2703 This mimics the behavior of Windows XP. */
2704 This
->FolderSettings
.ViewMode
= mode
;
2709 static HRESULT WINAPI
FolderView_GetFolder(IFolderView2
*iface
, REFIID riid
, void **ppv
)
2711 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2713 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppv
);
2715 if (!ppv
) return E_POINTER
;
2717 if (IsEqualIID(riid
, &IID_IShellFolder
))
2719 *ppv
= This
->pSFParent
;
2723 return E_NOINTERFACE
;
2726 static HRESULT WINAPI
FolderView_Item(IFolderView2
*iface
, int index
, PITEMID_CHILD
*ppidl
)
2728 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2731 TRACE("(%p)->(%d %p)\n", This
, index
, ppidl
);
2733 item
.mask
= LVIF_PARAM
;
2736 if (SendMessageW(This
->hWndList
, LVM_GETITEMW
, 0, (LPARAM
)&item
))
2738 *ppidl
= ILClone((PITEMID_CHILD
)item
.lParam
);
2744 return E_INVALIDARG
;
2748 static HRESULT WINAPI
FolderView_ItemCount(IFolderView2
*iface
, UINT flags
, int *items
)
2750 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2752 TRACE("(%p)->(%u %p)\n", This
, flags
, items
);
2754 if (flags
!= SVGIO_ALLVIEW
)
2755 FIXME("some flags unsupported, %x\n", flags
& ~SVGIO_ALLVIEW
);
2757 *items
= SendMessageW(This
->hWndList
, LVM_GETITEMCOUNT
, 0, 0);
2762 static HRESULT WINAPI
FolderView_Items(IFolderView2
*iface
, UINT flags
, REFIID riid
, void **ppv
)
2764 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2765 FIXME("(%p)->(%u %s %p), stub\n", This
, flags
, debugstr_guid(riid
), ppv
);
2769 static HRESULT WINAPI
FolderView_GetSelectionMarkedItem(IFolderView2
*iface
, int *item
)
2771 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2773 TRACE("(%p)->(%p)\n", This
, item
);
2775 *item
= SendMessageW(This
->hWndList
, LVM_GETSELECTIONMARK
, 0, 0);
2780 static HRESULT WINAPI
FolderView_GetFocusedItem(IFolderView2
*iface
, int *item
)
2782 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2784 TRACE("(%p)->(%p)\n", This
, item
);
2786 *item
= SendMessageW(This
->hWndList
, LVM_GETNEXTITEM
, -1, LVNI_FOCUSED
);
2791 static HRESULT WINAPI
FolderView_GetItemPosition(IFolderView2
*iface
, PCUITEMID_CHILD pidl
, POINT
*ppt
)
2793 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2794 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, ppt
);
2798 static HRESULT WINAPI
FolderView_GetSpacing(IFolderView2
*iface
, POINT
*pt
)
2800 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2802 TRACE("(%p)->(%p)\n", This
, pt
);
2804 if (!This
->hWndList
) return S_FALSE
;
2809 ret
= SendMessageW(This
->hWndList
, LVM_GETITEMSPACING
, 0, 0);
2811 pt
->x
= LOWORD(ret
);
2812 pt
->y
= HIWORD(ret
);
2818 static HRESULT WINAPI
FolderView_GetDefaultSpacing(IFolderView2
*iface
, POINT
*pt
)
2820 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2821 FIXME("(%p)->(%p), stub\n", This
, pt
);
2825 static HRESULT WINAPI
FolderView_GetAutoArrange(IFolderView2
*iface
)
2827 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2828 FIXME("(%p), stub\n", This
);
2832 static HRESULT WINAPI
FolderView_SelectItem(IFolderView2
*iface
, int item
, DWORD flags
)
2834 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2837 TRACE("(%p)->(%d, %x)\n", This
, item
, flags
);
2840 lvItem
.stateMask
= LVIS_SELECTED
;
2842 if (flags
& SVSI_ENSUREVISIBLE
)
2843 SendMessageW(This
->hWndList
, LVM_ENSUREVISIBLE
, item
, 0);
2846 if (flags
& SVSI_DESELECTOTHERS
)
2847 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, -1, (LPARAM
)&lvItem
);
2850 if (flags
& SVSI_SELECT
)
2851 lvItem
.state
|= LVIS_SELECTED
;
2853 if (flags
& SVSI_FOCUSED
)
2854 lvItem
.stateMask
|= LVIS_FOCUSED
;
2856 SendMessageW(This
->hWndList
, LVM_SETITEMSTATE
, item
, (LPARAM
)&lvItem
);
2858 if (flags
& SVSI_EDIT
)
2859 SendMessageW(This
->hWndList
, LVM_EDITLABELW
, item
, 0);
2864 static HRESULT WINAPI
FolderView_SelectAndPositionItems(IFolderView2
*iface
, UINT cidl
,
2865 PCUITEMID_CHILD_ARRAY apidl
, POINT
*apt
, DWORD flags
)
2867 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2868 FIXME("(%p)->(%u %p %p %x), stub\n", This
, cidl
, apidl
, apt
, flags
);
2872 static HRESULT WINAPI
FolderView2_SetGroupBy(IFolderView2
*iface
, REFPROPERTYKEY key
, BOOL ascending
)
2874 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2875 FIXME("(%p)->(%p %d), stub\n", This
, key
, ascending
);
2879 static HRESULT WINAPI
FolderView2_GetGroupBy(IFolderView2
*iface
, PROPERTYKEY
*pkey
, BOOL
*ascending
)
2881 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2882 FIXME("(%p)->(%p %p), stub\n", This
, pkey
, ascending
);
2886 static HRESULT WINAPI
FolderView2_SetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2887 REFPROPERTYKEY propkey
, REFPROPVARIANT propvar
)
2889 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2890 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2894 static HRESULT WINAPI
FolderView2_GetViewProperty(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2895 REFPROPERTYKEY propkey
, PROPVARIANT
*propvar
)
2897 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2898 FIXME("(%p)->(%p %p %p), stub\n", This
, pidl
, propkey
, propvar
);
2902 static HRESULT WINAPI
FolderView2_SetTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2905 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2906 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2910 static HRESULT WINAPI
FolderView2_SetExtendedTileViewProperties(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2913 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2914 FIXME("(%p)->(%p %s), stub\n", This
, pidl
, debugstr_w(prop_list
));
2918 static HRESULT WINAPI
FolderView2_SetText(IFolderView2
*iface
, FVTEXTTYPE type
, LPCWSTR text
)
2920 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2921 FIXME("(%p)->(%d %s), stub\n", This
, type
, debugstr_w(text
));
2925 static HRESULT WINAPI
FolderView2_SetCurrentFolderFlags(IFolderView2
*iface
, DWORD mask
, DWORD flags
)
2927 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2928 FIXME("(%p)->(0x%08x 0x%08x), stub\n", This
, mask
, flags
);
2932 static HRESULT WINAPI
FolderView2_GetCurrentFolderFlags(IFolderView2
*iface
, DWORD
*flags
)
2934 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2935 FIXME("(%p)->(%p), stub\n", This
, flags
);
2939 static HRESULT WINAPI
FolderView2_GetSortColumnCount(IFolderView2
*iface
, int *columns
)
2941 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2942 FIXME("(%p)->(%p), stub\n", This
, columns
);
2946 static HRESULT WINAPI
FolderView2_SetSortColumns(IFolderView2
*iface
, const SORTCOLUMN
*columns
,
2949 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2950 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2954 static HRESULT WINAPI
FolderView2_GetSortColumns(IFolderView2
*iface
, SORTCOLUMN
*columns
,
2957 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2958 FIXME("(%p)->(%p %d), stub\n", This
, columns
, count
);
2962 static HRESULT WINAPI
FolderView2_GetItem(IFolderView2
*iface
, int item
, REFIID riid
, void **ppv
)
2964 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2965 FIXME("(%p)->(%d %s %p), stub\n", This
, item
, debugstr_guid(riid
), ppv
);
2969 static HRESULT WINAPI
FolderView2_GetVisibleItem(IFolderView2
*iface
, int start
, BOOL previous
,
2972 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2973 FIXME("(%p)->(%d %d %p), stub\n", This
, start
, previous
, item
);
2977 static HRESULT WINAPI
FolderView2_GetSelectedItem(IFolderView2
*iface
, int start
, int *item
)
2979 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2980 FIXME("(%p)->(%d %p), stub\n", This
, start
, item
);
2984 static HRESULT WINAPI
FolderView2_GetSelection(IFolderView2
*iface
, BOOL none_implies_folder
,
2985 IShellItemArray
**array
)
2987 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2988 FIXME("(%p)->(%d %p), stub\n", This
, none_implies_folder
, array
);
2992 static HRESULT WINAPI
FolderView2_GetSelectionState(IFolderView2
*iface
, PCUITEMID_CHILD pidl
,
2995 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
2996 FIXME("(%p)->(%p %p), stub\n", This
, pidl
, flags
);
3000 static HRESULT WINAPI
FolderView2_InvokeVerbOnSelection(IFolderView2
*iface
, LPCSTR verb
)
3002 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3003 FIXME("(%p)->(%s), stub\n", This
, debugstr_a(verb
));
3007 static HRESULT WINAPI
FolderView2_SetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE mode
,
3010 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3011 FIXME("(%p)->(%d %d), stub\n", This
, mode
, size
);
3015 static HRESULT WINAPI
FolderView2_GetViewModeAndIconSize(IFolderView2
*iface
, FOLDERVIEWMODE
*mode
,
3018 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3019 FIXME("(%p)->(%p %p), stub\n", This
, mode
, size
);
3023 static HRESULT WINAPI
FolderView2_SetGroupSubsetCount(IFolderView2
*iface
, UINT visible_rows
)
3025 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3026 FIXME("(%p)->(%u), stub\n", This
, visible_rows
);
3030 static HRESULT WINAPI
FolderView2_GetGroupSubsetCount(IFolderView2
*iface
, UINT
*visible_rows
)
3032 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3033 FIXME("(%p)->(%p), stub\n", This
, visible_rows
);
3037 static HRESULT WINAPI
FolderView2_SetRedraw(IFolderView2
*iface
, BOOL redraw
)
3039 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3040 FIXME("(%p)->(%d), stub\n", This
, redraw
);
3044 static HRESULT WINAPI
FolderView2_IsMoveInSameFolder(IFolderView2
*iface
)
3046 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3047 FIXME("(%p), stub\n", This
);
3051 static HRESULT WINAPI
FolderView2_DoRename(IFolderView2
*iface
)
3053 IShellViewImpl
*This
= impl_from_IFolderView2(iface
);
3054 FIXME("(%p), stub\n", This
);
3058 static const IFolderView2Vtbl folderviewvtbl
=
3060 FolderView_QueryInterface
,
3063 FolderView_GetCurrentViewMode
,
3064 FolderView_SetCurrentViewMode
,
3065 FolderView_GetFolder
,
3067 FolderView_ItemCount
,
3069 FolderView_GetSelectionMarkedItem
,
3070 FolderView_GetFocusedItem
,
3071 FolderView_GetItemPosition
,
3072 FolderView_GetSpacing
,
3073 FolderView_GetDefaultSpacing
,
3074 FolderView_GetAutoArrange
,
3075 FolderView_SelectItem
,
3076 FolderView_SelectAndPositionItems
,
3077 FolderView2_SetGroupBy
,
3078 FolderView2_GetGroupBy
,
3079 FolderView2_SetViewProperty
,
3080 FolderView2_GetViewProperty
,
3081 FolderView2_SetTileViewProperties
,
3082 FolderView2_SetExtendedTileViewProperties
,
3083 FolderView2_SetText
,
3084 FolderView2_SetCurrentFolderFlags
,
3085 FolderView2_GetCurrentFolderFlags
,
3086 FolderView2_GetSortColumnCount
,
3087 FolderView2_SetSortColumns
,
3088 FolderView2_GetSortColumns
,
3089 FolderView2_GetItem
,
3090 FolderView2_GetVisibleItem
,
3091 FolderView2_GetSelectedItem
,
3092 FolderView2_GetSelection
,
3093 FolderView2_GetSelectionState
,
3094 FolderView2_InvokeVerbOnSelection
,
3095 FolderView2_SetViewModeAndIconSize
,
3096 FolderView2_GetViewModeAndIconSize
,
3097 FolderView2_SetGroupSubsetCount
,
3098 FolderView2_GetGroupSubsetCount
,
3099 FolderView2_SetRedraw
,
3100 FolderView2_IsMoveInSameFolder
,
3101 FolderView2_DoRename
3104 /* IShellFolderView */
3105 static HRESULT WINAPI
IShellFolderView_fnQueryInterface(IShellFolderView
*iface
, REFIID riid
, void **ppvObj
)
3107 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3108 return IShellView3_QueryInterface(&This
->IShellView3_iface
, riid
, ppvObj
);
3111 static ULONG WINAPI
IShellFolderView_fnAddRef(IShellFolderView
*iface
)
3113 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3114 return IShellView3_AddRef(&This
->IShellView3_iface
);
3117 static ULONG WINAPI
IShellFolderView_fnRelease(IShellFolderView
*iface
)
3119 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3120 return IShellView3_Release(&This
->IShellView3_iface
);
3123 static HRESULT WINAPI
IShellFolderView_fnRearrange(IShellFolderView
*iface
, LPARAM sort
)
3125 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3126 FIXME("(%p)->(%ld) stub\n", This
, sort
);
3130 static HRESULT WINAPI
IShellFolderView_fnGetArrangeParam(IShellFolderView
*iface
, LPARAM
*sort
)
3132 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3133 FIXME("(%p)->(%p) stub\n", This
, sort
);
3137 static HRESULT WINAPI
IShellFolderView_fnArrangeGrid(IShellFolderView
*iface
)
3139 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3140 FIXME("(%p) stub\n", This
);
3144 static HRESULT WINAPI
IShellFolderView_fnAutoArrange(IShellFolderView
*iface
)
3146 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3147 FIXME("(%p) stub\n", This
);
3151 static HRESULT WINAPI
IShellFolderView_fnGetAutoArrange(IShellFolderView
*iface
)
3153 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3154 TRACE("(%p)\n", This
);
3155 return IFolderView2_GetAutoArrange(&This
->IFolderView2_iface
);
3158 static HRESULT WINAPI
IShellFolderView_fnAddObject(
3159 IShellFolderView
*iface
,
3163 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3164 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3168 static HRESULT WINAPI
IShellFolderView_fnGetObject(
3169 IShellFolderView
*iface
,
3170 PITEMID_CHILD
*pidl
,
3173 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3174 TRACE("(%p)->(%p %d)\n", This
, pidl
, item
);
3175 return IFolderView2_Item(&This
->IFolderView2_iface
, item
, pidl
);
3178 static HRESULT WINAPI
IShellFolderView_fnRemoveObject(
3179 IShellFolderView
*iface
,
3183 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3185 TRACE("(%p)->(%p %p)\n", This
, pidl
, item
);
3189 *item
= LV_FindItemByPidl(This
, ILFindLastID(pidl
));
3190 SendMessageW(This
->hWndList
, LVM_DELETEITEM
, *item
, 0);
3195 SendMessageW(This
->hWndList
, LVM_DELETEALLITEMS
, 0, 0);
3201 static HRESULT WINAPI
IShellFolderView_fnGetObjectCount(
3202 IShellFolderView
*iface
,
3205 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3206 TRACE("(%p)->(%p)\n", This
, count
);
3207 return IFolderView2_ItemCount(&This
->IFolderView2_iface
, SVGIO_ALLVIEW
, (INT
*)count
);
3210 static HRESULT WINAPI
IShellFolderView_fnSetObjectCount(
3211 IShellFolderView
*iface
,
3215 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3216 FIXME("(%p)->(%d %x) stub\n", This
, count
, flags
);
3220 static HRESULT WINAPI
IShellFolderView_fnUpdateObject(
3221 IShellFolderView
*iface
,
3222 PITEMID_CHILD pidl_old
,
3223 PITEMID_CHILD pidl_new
,
3226 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3227 FIXME("(%p)->(%p %p %p) stub\n", This
, pidl_old
, pidl_new
, item
);
3231 static HRESULT WINAPI
IShellFolderView_fnRefreshObject(
3232 IShellFolderView
*iface
,
3236 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3237 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, item
);
3241 static HRESULT WINAPI
IShellFolderView_fnSetRedraw(
3242 IShellFolderView
*iface
,
3245 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3246 TRACE("(%p)->(%d)\n", This
, redraw
);
3248 SendMessageW(This
->hWndList
, WM_SETREDRAW
, redraw
, 0);
3253 static HRESULT WINAPI
IShellFolderView_fnGetSelectedCount(
3254 IShellFolderView
*iface
,
3257 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3258 FIXME("(%p)->(%p) stub\n", This
, count
);
3262 static HRESULT WINAPI
IShellFolderView_fnGetSelectedObjects(
3263 IShellFolderView
*iface
,
3264 PCITEMID_CHILD
**pidl
,
3267 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3269 TRACE("(%p)->(%p %p)\n", This
, pidl
, items
);
3271 *items
= ShellView_GetSelections( This
);
3275 *pidl
= LocalAlloc(0, *items
*sizeof(LPITEMIDLIST
));
3276 if (!*pidl
) return E_OUTOFMEMORY
;
3278 /* it's documented that caller shouldn't free PIDLs, only array itself */
3279 memcpy((PITEMID_CHILD
*)*pidl
, This
->apidl
, *items
*sizeof(LPITEMIDLIST
));
3285 static HRESULT WINAPI
IShellFolderView_fnIsDropOnSource(
3286 IShellFolderView
*iface
,
3287 IDropTarget
*drop_target
)
3289 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3290 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3294 static HRESULT WINAPI
IShellFolderView_fnGetDragPoint(
3295 IShellFolderView
*iface
,
3298 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3299 FIXME("(%p)->(%p) stub\n", This
, pt
);
3303 static HRESULT WINAPI
IShellFolderView_fnGetDropPoint(
3304 IShellFolderView
*iface
,
3307 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3308 FIXME("(%p)->(%p) stub\n", This
, pt
);
3312 static HRESULT WINAPI
IShellFolderView_fnMoveIcons(
3313 IShellFolderView
*iface
,
3316 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3317 TRACE("(%p)->(%p)\n", This
, obj
);
3321 static HRESULT WINAPI
IShellFolderView_fnSetItemPos(
3322 IShellFolderView
*iface
,
3323 PCUITEMID_CHILD pidl
,
3326 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3327 FIXME("(%p)->(%p %p) stub\n", This
, pidl
, pt
);
3331 static HRESULT WINAPI
IShellFolderView_fnIsBkDropTarget(
3332 IShellFolderView
*iface
,
3333 IDropTarget
*drop_target
)
3335 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3336 FIXME("(%p)->(%p) stub\n", This
, drop_target
);
3340 static HRESULT WINAPI
IShellFolderView_fnSetClipboard(
3341 IShellFolderView
*iface
,
3344 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3345 FIXME("(%p)->(%d) stub\n", This
, move
);
3349 static HRESULT WINAPI
IShellFolderView_fnSetPoints(
3350 IShellFolderView
*iface
,
3353 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3354 FIXME("(%p)->(%p) stub\n", This
, obj
);
3358 static HRESULT WINAPI
IShellFolderView_fnGetItemSpacing(
3359 IShellFolderView
*iface
,
3360 ITEMSPACING
*spacing
)
3362 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3363 FIXME("(%p)->(%p) stub\n", This
, spacing
);
3367 static HRESULT WINAPI
IShellFolderView_fnSetCallback(
3368 IShellFolderView
*iface
,
3369 IShellFolderViewCB
*new_cb
,
3370 IShellFolderViewCB
**old_cb
)
3373 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3374 FIXME("(%p)->(%p %p) stub\n", This
, new_cb
, old_cb
);
3378 static HRESULT WINAPI
IShellFolderView_fnSelect(
3379 IShellFolderView
*iface
,
3382 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3383 FIXME("(%p)->(%d) stub\n", This
, flags
);
3387 static HRESULT WINAPI
IShellFolderView_fnQuerySupport(
3388 IShellFolderView
*iface
,
3391 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3392 TRACE("(%p)->(%p)\n", This
, support
);
3396 static HRESULT WINAPI
IShellFolderView_fnSetAutomationObject(
3397 IShellFolderView
*iface
,
3400 IShellViewImpl
*This
= impl_from_IShellFolderView(iface
);
3401 FIXME("(%p)->(%p) stub\n", This
, disp
);
3405 static const IShellFolderViewVtbl shellfolderviewvtbl
=
3407 IShellFolderView_fnQueryInterface
,
3408 IShellFolderView_fnAddRef
,
3409 IShellFolderView_fnRelease
,
3410 IShellFolderView_fnRearrange
,
3411 IShellFolderView_fnGetArrangeParam
,
3412 IShellFolderView_fnArrangeGrid
,
3413 IShellFolderView_fnAutoArrange
,
3414 IShellFolderView_fnGetAutoArrange
,
3415 IShellFolderView_fnAddObject
,
3416 IShellFolderView_fnGetObject
,
3417 IShellFolderView_fnRemoveObject
,
3418 IShellFolderView_fnGetObjectCount
,
3419 IShellFolderView_fnSetObjectCount
,
3420 IShellFolderView_fnUpdateObject
,
3421 IShellFolderView_fnRefreshObject
,
3422 IShellFolderView_fnSetRedraw
,
3423 IShellFolderView_fnGetSelectedCount
,
3424 IShellFolderView_fnGetSelectedObjects
,
3425 IShellFolderView_fnIsDropOnSource
,
3426 IShellFolderView_fnGetDragPoint
,
3427 IShellFolderView_fnGetDropPoint
,
3428 IShellFolderView_fnMoveIcons
,
3429 IShellFolderView_fnSetItemPos
,
3430 IShellFolderView_fnIsBkDropTarget
,
3431 IShellFolderView_fnSetClipboard
,
3432 IShellFolderView_fnSetPoints
,
3433 IShellFolderView_fnGetItemSpacing
,
3434 IShellFolderView_fnSetCallback
,
3435 IShellFolderView_fnSelect
,
3436 IShellFolderView_fnQuerySupport
,
3437 IShellFolderView_fnSetAutomationObject
3440 static HRESULT WINAPI
shellfolderviewdual_QueryInterface(IShellFolderViewDual3
*iface
, REFIID riid
, void **ppvObj
)
3442 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3444 TRACE("(%p)->(IID:%s,%p)\n", This
, debugstr_guid(riid
), ppvObj
);
3446 if (IsEqualIID(riid
, &IID_IShellFolderViewDual3
) ||
3447 IsEqualIID(riid
, &IID_IShellFolderViewDual2
) ||
3448 IsEqualIID(riid
, &IID_IShellFolderViewDual
) ||
3449 IsEqualIID(riid
, &IID_IDispatch
) ||
3450 IsEqualIID(riid
, &IID_IUnknown
))
3453 IShellFolderViewDual3_AddRef(iface
);
3457 WARN("unsupported interface %s\n", debugstr_guid(riid
));
3458 return E_NOINTERFACE
;
3461 static ULONG WINAPI
shellfolderviewdual_AddRef(IShellFolderViewDual3
*iface
)
3463 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3464 return IShellView3_AddRef(&This
->IShellView3_iface
);
3467 static ULONG WINAPI
shellfolderviewdual_Release(IShellFolderViewDual3
*iface
)
3469 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3470 return IShellView3_Release(&This
->IShellView3_iface
);
3473 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfoCount(IShellFolderViewDual3
*iface
, UINT
*pctinfo
)
3475 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3476 FIXME("%p\n", This
);
3480 static HRESULT WINAPI
shellfolderviewdual_GetTypeInfo(IShellFolderViewDual3
*iface
,
3481 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
3483 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3484 FIXME("%p\n", This
);
3488 static HRESULT WINAPI
shellfolderviewdual_GetIDsOfNames(
3489 IShellFolderViewDual3
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT
3490 cNames
, LCID lcid
, DISPID
*rgDispId
)
3492 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3493 FIXME("%p\n", This
);
3497 static HRESULT WINAPI
shellfolderviewdual_Invoke(IShellFolderViewDual3
*iface
,
3498 DISPID dispIdMember
, REFIID riid
, LCID lcid
, WORD wFlags
,
3499 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
3502 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3503 FIXME("%p\n", This
);
3507 static HRESULT WINAPI
shellfolderviewdual_get_Application(IShellFolderViewDual3
*iface
,
3510 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3511 FIXME("%p %p\n", This
, disp
);
3515 static HRESULT WINAPI
shellfolderviewdual_get_Parent(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3517 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3518 FIXME("%p %p\n", This
, disp
);
3522 static HRESULT WINAPI
shellfolderviewdual_get_Folder(IShellFolderViewDual3
*iface
, Folder
**folder
)
3524 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3525 FIXME("%p %p\n", This
, folder
);
3529 static HRESULT WINAPI
shellfolderviewdual_SelectedItems(IShellFolderViewDual3
*iface
, FolderItems
**items
)
3531 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3532 FIXME("%p %p\n", This
, items
);
3536 static HRESULT WINAPI
shellfolderviewdual_get_FocusedItem(IShellFolderViewDual3
*iface
,
3539 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3540 FIXME("%p %p\n", This
, item
);
3544 static HRESULT WINAPI
shellfolderviewdual_SelectItem(IShellFolderViewDual3
*iface
,
3545 VARIANT
*v
, int flags
)
3547 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3548 FIXME("%p %s %x\n", This
, debugstr_variant(v
), flags
);
3552 static HRESULT WINAPI
shellfolderviewdual_PopupItemMenu(IShellFolderViewDual3
*iface
,
3553 FolderItem
*item
, VARIANT vx
, VARIANT vy
, BSTR
*command
)
3555 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3556 FIXME("%p %p %s %s %p\n", This
, item
, debugstr_variant(&vx
), debugstr_variant(&vy
), command
);
3560 static HRESULT WINAPI
shellfolderviewdual_get_Script(IShellFolderViewDual3
*iface
, IDispatch
**disp
)
3562 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3563 FIXME("%p %p\n", This
, disp
);
3567 static HRESULT WINAPI
shellfolderviewdual_get_ViewOptions(IShellFolderViewDual3
*iface
, LONG
*options
)
3569 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3570 FIXME("%p %p\n", This
, options
);
3574 static HRESULT WINAPI
shellfolderviewdual_get_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT
*mode
)
3576 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3577 FIXME("%p %p\n", This
, mode
);
3581 static HRESULT WINAPI
shellfolderviewdual_put_CurrentViewMode(IShellFolderViewDual3
*iface
, UINT mode
)
3583 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3584 FIXME("%p %u\n", This
, mode
);
3588 static HRESULT WINAPI
shellfolderviewdual_SelectItemRelative(IShellFolderViewDual3
*iface
, int relative
)
3590 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3591 FIXME("%p %d\n", This
, relative
);
3595 static HRESULT WINAPI
shellfolderviewdual_get_GroupBy(IShellFolderViewDual3
*iface
, BSTR
*groupby
)
3597 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3598 FIXME("%p %p\n", This
, groupby
);
3602 static HRESULT WINAPI
shellfolderviewdual_put_GroupBy(IShellFolderViewDual3
*iface
, BSTR groupby
)
3604 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3605 FIXME("%p %s\n", This
, debugstr_w(groupby
));
3609 static HRESULT WINAPI
shellfolderviewdual_get_FolderFlags(IShellFolderViewDual3
*iface
, DWORD
*flags
)
3611 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3612 FIXME("%p %p\n", This
, flags
);
3616 static HRESULT WINAPI
shellfolderviewdual_put_FolderFlags(IShellFolderViewDual3
*iface
, DWORD flags
)
3618 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3619 FIXME("%p 0x%08x\n", This
, flags
);
3623 static HRESULT WINAPI
shellfolderviewdual_get_SortColumns(IShellFolderViewDual3
*iface
, BSTR
*sortcolumns
)
3625 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3626 FIXME("%p %p\n", This
, sortcolumns
);
3630 static HRESULT WINAPI
shellfolderviewdual_put_SortColumns(IShellFolderViewDual3
*iface
, BSTR sortcolumns
)
3632 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3633 FIXME("%p %s\n", This
, debugstr_w(sortcolumns
));
3637 static HRESULT WINAPI
shellfolderviewdual_put_IconSize(IShellFolderViewDual3
*iface
, int icon_size
)
3639 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3640 FIXME("%p %d\n", This
, icon_size
);
3644 static HRESULT WINAPI
shellfolderviewdual_get_IconSize(IShellFolderViewDual3
*iface
, int *icon_size
)
3646 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3647 FIXME("%p %p\n", This
, icon_size
);
3651 static HRESULT WINAPI
shellfolderviewdual_FilterView(IShellFolderViewDual3
*iface
, BSTR filter_text
)
3653 IShellViewImpl
*This
= impl_from_IShellFolderViewDual3(iface
);
3654 FIXME("%p %s\n", This
, debugstr_w(filter_text
));
3658 static const IShellFolderViewDual3Vtbl shellfolderviewdualvtbl
=
3660 shellfolderviewdual_QueryInterface
,
3661 shellfolderviewdual_AddRef
,
3662 shellfolderviewdual_Release
,
3663 shellfolderviewdual_GetTypeInfoCount
,
3664 shellfolderviewdual_GetTypeInfo
,
3665 shellfolderviewdual_GetIDsOfNames
,
3666 shellfolderviewdual_Invoke
,
3667 shellfolderviewdual_get_Application
,
3668 shellfolderviewdual_get_Parent
,
3669 shellfolderviewdual_get_Folder
,
3670 shellfolderviewdual_SelectedItems
,
3671 shellfolderviewdual_get_FocusedItem
,
3672 shellfolderviewdual_SelectItem
,
3673 shellfolderviewdual_PopupItemMenu
,
3674 shellfolderviewdual_get_Script
,
3675 shellfolderviewdual_get_ViewOptions
,
3676 shellfolderviewdual_get_CurrentViewMode
,
3677 shellfolderviewdual_put_CurrentViewMode
,
3678 shellfolderviewdual_SelectItemRelative
,
3679 shellfolderviewdual_get_GroupBy
,
3680 shellfolderviewdual_put_GroupBy
,
3681 shellfolderviewdual_get_FolderFlags
,
3682 shellfolderviewdual_put_FolderFlags
,
3683 shellfolderviewdual_get_SortColumns
,
3684 shellfolderviewdual_put_SortColumns
,
3685 shellfolderviewdual_put_IconSize
,
3686 shellfolderviewdual_get_IconSize
,
3687 shellfolderviewdual_FilterView
3690 /**********************************************************
3691 * IShellView_Constructor
3693 IShellView
*IShellView_Constructor(IShellFolder
*folder
)
3697 sv
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IShellViewImpl
));
3702 sv
->IShellView3_iface
.lpVtbl
= &shellviewvtbl
;
3703 sv
->IOleCommandTarget_iface
.lpVtbl
= &olecommandtargetvtbl
;
3704 sv
->IDropTarget_iface
.lpVtbl
= &droptargetvtbl
;
3705 sv
->IDropSource_iface
.lpVtbl
= &dropsourcevtbl
;
3706 sv
->IViewObject_iface
.lpVtbl
= &viewobjectvtbl
;
3707 sv
->IFolderView2_iface
.lpVtbl
= &folderviewvtbl
;
3708 sv
->IShellFolderView_iface
.lpVtbl
= &shellfolderviewvtbl
;
3709 sv
->IShellFolderViewDual3_iface
.lpVtbl
= &shellfolderviewdualvtbl
;
3711 sv
->pSFParent
= folder
;
3712 if (folder
) IShellFolder_AddRef(folder
);
3713 IShellFolder_QueryInterface(sv
->pSFParent
, &IID_IShellFolder2
, (void**)&sv
->pSF2Parent
);
3715 sv
->pCurDropTarget
= NULL
;
3716 sv
->pCurDataObject
= NULL
;
3717 sv
->iDragOverItem
= 0;
3718 sv
->cScrollDelay
= 0;
3719 sv
->ptLastMousePos
.x
= 0;
3720 sv
->ptLastMousePos
.y
= 0;
3722 TRACE("(%p)->(%p)\n", sv
, folder
);
3723 return (IShellView
*)&sv
->IShellView3_iface
;