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

Last change on this file since 3217 was 3217, checked in by cbratschi, 25 years ago

bug fixes

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