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

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

Add: updated to WINE19991108

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