source: trunk/src/shell32/shlview.cpp@ 2354

Last change on this file since 2354 was 2354, checked in by phaller, 26 years ago

Updated to WINE 2000/01/08

File size: 54.6 KB
Line 
1/* $Id: shlview.cpp,v 1.6 2000-01-08 02:24:13 phaller Exp $ */
2/*
3 * ShellView
4 *
5 * Copyright 1998,1999 <juergen.schmied@metronet.de>
6 *
7 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
8 * Release() ???
9 *
10 * FIXME: There is still a design problem in this implementation.
11 * This implementation is more or less ok for file system folders
12 * but there are many more kinds of folders.
13 * The shellview is not supposed to know much about the colums
14 * appearing in the view. To fix this it should use the IShellFolder2
15 * interface when possible to get the informations dynamically
16 * this will take a lot of work to implemet and wont likely not
17 * be done in near future
18 * Please considder this when code new features. Mail me if you
19 * are in doubt how to do things. (jsch 25/10/99)
20 *
21 * FIXME: Set the buttons in the filedialog according to the view state
22
23 */
24
25#include <stdlib.h>
26#include <string.h>
27#include <odin.h>
28
29#define ICOM_CINTERFACE 1
30#define CINTERFACE 1
31
32#include "servprov.h"
33#include "wine/obj_base.h"
34#include "wine/obj_shellfolder.h"
35#include "wine/obj_shellview.h"
36#include "wine/obj_oleview.h"
37#include "wine/obj_commdlgbrowser.h"
38#include "wine/obj_shellbrowser.h"
39#include "wine/obj_dockingwindowframe.h"
40#include "wine/obj_extracticon.h"
41#include "wine/obj_dragdrop.h"
42#include "wine/undocshell.h"
43#include "shresdef.h"
44#include "spy.h"
45#include "debugtools.h"
46#include "winerror.h"
47
48#include "docobj.h"
49#include "pidl.h"
50#include "shell32_main.h"
51
52#include <misc.h>
53
54DEFAULT_DEBUG_CHANNEL(shell)
55
56typedef struct
57{ BOOL bIsAscending;
58 INT nHeaderID;
59 INT nLastHeaderID;
60}LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO;
61
62typedef struct
63{ ICOM_VTABLE(IShellView)* lpvtbl;
64 DWORD ref;
65 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget;
66 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
67 ICOM_VTABLE(IDropSource)* lpvtblDropSource;
68 ICOM_VTABLE(IViewObject)* lpvtblViewObject;
69 IShellFolder* pSFParent;
70 IShellFolder2* pSF2Parent;
71 IShellBrowser* pShellBrowser;
72 ICommDlgBrowser* pCommDlgBrowser;
73 HWND hWnd;
74 HWND hWndList;
75 HWND hWndParent;
76 FOLDERSETTINGS FolderSettings;
77 HMENU hMenu;
78 UINT uState;
79 UINT cidl;
80 LPITEMIDLIST *apidl;
81 LISTVIEW_SORT_INFO ListViewSortInfo;
82} IShellViewImpl;
83
84extern struct ICOM_VTABLE(IShellView) svvt;
85extern struct ICOM_VTABLE(IOleCommandTarget) ctvt;
86#define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget)))
87#define _ICOM_THIS_From_IOleCommandTarget(myClass, name) myClass* This = (myClass*)(((char*)name)-_IOleCommandTarget_Offset);
88
89extern struct ICOM_VTABLE(IDropTarget) dtvt;
90#define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget)))
91#define _ICOM_THIS_From_IDropTarget(myClass, name) myClass* This = (myClass*)(((char*)name)-_IDropTarget_Offset);
92
93extern struct ICOM_VTABLE(IDropSource) dsvt;
94#define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource)))
95#define _ICOM_THIS_From_IDropSource(myClass, name) myClass* This = (myClass*)(((char*)name)-_IDropSource_Offset);
96
97extern struct ICOM_VTABLE(IViewObject) vovt;
98#define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject)))
99#define _ICOM_THIS_From_IViewObject(myClass, name) myClass* This = (myClass*)(((char*)name)-_IViewObject_Offset);
100
101/* ListView Header ID's */
102#define LISTVIEW_COLUMN_NAME 0
103#define LISTVIEW_COLUMN_SIZE 1
104#define LISTVIEW_COLUMN_TYPE 2
105#define LISTVIEW_COLUMN_TIME 3
106#define LISTVIEW_COLUMN_ATTRIB 4
107
108/*menu items */
109#define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
110#define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
111#define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
112
113#define ID_LISTVIEW 2000
114
115#define TOOLBAR_ID (L"SHELLDLL_DefView")
116/*windowsx.h */
117#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
118#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
119#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
120/* winuser.h */
121#define WM_SETTINGCHANGE WM_WININICHANGE
122extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
123 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState);
124
125/*
126 Items merged into the toolbar and and the filemenu
127*/
128typedef struct
129{ int idCommand;
130 int iImage;
131 int idButtonString;
132 int idMenuString;
133 BYTE bState;
134 BYTE bStyle;
135} MYTOOLINFO, *LPMYTOOLINFO;
136
137MYTOOLINFO Tools[] =
138{
139{ FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, TBSTYLE_BUTTON },
140{ FCIDM_SHVIEW_SMALLICON, 0, 0, IDS_VIEW_SMALL, TBSTATE_ENABLED, TBSTYLE_BUTTON },
141{ FCIDM_SHVIEW_LISTVIEW, 0, 0, IDS_VIEW_LIST, TBSTATE_ENABLED, TBSTYLE_BUTTON },
142{ FCIDM_SHVIEW_REPORTVIEW, 0, 0, IDS_VIEW_DETAILS, TBSTATE_ENABLED, TBSTYLE_BUTTON },
143{ -1, 0, 0, 0, 0, 0}
144};
145
146typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
147
148/**********************************************************
149 * IShellView_Constructor
150 */
151IShellView * IShellView_Constructor( IShellFolder * pFolder)
152{ IShellViewImpl * sv;
153 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
154 sv->ref=1;
155 sv->lpvtbl=&svvt;
156 sv->lpvtblOleCommandTarget=&ctvt;
157 sv->lpvtblDropTarget=&dtvt;
158 sv->lpvtblDropSource=&dsvt;
159 sv->lpvtblViewObject=&vovt;
160
161 sv->pSFParent = pFolder;
162 if(pFolder) IShellFolder_AddRef(pFolder);
163 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent);
164
165 TRACE("(%p)->(%p)\n",sv, pFolder);
166 shell32_ObjCount++;
167 return (IShellView *) sv;
168}
169
170/**********************************************************
171 *
172 * ##### helperfunctions for communication with ICommDlgBrowser #####
173 */
174static BOOL IsInCommDlg(IShellViewImpl * This)
175{ return(This->pCommDlgBrowser != NULL);
176}
177
178static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
179{
180 HRESULT ret = S_OK;
181
182 if ( IsInCommDlg(This) )
183 {
184 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
185 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl);
186 TRACE("--0x%08lx\n", ret);
187 }
188 return ret;
189}
190
191static HRESULT OnDefaultCommand(IShellViewImpl * This)
192{
193 HRESULT ret = S_FALSE;
194
195 if (IsInCommDlg(This))
196 {
197 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
198 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);
199 TRACE("--\n");
200 }
201 return ret;
202}
203
204static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
205{
206 HRESULT ret = S_FALSE;
207
208 if (IsInCommDlg(This))
209 {
210 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
211 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags);
212 TRACE("--\n");
213 }
214 return ret;
215}
216/**********************************************************
217 *
218 * ##### helperfunctions for initializing the view #####
219 */
220/**********************************************************
221 * set the toolbar buttons
222 */
223static void CheckToolbar(IShellViewImpl * This)
224{
225 LRESULT result;
226
227 TRACE("\n");
228
229 if (IsInCommDlg(This))
230 {
231 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
232 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);
233 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
234 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);
235 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
236 FCIDM_TB_SMALLICON, TRUE, &result);
237 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
238 FCIDM_TB_REPORTVIEW, TRUE, &result);
239 }
240}
241
242/**********************************************************
243 * change the style of the listview control
244 */
245static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
246{
247 DWORD tmpstyle;
248
249 TRACE("(%p)\n", This);
250
251 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE);
252 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
253}
254
255/**********************************************************
256* ShellView_CreateList()
257*
258*/
259static BOOL ShellView_CreateList (IShellViewImpl * This)
260{ DWORD dwStyle;
261
262 TRACE("%p\n",This);
263
264 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
265 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
266
267 switch (This->FolderSettings.ViewMode)
268 {
269 case FVM_ICON: dwStyle |= LVS_ICON; break;
270 case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
271 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
272 case FVM_LIST: dwStyle |= LVS_LIST; break;
273 default: dwStyle |= LVS_LIST; break;
274 }
275
276 if (This->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
277 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
278 if (This->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
279
280 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE,
281 WC_LISTVIEWA,
282 NULL,
283 dwStyle,
284 0,0,0,0,
285 This->hWnd,
286 (HMENU)ID_LISTVIEW,
287 shell32_hInstance,
288 NULL);
289
290 if(!This->hWndList)
291 return FALSE;
292
293 This->ListViewSortInfo.bIsAscending = TRUE;
294 This->ListViewSortInfo.nHeaderID = -1;
295 This->ListViewSortInfo.nLastHeaderID = -1;
296
297 /* UpdateShellSettings(); */
298 return TRUE;
299}
300/**********************************************************
301* ShellView_InitList()
302*
303* NOTES
304* FIXME: the headers should depend on the kind of shellfolder
305* thats creating the shellview. this hack implements only the
306* correct headers for a filesystem folder (jsch 25/10/99)
307*/
308static BOOL ShellView_InitList(IShellViewImpl * This)
309{
310 LVCOLUMNA lvColumn;
311 SHELLDETAILS sd;
312 int i;
313 char szTemp[50];
314
315 TRACE("%p\n",This);
316
317 ListView_DeleteAllItems(This->hWndList);
318
319 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
320 lvColumn.pszText = szTemp;
321
322 if (This->pSF2Parent)
323 {
324 for (i=0; 1; i++)
325 {
326 if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd)))
327 break;
328 lvColumn.fmt = sd.fmt;
329 lvColumn.cx = sd.cxChar*8; /* chars->pixel */
330 StrRetToStrNA( szTemp, 50, &sd.str, NULL);
331 ListView_InsertColumnA(This->hWndList, i, &lvColumn);
332 }
333 }
334 else
335 {
336 FIXME("no SF2\n");
337 }
338
339 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL);
340 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL);
341
342 return TRUE;
343}
344/**********************************************************
345* ShellView_CompareItems()
346*
347* NOTES
348* internal, CALLBACK for DSA_Sort
349*/
350static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
351{
352 int ret;
353 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
354
355 if(!lpData) return 0;
356
357 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
358 TRACE("ret=%i\n",ret);
359 return ret;
360}
361
362/*************************************************************************
363 * ShellView_ListViewCompareItems
364 *
365 * Compare Function for the Listview (FileOpen Dialog)
366 *
367 * PARAMS
368 * lParam1 [I] the first ItemIdList to compare with
369 * lParam2 [I] the second ItemIdList to compare with
370 * lpData [I] The column ID for the header Ctrl to process
371 *
372 * RETURNS
373 * A negative value if the first item should precede the second,
374 * a positive value if the first item should follow the second,
375 * or zero if the two items are equivalent
376 *
377 * NOTES
378 * FIXME: function does what ShellView_CompareItems is supposed to do.
379 * unify it and figure out how to use the undocumented first parameter
380 * of IShellFolder_CompareIDs to do the job this function does and
381 * move this code to IShellFolder.
382 * make LISTVIEW_SORT_INFO obsolete
383 * the way this function works is only usable if we had only
384 * filesystemfolders (25/10/99 jsch)
385 */
386static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
387{
388 INT nDiff=0;
389 FILETIME fd1, fd2;
390 char strName1[MAX_PATH], strName2[MAX_PATH];
391 BOOL bIsFolder1, bIsFolder2,bIsBothFolder;
392 LPITEMIDLIST pItemIdList1 = (LPITEMIDLIST) lParam1;
393 LPITEMIDLIST pItemIdList2 = (LPITEMIDLIST) lParam2;
394 LISTVIEW_SORT_INFO *pSortInfo = (LPLISTVIEW_SORT_INFO) lpData;
395
396
397 bIsFolder1 = _ILIsFolder(pItemIdList1);
398 bIsFolder2 = _ILIsFolder(pItemIdList2);
399 bIsBothFolder = bIsFolder1 && bIsFolder2;
400
401 /* When sorting between a File and a Folder, the Folder gets sorted first */
402 if( (bIsFolder1 || bIsFolder2) && !bIsBothFolder)
403 {
404 nDiff = bIsFolder1 ? -1 : 1;
405 }
406 else
407 {
408 /* Sort by Time: Folders or Files can be sorted */
409
410 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME)
411 {
412 _ILGetFileDateTime(pItemIdList1, &fd1);
413 _ILGetFileDateTime(pItemIdList2, &fd2);
414 nDiff = CompareFileTime(&fd2, &fd1);
415 }
416 /* Sort by Attribute: Folder or Files can be sorted */
417 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB)
418 {
419 _ILGetAttributeStr(pItemIdList1, strName1, MAX_PATH);
420 _ILGetAttributeStr(pItemIdList2, strName2, MAX_PATH);
421 nDiff = strcmp(strName1, strName2);
422 }
423 /* Sort by FileName: Folder or Files can be sorted */
424 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder)
425 {
426 /* Sort by Text */
427 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
428 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
429 nDiff = strcmp(strName1, strName2);
430 }
431 /* Sort by File Size, Only valid for Files */
432 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE)
433 {
434 nDiff = (INT)(_ILGetFileSize(pItemIdList1, NULL, 0) - _ILGetFileSize(pItemIdList2, NULL, 0));
435 }
436 /* Sort by File Type, Only valid for Files */
437 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TYPE)
438 {
439 /* Sort by Type */
440 _ILGetFileType(pItemIdList1, strName1, MAX_PATH);
441 _ILGetFileType(pItemIdList2, strName2, MAX_PATH);
442 nDiff = strcmp(strName1, strName2);
443 }
444 }
445 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */
446
447 if(nDiff == 0)
448 {
449 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH);
450 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH);
451 nDiff = strcmp(strName1, strName2);
452 }
453
454 if(!pSortInfo->bIsAscending)
455 {
456 nDiff = -nDiff;
457 }
458
459 return nDiff;
460
461}
462
463/**********************************************************
464* ShellView_FillList()
465*
466* NOTES
467* internal
468*/
469
470static HRESULT ShellView_FillList(IShellViewImpl * This)
471{
472 LPENUMIDLIST pEnumIDList;
473 LPITEMIDLIST pidl;
474 DWORD dwFetched;
475 UINT i;
476 LVITEMA lvItem;
477 HRESULT hRes;
478 HDPA hdpa;
479
480 TRACE("%p\n",This);
481
482 /* get the itemlist from the shfolder*/
483 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
484 if (hRes != S_OK)
485 {
486 if (hRes==S_FALSE)
487 return(NOERROR);
488 return(hRes);
489 }
490
491 /* create a pointer array */
492 hdpa = pDPA_Create(16);
493 if (!hdpa)
494 {
495 return(E_OUTOFMEMORY);
496 }
497
498 /* copy the items into the array*/
499 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
500 {
501 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
502 {
503 SHFree(pidl);
504 }
505 }
506
507 /*sort the array*/
508 pDPA_Sort(hdpa, (PFNDPACOMPARE)ShellView_CompareItems, (LPARAM)This->pSFParent);
509
510 /*turn the listview's redrawing off*/
511 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0);
512
513 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/
514 {
515 pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i);
516 if (IncludeObject(This, pidl) == S_OK) /* in a commdlg This works as a filemask*/
517 {
518 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/
519 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
520 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/
521 lvItem.lParam = (LPARAM) pidl; /*set the item's data*/
522 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/
523 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
524 ListView_InsertItemA(This->hWndList, &lvItem);
525 }
526 else
527 SHFree(pidl); /* the listview has the COPY*/
528 }
529
530 /*turn the listview's redrawing back on and force it to draw*/
531 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0);
532 InvalidateRect(This->hWndList, NULL, TRUE);
533 UpdateWindow(This->hWndList);
534
535 IEnumIDList_Release(pEnumIDList); /* destroy the list*/
536 pDPA_Destroy(hdpa);
537
538 return S_OK;
539}
540
541/**********************************************************
542* ShellView_OnCreate()
543*/
544static LRESULT ShellView_OnCreate(IShellViewImpl * This)
545{
546#if 0
547 IDropTarget* pdt;
548#endif
549 TRACE("%p\n",This);
550
551 if(ShellView_CreateList(This))
552 {
553 if(ShellView_InitList(This))
554 {
555 ShellView_FillList(This);
556 }
557 }
558
559#if 0
560 /* This makes a chrash since we havn't called OleInititialize. But if we
561 do this call in DllMain it breaks some apps. The native shell32 does not
562 call OleInitialize and not even depend on ole32.dll.
563 But for some apps it works...*/
564 if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt)))
565 {
566 pRegisterDragDrop(This->hWnd, pdt);
567 IDropTarget_Release(pdt);
568 }
569#endif
570 return S_OK;
571}
572
573/**********************************************************
574 * #### Handling of the menus ####
575 */
576
577/**********************************************************
578* ShellView_BuildFileMenu()
579*/
580static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
581{ CHAR szText[MAX_PATH];
582 MENUITEMINFOA mii;
583 int nTools,i;
584 HMENU hSubMenu;
585
586 TRACE("(%p)\n",This);
587
588 hSubMenu = CreatePopupMenu();
589 if(hSubMenu)
590 { /*get the number of items in our global array*/
591 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){}
592
593 /*add the menu items*/
594 for(i = 0; i < nTools; i++)
595 {
596 LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
597
598 ZeroMemory(&mii, sizeof(mii));
599 mii.cbSize = sizeof(mii);
600 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
601
602 if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/
603 {
604 mii.fType = MFT_STRING;
605 mii.fState = MFS_ENABLED;
606 mii.dwTypeData = szText;
607 mii.wID = Tools[i].idCommand;
608 }
609 else
610 {
611 mii.fType = MFT_SEPARATOR;
612 }
613 /* tack This item onto the end of the menu */
614 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii);
615 }
616 }
617 TRACE("-- return (menu=0x%x)\n",hSubMenu);
618 return hSubMenu;
619}
620/**********************************************************
621* ShellView_MergeFileMenu()
622*/
623static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
624{ TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu);
625
626 if(hSubMenu)
627 { /*insert This item at the beginning of the menu */
628 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
629 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
630
631 }
632 TRACE("--\n");
633}
634
635/**********************************************************
636* ShellView_MergeViewMenu()
637*/
638
639static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
640{ MENUITEMINFOA mii;
641
642 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu);
643
644 if(hSubMenu)
645 { /*add a separator at the correct position in the menu*/
646 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
647
648 ZeroMemory(&mii, sizeof(mii));
649 mii.cbSize = sizeof(mii);
650 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;
651 mii.fType = MFT_STRING;
652 mii.dwTypeData = "View";
653 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");
654 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
655 }
656}
657
658/**********************************************************
659* ShellView_GetSelections()
660*
661* - fills the this->apidl list with the selected objects
662*
663* RETURNS
664* number of selected items
665*/
666static UINT ShellView_GetSelections(IShellViewImpl * This)
667{
668 LVITEMA lvItem;
669 UINT i = 0;
670
671 if (This->apidl)
672 {
673 SHFree(This->apidl);
674 }
675
676 This->cidl = ListView_GetSelectedCount(This->hWndList);
677 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
678
679 TRACE("selected=%i\n", This->cidl);
680
681 if(This->apidl)
682 {
683 TRACE("-- Items selected =%u\n", This->cidl);
684
685 ZeroMemory(&lvItem, sizeof(lvItem));
686 lvItem.mask = LVIF_STATE | LVIF_PARAM;
687 lvItem.stateMask = LVIS_SELECTED;
688
689 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl))
690 {
691 if(lvItem.state & LVIS_SELECTED)
692 {
693 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;
694 i++;
695 TRACE("-- selected Item found\n");
696 }
697 lvItem.iItem++;
698 }
699 }
700 return This->cidl;
701
702}
703/**********************************************************
704 * ShellView_DoContextMenu()
705 */
706static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault)
707{ UINT uCommand;
708 DWORD wFlags;
709 HMENU hMenu;
710 BOOL fExplore = FALSE;
711 HWND hwndTree = 0;
712 LPCONTEXTMENU pContextMenu = NULL;
713 IContextMenu * pCM = NULL;
714 CMINVOKECOMMANDINFO cmi;
715
716 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
717
718 /* look, what's selected and create a context menu object of it*/
719 if( ShellView_GetSelections(This) )
720 {
721 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl,
722 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);
723
724 if(pContextMenu)
725 {
726 TRACE("-- pContextMenu\n");
727 hMenu = CreatePopupMenu();
728
729 if( hMenu )
730 {
731 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
732 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
733 {
734 TRACE("-- explore mode\n");
735 fExplore = TRUE;
736 }
737
738 /* build the flags depending on what we can do with the selected item */
739 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
740
741 /* let the ContextMenu merge its items in */
742 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))
743 {
744 if( bDefault )
745 {
746 TRACE("-- get menu default command\n");
747 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS);
748 }
749 else
750 {
751 TRACE("-- track popup\n");
752 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
753 }
754
755 if(uCommand > 0)
756 {
757 TRACE("-- uCommand=%u\n", uCommand);
758 if (IsInCommDlg(This) && ((uCommand==IDM_EXPLORE) || (uCommand==IDM_OPEN)))
759 {
760 TRACE("-- dlg: OnDefaultCommand\n");
761 OnDefaultCommand(This);
762 }
763 else
764 {
765 TRACE("-- explore -- invoke command\n");
766 ZeroMemory(&cmi, sizeof(cmi));
767 cmi.cbSize = sizeof(cmi);
768 cmi.hwnd = This->hWndParent;
769 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
770 IContextMenu_InvokeCommand(pContextMenu, &cmi);
771 }
772 }
773 DestroyMenu(hMenu);
774 }
775 }
776 if (pContextMenu)
777 IContextMenu_Release(pContextMenu);
778 }
779 }
780 else /* background context menu */
781 {
782 hMenu = CreatePopupMenu();
783
784 pCM = ISvBgCm_Constructor();
785 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
786
787 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
788 DestroyMenu(hMenu);
789
790 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand);
791
792 ZeroMemory(&cmi, sizeof(cmi));
793 cmi.cbSize = sizeof(cmi);
794 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
795 cmi.hwnd = This->hWndParent;
796 IContextMenu_InvokeCommand(pCM, &cmi);
797
798 IContextMenu_Release(pCM);
799 }
800}
801
802/**********************************************************
803 * ##### message handling #####
804 */
805
806/**********************************************************
807* ShellView_OnSize()
808*/
809static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight)
810{
811 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight);
812
813 /*resize the ListView to fit our window*/
814 if(This->hWndList)
815 {
816 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);
817 }
818
819 return S_OK;
820}
821/**********************************************************
822* ShellView_OnDeactivate()
823*
824* NOTES
825* internal
826*/
827static void ShellView_OnDeactivate(IShellViewImpl * This)
828{
829 TRACE("%p\n",This);
830
831 if(This->uState != SVUIA_DEACTIVATE)
832 {
833 if(This->hMenu)
834 {
835 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);
836 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);
837 DestroyMenu(This->hMenu);
838 This->hMenu = 0;
839 }
840
841 This->uState = SVUIA_DEACTIVATE;
842 }
843}
844
845/**********************************************************
846* ShellView_OnActivate()
847*/
848static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
849{ OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
850 MENUITEMINFOA mii;
851 CHAR szText[MAX_PATH];
852
853 TRACE("%p uState=%x\n",This,uState);
854
855 /*don't do anything if the state isn't really changing */
856 if(This->uState == uState)
857 {
858 return S_OK;
859 }
860
861 ShellView_OnDeactivate(This);
862
863 /*only do This if we are active */
864 if(uState != SVUIA_DEACTIVATE)
865 {
866 /*merge the menus */
867 This->hMenu = CreateMenu();
868
869 if(This->hMenu)
870 {
871 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
872 TRACE("-- after fnInsertMenusSB\n");
873
874 /*build the top level menu get the menu item's text*/
875 strcpy(szText,"dummy 31");
876
877 ZeroMemory(&mii, sizeof(mii));
878 mii.cbSize = sizeof(mii);
879 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
880 mii.fType = MFT_STRING;
881 mii.fState = MFS_ENABLED;
882 mii.dwTypeData = szText;
883 mii.hSubMenu = ShellView_BuildFileMenu(This);
884
885 /*insert our menu into the menu bar*/
886 if(mii.hSubMenu)
887 {
888 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
889 }
890
891 /*get the view menu so we can merge with it*/
892 ZeroMemory(&mii, sizeof(mii));
893 mii.cbSize = sizeof(mii);
894 mii.fMask = MIIM_SUBMENU;
895
896 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
897 {
898 ShellView_MergeViewMenu(This, mii.hSubMenu);
899 }
900
901 /*add the items that should only be added if we have the focus*/
902 if(SVUIA_ACTIVATE_FOCUS == uState)
903 {
904 /*get the file menu so we can merge with it */
905 ZeroMemory(&mii, sizeof(mii));
906 mii.cbSize = sizeof(mii);
907 mii.fMask = MIIM_SUBMENU;
908
909 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
910 {
911 ShellView_MergeFileMenu(This, mii.hSubMenu);
912 }
913 }
914 TRACE("-- before fnSetMenuSB\n");
915 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
916 }
917 }
918 This->uState = uState;
919 TRACE("--\n");
920 return S_OK;
921}
922
923/**********************************************************
924* ShellView_OnSetFocus()
925*
926*/
927static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
928{
929 TRACE("%p\n",This);
930
931 /* Tell the browser one of our windows has received the focus. This
932 should always be done before merging menus (OnActivate merges the
933 menus) if one of our windows has the focus.*/
934
935 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
936 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
937
938 /* Set the focus to the listview */
939 SetFocus(This->hWndList);
940
941 /* Notify the ICommDlgBrowser interface */
942 OnStateChange(This,CDBOSC_SETFOCUS);
943
944 return 0;
945}
946
947/**********************************************************
948* ShellView_OnKillFocus()
949*/
950static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
951{
952 TRACE("(%p) stub\n",This);
953
954 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
955 /* Notify the ICommDlgBrowser */
956 OnStateChange(This,CDBOSC_KILLFOCUS);
957
958 return 0;
959}
960
961/**********************************************************
962* ShellView_OnCommand()
963*
964* NOTES
965* the CmdID's are the ones from the context menu
966*/
967static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
968{
969 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd);
970
971 switch(dwCmdID)
972 {
973 case FCIDM_SHVIEW_SMALLICON:
974 This->FolderSettings.ViewMode = FVM_SMALLICON;
975 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
976 CheckToolbar(This);
977 break;
978
979 case FCIDM_SHVIEW_BIGICON:
980 This->FolderSettings.ViewMode = FVM_ICON;
981 SetStyle (This, LVS_ICON, LVS_TYPEMASK);
982 CheckToolbar(This);
983 break;
984
985 case FCIDM_SHVIEW_LISTVIEW:
986 This->FolderSettings.ViewMode = FVM_LIST;
987 SetStyle (This, LVS_LIST, LVS_TYPEMASK);
988 CheckToolbar(This);
989 break;
990
991 case FCIDM_SHVIEW_REPORTVIEW:
992 This->FolderSettings.ViewMode = FVM_DETAILS;
993 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
994 CheckToolbar(This);
995 break;
996
997 /* the menu-ID's for sorting are 0x30... see shrec.rc */
998 case 0x30:
999 case 0x31:
1000 case 0x32:
1001 case 0x33:
1002 This->ListViewSortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30);
1003 This->ListViewSortInfo.bIsAscending = TRUE;
1004 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1005 ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));
1006 break;
1007
1008 default:
1009 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID);
1010 }
1011 return 0;
1012}
1013
1014/**********************************************************
1015* ShellView_OnNotify()
1016*/
1017
1018static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
1019{ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;
1020 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;
1021 LPITEMIDLIST pidl;
1022
1023 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);
1024
1025 switch(lpnmh->code)
1026 {
1027 case NM_SETFOCUS:
1028 TRACE("-- NM_SETFOCUS %p\n",This);
1029 ShellView_OnSetFocus(This);
1030 break;
1031
1032 case NM_KILLFOCUS:
1033 TRACE("-- NM_KILLFOCUS %p\n",This);
1034 ShellView_OnDeactivate(This);
1035 /* Notify the ICommDlgBrowser interface */
1036 OnStateChange(This,CDBOSC_KILLFOCUS);
1037 break;
1038
1039 case HDN_ENDTRACKA:
1040 TRACE("-- HDN_ENDTRACKA %p\n",This);
1041 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
1042 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1043 break;
1044
1045 case LVN_DELETEITEM:
1046 TRACE("-- LVN_DELETEITEM %p\n",This);
1047 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
1048 break;
1049
1050 case LVN_ITEMACTIVATE:
1051 TRACE("-- LVN_ITEMACTIVATE %p\n",This);
1052 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1053 ShellView_DoContextMenu(This, 0, 0, TRUE);
1054 break;
1055
1056 case LVN_COLUMNCLICK:
1057 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem;
1058 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID)
1059 {
1060 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending;
1061 }
1062 else
1063 {
1064 This->ListViewSortInfo.bIsAscending = TRUE;
1065 }
1066 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
1067
1068 ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));
1069 break;
1070
1071 case LVN_GETDISPINFOA:
1072 TRACE("-- LVN_GETDISPINFOA %p\n",This);
1073 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1074
1075 if(lpdi->item.mask & LVIF_TEXT) /* text requested */
1076 {
1077 if (This->pSF2Parent)
1078 {
1079 SHELLDETAILS sd;
1080 IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);
1081 StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);
1082 TRACE("-- text=%s\n",lpdi->item.pszText);
1083 }
1084 else
1085 {
1086 FIXME("no SF2\n");
1087 }
1088 }
1089 if(lpdi->item.mask & LVIF_IMAGE) /* image requested */
1090 {
1091 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
1092 }
1093 break;
1094
1095 case LVN_ITEMCHANGED:
1096 TRACE("-- LVN_ITEMCHANGED %p\n",This);
1097 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1098 break;
1099
1100 case LVN_BEGINDRAG:
1101 case LVN_BEGINRDRAG:
1102
1103 if (ShellView_GetSelections(This))
1104 {
1105 IDataObject * pda;
1106 DWORD dwAttributes;
1107 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
1108
1109 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))
1110 {
1111 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource); /* own DropSource interface */
1112
1113 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes)))
1114 {
1115 if (dwAttributes & SFGAO_CANLINK)
1116 {
1117 dwEffect |= DROPEFFECT_LINK;
1118 }
1119 }
1120
1121 if (pds)
1122 {
1123 DWORD dwEffect;
1124 pDoDragDrop(pda, pds, dwEffect, &dwEffect);
1125 }
1126
1127 IDataObject_Release(pda);
1128 }
1129 }
1130 break;
1131
1132 case LVN_BEGINLABELEDITA:
1133 case LVN_ENDLABELEDITA:
1134 FIXME("labeledit\n");
1135 break;
1136
1137 default:
1138// TRACE("-- %p WM_COMMAND %s unhandled\n", This, SPY_GetMsgName(lpnmh->code));
1139 break;;
1140 }
1141 return 0;
1142}
1143
1144/**********************************************************
1145* ShellView_WndProc
1146*/
1147
1148static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
1149{
1150 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA);
1151 LPCREATESTRUCTA lpcs;
1152
1153 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
1154
1155 switch (uMessage)
1156 {
1157 case WM_NCCREATE:
1158 lpcs = (LPCREATESTRUCTA)lParam;
1159 pThis = (IShellViewImpl*)(lpcs->lpCreateParams);
1160 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis);
1161 pThis->hWnd = hWnd; /*set the window handle*/
1162 break;
1163
1164 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
1165 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis);
1166 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis);
1167 case WM_CREATE: return ShellView_OnCreate(pThis);
1168 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1169 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
1170 case WM_COMMAND: return ShellView_OnCommand(pThis,
1171 GET_WM_COMMAND_ID(wParam, lParam),
1172 GET_WM_COMMAND_CMD(wParam, lParam),
1173 GET_WM_COMMAND_HWND(wParam, lParam));
1174
1175 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE);
1176 return 0;
1177
1178 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList);
1179 break;
1180
1181 case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0);
1182
1183 case WM_DESTROY: pRevokeDragDrop(pThis->hWnd);
1184 break;
1185 }
1186
1187 return DefWindowProcA (hWnd, uMessage, wParam, lParam);
1188}
1189/**********************************************************
1190*
1191*
1192* The INTERFACE of the IShellView object
1193*
1194*
1195**********************************************************
1196* IShellView_QueryInterface
1197*/
1198static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj)
1199{
1200 ICOM_THIS(IShellViewImpl, iface);
1201
1202 char xriid[50];
1203 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1204 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1205
1206 *ppvObj = NULL;
1207
1208 if(IsEqualIID(riid, &IID_IUnknown))
1209 {
1210 *ppvObj = This;
1211 }
1212 else if(IsEqualIID(riid, &IID_IShellView))
1213 {
1214 *ppvObj = (IShellView*)This;
1215 }
1216 else if(IsEqualIID(riid, &IID_IOleCommandTarget))
1217 {
1218 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget);
1219 }
1220 else if(IsEqualIID(riid, &IID_IDropTarget))
1221 {
1222 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);
1223 }
1224 else if(IsEqualIID(riid, &IID_IDropSource))
1225 {
1226 *ppvObj = (IDropSource*)&(This->lpvtblDropSource);
1227 }
1228 else if(IsEqualIID(riid, &IID_IViewObject))
1229 {
1230 *ppvObj = (IViewObject*)&(This->lpvtblViewObject);
1231 }
1232
1233 if(*ppvObj)
1234 {
1235 IUnknown_AddRef( (IUnknown*)*ppvObj );
1236 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1237 return S_OK;
1238 }
1239 TRACE("-- Interface: E_NOINTERFACE\n");
1240 return E_NOINTERFACE;
1241}
1242
1243/**********************************************************
1244* IShellView_AddRef
1245*/
1246static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
1247{
1248 ICOM_THIS(IShellViewImpl, iface);
1249
1250 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1251
1252 shell32_ObjCount++;
1253 return ++(This->ref);
1254}
1255/**********************************************************
1256* IShellView_Release
1257*/
1258static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
1259{
1260 ICOM_THIS(IShellViewImpl, iface);
1261
1262 TRACE("(%p)->()\n",This);
1263
1264 shell32_ObjCount--;
1265
1266 if (!--(This->ref))
1267 {
1268 TRACE(" destroying IShellView(%p)\n",This);
1269
1270 if(This->pSFParent)
1271 IShellFolder_Release(This->pSFParent);
1272
1273 if(This->pSF2Parent)
1274 IShellFolder2_Release(This->pSF2Parent);
1275
1276 if (This->apidl)
1277 SHFree(This->apidl);
1278
1279 if (This->pCommDlgBrowser)
1280 ICommDlgBrowser_Release(This->pCommDlgBrowser);
1281
1282 HeapFree(GetProcessHeap(),0,This);
1283 return 0;
1284 }
1285 return This->ref;
1286}
1287
1288/**********************************************************
1289* ShellView_GetWindow
1290*/
1291static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd)
1292{
1293 ICOM_THIS(IShellViewImpl, iface);
1294
1295 TRACE("(%p)\n",This);
1296
1297 *phWnd = This->hWnd;
1298
1299 return S_OK;
1300}
1301
1302static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode)
1303{
1304 ICOM_THIS(IShellViewImpl, iface);
1305
1306 FIXME("(%p) stub\n",This);
1307
1308 return E_NOTIMPL;
1309}
1310
1311/**********************************************************
1312* IShellView_TranslateAccelerator
1313*
1314* FIXME:
1315* use the accel functions
1316*/
1317static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG lpmsg)
1318{
1319 ICOM_THIS(IShellViewImpl, iface);
1320
1321#if 0
1322 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1323#endif
1324
1325 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST))
1326 {
1327 TRACE("-- key=0x04%x",lpmsg->wParam) ;
1328 }
1329 return S_FALSE; /* not handled */
1330}
1331
1332static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable)
1333{
1334 ICOM_THIS(IShellViewImpl, iface);
1335
1336 FIXME("(%p) stub\n",This);
1337
1338 return E_NOTIMPL;
1339}
1340
1341static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
1342{
1343 ICOM_THIS(IShellViewImpl, iface);
1344
1345/*
1346 CHAR szName[MAX_PATH];
1347*/
1348 LRESULT lResult;
1349 int nPartArray[1] = {-1};
1350
1351 TRACE("(%p)->(state=%x) stub\n",This, uState);
1352
1353 /*don't do anything if the state isn't really changing*/
1354 if(This->uState == uState)
1355 {
1356 return S_OK;
1357 }
1358
1359 /*OnActivate handles the menu merging and internal state*/
1360 ShellView_OnActivate(This, uState);
1361
1362 /*only do This if we are active*/
1363 if(uState != SVUIA_DEACTIVATE)
1364 {
1365
1366/*
1367 GetFolderPath is not a method of IShellFolder
1368 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1369*/
1370 /* set the number of parts */
1371 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1372 (LPARAM)nPartArray, &lResult);
1373
1374 /* set the text for the parts */
1375/*
1376 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1377 0, (LPARAM)szName, &lResult);
1378*/
1379 }
1380
1381 return S_OK;
1382}
1383
1384static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface)
1385{
1386 ICOM_THIS(IShellViewImpl, iface);
1387
1388 TRACE("(%p)\n",This);
1389
1390 ListView_DeleteAllItems(This->hWndList);
1391 ShellView_FillList(This);
1392
1393 return S_OK;
1394}
1395
1396static HRESULT WINAPI IShellView_fnCreateViewWindow(
1397 IShellView * iface,
1398 IShellView *lpPrevView,
1399 LPCFOLDERSETTINGS lpfs,
1400 IShellBrowser * psb,
1401 RECT * prcView,
1402 HWND *phWnd)
1403{
1404 ICOM_THIS(IShellViewImpl, iface);
1405
1406 WNDCLASSA wc;
1407 *phWnd = 0;
1408
1409
1410 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);
1411 TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom);
1412
1413 /*set up the member variables*/
1414 This->pShellBrowser = psb;
1415 This->FolderSettings = *lpfs;
1416
1417 /*get our parent window*/
1418 IShellBrowser_AddRef(This->pShellBrowser);
1419 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent));
1420
1421 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */
1422 This->pCommDlgBrowser=NULL;
1423 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser,
1424 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))
1425 {
1426 TRACE("-- CommDlgBrowser\n");
1427 }
1428
1429 /*if our window class has not been registered, then do so*/
1430//SvL: Don't check this now
1431// if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc))
1432// {
1433 ZeroMemory(&wc, sizeof(wc));
1434 wc.style = CS_HREDRAW | CS_VREDRAW;
1435 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc;
1436 wc.cbClsExtra = 0;
1437 wc.cbWndExtra = 0;
1438 wc.hInstance = shell32_hInstance;
1439 wc.hIcon = 0;
1440 wc.hCursor = LoadCursorA (0, IDC_ARROWA);
1441 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
1442 wc.lpszMenuName = NULL;
1443 wc.lpszClassName = SV_CLASS_NAME;
1444
1445 if(!RegisterClassA(&wc))
1446 return E_FAIL;
1447// }
1448
1449 *phWnd = CreateWindowExA(0,
1450 SV_CLASS_NAME,
1451 NULL,
1452 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP,
1453 prcView->left,
1454 prcView->top,
1455 prcView->right - prcView->left,
1456 prcView->bottom - prcView->top,
1457 This->hWndParent,
1458 0,
1459 shell32_hInstance,
1460 (LPVOID)This);
1461
1462 CheckToolbar(This);
1463
1464 if(!*phWnd)
1465 return E_FAIL;
1466
1467 return S_OK;
1468}
1469
1470static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
1471{
1472 ICOM_THIS(IShellViewImpl, iface);
1473
1474 TRACE("(%p)\n",This);
1475
1476 /*Make absolutely sure all our UI is cleaned up.*/
1477 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE);
1478
1479 if(This->hMenu)
1480 {
1481 DestroyMenu(This->hMenu);
1482 }
1483
1484 DestroyWindow(This->hWnd);
1485 IShellBrowser_Release(This->pShellBrowser);
1486
1487 return S_OK;
1488}
1489
1490static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs)
1491{
1492 ICOM_THIS(IShellViewImpl, iface);
1493
1494 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs,
1495 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
1496
1497 if (!lpfs) return E_INVALIDARG;
1498
1499 *lpfs = This->FolderSettings;
1500 return NOERROR;
1501}
1502
1503static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1504{
1505 ICOM_THIS(IShellViewImpl, iface);
1506
1507 FIXME("(%p) stub\n",This);
1508
1509 return E_NOTIMPL;
1510}
1511
1512static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface)
1513{
1514 ICOM_THIS(IShellViewImpl, iface);
1515
1516 FIXME("(%p) stub\n",This);
1517
1518 return S_OK;
1519}
1520
1521static HRESULT WINAPI IShellView_fnSelectItem(IShellView * iface, LPCITEMIDLIST pidlItem, UINT uFlags)
1522{ ICOM_THIS(IShellViewImpl, iface);
1523
1524 FIXME("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidlItem, uFlags);
1525
1526 return E_NOTIMPL;
1527}
1528
1529static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
1530{
1531 ICOM_THIS(IShellViewImpl, iface);
1532
1533 char xriid[50];
1534
1535 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1536 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, xriid, ppvOut);
1537
1538 *ppvOut = NULL;
1539
1540 switch(uItem)
1541 {
1542 case SVGIO_BACKGROUND:
1543 *ppvOut = ISvBgCm_Constructor();
1544 break;
1545
1546 case SVGIO_SELECTION:
1547 ShellView_GetSelections(This);
1548 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut);
1549 break;
1550 }
1551 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
1552
1553 if(!*ppvOut) return E_OUTOFMEMORY;
1554
1555 return S_OK;
1556}
1557
1558struct ICOM_VTABLE(IShellView) svvt =
1559{
1560 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1561 IShellView_fnQueryInterface,
1562 IShellView_fnAddRef,
1563 IShellView_fnRelease,
1564 IShellView_fnGetWindow,
1565 IShellView_fnContextSensitiveHelp,
1566 IShellView_fnTranslateAccelerator,
1567 IShellView_fnEnableModeless,
1568 IShellView_fnUIActivate,
1569 IShellView_fnRefresh,
1570 IShellView_fnCreateViewWindow,
1571 IShellView_fnDestroyViewWindow,
1572 IShellView_fnGetCurrentInfo,
1573 IShellView_fnAddPropertySheetPages,
1574 IShellView_fnSaveViewState,
1575 IShellView_fnSelectItem,
1576 IShellView_fnGetItemObject
1577};
1578
1579
1580/**********************************************************
1581 * ISVOleCmdTarget_QueryInterface (IUnknown)
1582 */
1583static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
1584 IOleCommandTarget * iface,
1585 REFIID iid,
1586 LPVOID* ppvObj)
1587{
1588 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1589
1590 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
1591}
1592
1593/**********************************************************
1594 * ISVOleCmdTarget_AddRef (IUnknown)
1595 */
1596static ULONG WINAPI ISVOleCmdTarget_AddRef(
1597 IOleCommandTarget * iface)
1598{
1599 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface);
1600
1601 return IShellFolder_AddRef((IShellFolder*)This);
1602}
1603
1604/**********************************************************
1605 * ISVOleCmdTarget_Release (IUnknown)
1606 */
1607static ULONG WINAPI ISVOleCmdTarget_Release(
1608 IOleCommandTarget * iface)
1609{
1610 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1611
1612 return IShellFolder_Release((IShellFolder*)This);
1613}
1614
1615/**********************************************************
1616 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
1617 */
1618static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
1619 IOleCommandTarget *iface,
1620 const GUID* pguidCmdGroup,
1621 ULONG cCmds,
1622 OLECMD * prgCmds,
1623 OLECMDTEXT* pCmdText)
1624{
1625 char xguid[50];
1626
1627 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1628
1629 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid);
1630
1631 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", This, pguidCmdGroup, xguid, cCmds, prgCmds, pCmdText);
1632 return E_NOTIMPL;
1633}
1634
1635/**********************************************************
1636 * ISVOleCmdTarget_Exec (IOleCommandTarget)
1637 *
1638 * nCmdID is the OLECMDID_* enumeration
1639 */
1640static HRESULT WINAPI ISVOleCmdTarget_Exec(
1641 IOleCommandTarget *iface,
1642 const GUID* pguidCmdGroup,
1643 DWORD nCmdID,
1644 DWORD nCmdexecopt,
1645 VARIANT* pvaIn,
1646 VARIANT* pvaOut)
1647{
1648 char xguid[50];
1649
1650 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1651
1652 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid);
1653
1654 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", This, xguid, nCmdID, nCmdexecopt, pvaIn, pvaOut);
1655 return E_NOTIMPL;
1656}
1657
1658ICOM_VTABLE(IOleCommandTarget) ctvt =
1659{
1660 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1661 ISVOleCmdTarget_QueryInterface,
1662 ISVOleCmdTarget_AddRef,
1663 ISVOleCmdTarget_Release,
1664 ISVOleCmdTarget_QueryStatus,
1665 ISVOleCmdTarget_Exec
1666};
1667
1668/**********************************************************
1669 * ISVDropTarget implementation
1670 */
1671
1672static HRESULT WINAPI ISVDropTarget_QueryInterface(
1673 IDropTarget *iface,
1674 REFIID riid,
1675 LPVOID *ppvObj)
1676{
1677 char xriid[50];
1678
1679 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1680
1681 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1682
1683 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1684
1685 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1686}
1687
1688static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
1689{
1690 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1691
1692 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1693
1694 return IShellFolder_AddRef((IShellFolder*)This);
1695}
1696
1697static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface)
1698{
1699 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1700
1701 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1702
1703 return IShellFolder_Release((IShellFolder*)This);
1704}
1705
1706static HRESULT WINAPI ISVDropTarget_DragEnter(
1707 IDropTarget *iface,
1708 IDataObject *pDataObject,
1709 DWORD grfKeyState,
1710 POINTL pt,
1711 DWORD *pdwEffect)
1712{
1713
1714 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1715
1716 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject);
1717
1718 return E_NOTIMPL;
1719}
1720
1721static HRESULT WINAPI ISVDropTarget_DragOver(
1722 IDropTarget *iface,
1723 DWORD grfKeyState,
1724 POINTL pt,
1725 DWORD *pdwEffect)
1726{
1727 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1728
1729 FIXME("Stub: This=%p\n",This);
1730
1731 return E_NOTIMPL;
1732}
1733
1734static HRESULT WINAPI ISVDropTarget_DragLeave(
1735 IDropTarget *iface)
1736{
1737 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1738
1739 FIXME("Stub: This=%p\n",This);
1740
1741 return E_NOTIMPL;
1742}
1743
1744static HRESULT WINAPI ISVDropTarget_Drop(
1745 IDropTarget *iface,
1746 IDataObject* pDataObject,
1747 DWORD grfKeyState,
1748 POINTL pt,
1749 DWORD *pdwEffect)
1750{
1751 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1752
1753 FIXME("Stub: This=%p\n",This);
1754
1755 return E_NOTIMPL;
1756}
1757
1758struct ICOM_VTABLE(IDropTarget) dtvt =
1759{
1760 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1761 ISVDropTarget_QueryInterface,
1762 ISVDropTarget_AddRef,
1763 ISVDropTarget_Release,
1764 ISVDropTarget_DragEnter,
1765 ISVDropTarget_DragOver,
1766 ISVDropTarget_DragLeave,
1767 ISVDropTarget_Drop
1768};
1769
1770/**********************************************************
1771 * ISVDropSource implementation
1772 */
1773
1774static HRESULT WINAPI ISVDropSource_QueryInterface(
1775 IDropSource *iface,
1776 REFIID riid,
1777 LPVOID *ppvObj)
1778{
1779 char xriid[50];
1780
1781 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
1782
1783 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1784
1785 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1786
1787 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1788}
1789
1790static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface)
1791{
1792 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
1793
1794 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1795
1796 return IShellFolder_AddRef((IShellFolder*)This);
1797}
1798
1799static ULONG WINAPI ISVDropSource_Release( IDropSource *iface)
1800{
1801 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
1802
1803 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1804
1805 return IShellFolder_Release((IShellFolder*)This);
1806}
1807static HRESULT WINAPI ISVDropSource_QueryContinueDrag(
1808 IDropSource *iface,
1809 BOOL fEscapePressed,
1810 DWORD grfKeyState)
1811{
1812 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
1813 TRACE("(%p)\n",This);
1814
1815 if (fEscapePressed)
1816 return DRAGDROP_S_CANCEL;
1817 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))
1818 return DRAGDROP_S_DROP;
1819 else
1820 return NOERROR;
1821}
1822
1823static HRESULT WINAPI ISVDropSource_GiveFeedback(
1824 IDropSource *iface,
1825 DWORD dwEffect)
1826{
1827 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);
1828 TRACE("(%p)\n",This);
1829
1830 return DRAGDROP_S_USEDEFAULTCURSORS;
1831}
1832
1833struct ICOM_VTABLE(IDropSource) dsvt =
1834{
1835 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1836 ISVDropSource_QueryInterface,
1837 ISVDropSource_AddRef,
1838 ISVDropSource_Release,
1839 ISVDropSource_QueryContinueDrag,
1840 ISVDropSource_GiveFeedback
1841};
1842/**********************************************************
1843 * ISVViewObject implementation
1844 */
1845
1846static HRESULT WINAPI ISVViewObject_QueryInterface(
1847 IViewObject *iface,
1848 REFIID riid,
1849 LPVOID *ppvObj)
1850{
1851 char xriid[50];
1852
1853 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1854
1855 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1856
1857 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1858
1859 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1860}
1861
1862static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface)
1863{
1864 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1865
1866 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1867
1868 return IShellFolder_AddRef((IShellFolder*)This);
1869}
1870
1871static ULONG WINAPI ISVViewObject_Release( IViewObject *iface)
1872{
1873 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1874
1875 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1876
1877 return IShellFolder_Release((IShellFolder*)This);
1878}
1879
1880static HRESULT WINAPI ISVViewObject_Draw(
1881 IViewObject *iface,
1882 DWORD dwDrawAspect,
1883 LONG lindex,
1884 void* pvAspect,
1885 DVTARGETDEVICE* ptd,
1886 HDC hdcTargetDev,
1887 HDC hdcDraw,
1888 LPCRECTL lprcBounds,
1889 LPCRECTL lprcWBounds,
1890 IVO_ContCallback pfnContinue,
1891 DWORD dwContinue)
1892{
1893
1894 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1895
1896 FIXME("Stub: This=%p\n",This);
1897
1898 return E_NOTIMPL;
1899}
1900static HRESULT WINAPI ISVViewObject_GetColorSet(
1901 IViewObject *iface,
1902 DWORD dwDrawAspect,
1903 LONG lindex,
1904 void *pvAspect,
1905 DVTARGETDEVICE* ptd,
1906 HDC hicTargetDevice,
1907 tagLOGPALETTE** ppColorSet)
1908{
1909
1910 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1911
1912 FIXME("Stub: This=%p\n",This);
1913
1914 return E_NOTIMPL;
1915}
1916static HRESULT WINAPI ISVViewObject_Freeze(
1917 IViewObject *iface,
1918 DWORD dwDrawAspect,
1919 LONG lindex,
1920 void* pvAspect,
1921 DWORD* pdwFreeze)
1922{
1923
1924 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1925
1926 FIXME("Stub: This=%p\n",This);
1927
1928 return E_NOTIMPL;
1929}
1930static HRESULT WINAPI ISVViewObject_Unfreeze(
1931 IViewObject *iface,
1932 DWORD dwFreeze)
1933{
1934
1935 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1936
1937 FIXME("Stub: This=%p\n",This);
1938
1939 return E_NOTIMPL;
1940}
1941static HRESULT WINAPI ISVViewObject_SetAdvise(
1942 IViewObject *iface,
1943 DWORD aspects,
1944 DWORD advf,
1945 IAdviseSink* pAdvSink)
1946{
1947
1948 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1949
1950 FIXME("Stub: This=%p\n",This);
1951
1952 return E_NOTIMPL;
1953}
1954static HRESULT WINAPI ISVViewObject_GetAdvise(
1955 IViewObject *iface,
1956 DWORD* pAspects,
1957 DWORD* pAdvf,
1958 IAdviseSink** ppAdvSink)
1959{
1960
1961 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1962
1963 FIXME("Stub: This=%p\n",This);
1964
1965 return E_NOTIMPL;
1966}
1967
1968
1969struct ICOM_VTABLE(IViewObject) vovt =
1970{
1971 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1972 ISVViewObject_QueryInterface,
1973 ISVViewObject_AddRef,
1974 ISVViewObject_Release,
1975 ISVViewObject_Draw,
1976 ISVViewObject_GetColorSet,
1977 ISVViewObject_Freeze,
1978 ISVViewObject_Unfreeze,
1979 ISVViewObject_SetAdvise,
1980 ISVViewObject_GetAdvise
1981};
1982
Note: See TracBrowser for help on using the repository browser.