Eliminated warnings.
[wine.git] / dlls / shell32 / shlview.c
blob2b99feac500aee5b4966867aae9e769133ff093b
1 /*
2 * ShellView
4 * Copyright 1998 <juergen.schmied@metronet.de>
6 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
7 * Release() ???
9 */
11 #include <stdlib.h>
12 #include <string.h>
14 #include "servprov.h"
15 #include "wine/obj_base.h"
16 #include "wine/obj_shellfolder.h"
17 #include "wine/obj_shellview.h"
18 #include "wine/obj_commdlgbrowser.h"
19 #include "wine/obj_shellbrowser.h"
20 #include "wine/obj_dockingwindowframe.h"
21 #include "wine/obj_extracticon.h"
23 #include "shresdef.h"
24 #include "spy.h"
25 #include "debugtools.h"
26 #include "winerror.h"
28 #include "docobj.h"
29 #include "pidl.h"
30 #include "shell32_main.h"
32 DEFAULT_DEBUG_CHANNEL(shell)
34 typedef struct
35 { ICOM_VTABLE(IShellView)* lpvtbl;
36 DWORD ref;
37 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget;
38 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
39 ICOM_VTABLE(IViewObject)* lpvtblViewObject;
40 IShellFolder* pSFParent;
41 IShellBrowser* pShellBrowser;
42 ICommDlgBrowser* pCommDlgBrowser;
43 HWND hWnd;
44 HWND hWndList;
45 HWND hWndParent;
46 FOLDERSETTINGS FolderSettings;
47 HMENU hMenu;
48 UINT uState;
49 UINT cidl;
50 LPITEMIDLIST *apidl;
51 } IShellViewImpl;
53 static struct ICOM_VTABLE(IShellView) svvt;
55 static struct ICOM_VTABLE(IOleCommandTarget) ctvt;
56 #define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget)))
57 #define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset);
59 static struct ICOM_VTABLE(IDropTarget) dtvt;
60 #define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget)))
61 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset);
63 static struct ICOM_VTABLE(IViewObject) vovt;
64 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject)))
65 #define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset);
67 /*menu items */
68 #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
69 #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
70 #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
72 #define ID_LISTVIEW 2000
74 #define TOOLBAR_ID (L"SHELLDLL_DefView")
75 /*windowsx.h */
76 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
77 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
78 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
79 /* winuser.h */
80 #define WM_SETTINGCHANGE WM_WININICHANGE
81 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
82 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState);
84 typedef struct
85 { int idCommand;
86 int iImage;
87 int idButtonString;
88 int idMenuString;
89 int nStringOffset;
90 BYTE bState;
91 BYTE bStyle;
92 } MYTOOLINFO, *LPMYTOOLINFO;
95 MYTOOLINFO g_Tools[] =
96 { {IDM_VIEW_FILES, 0, IDS_TB_VIEW_FILES, IDS_MI_VIEW_FILES, 0, TBSTATE_ENABLED, TBSTYLE_BUTTON},
97 {-1, 0, 0, 0, 0, 0, 0}
100 BOOL g_bViewKeys;
101 BOOL g_bShowIDW;
103 typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
105 /**********************************************************
106 * IShellView_Constructor
108 IShellView * IShellView_Constructor( IShellFolder * pFolder)
109 { IShellViewImpl * sv;
110 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
111 sv->ref=1;
112 sv->lpvtbl=&svvt;
113 sv->lpvtblOleCommandTarget=&ctvt;
114 sv->lpvtblDropTarget=&dtvt;
115 sv->lpvtblViewObject=&vovt;
117 sv->pSFParent = pFolder;
119 if(pFolder)
120 IShellFolder_AddRef(pFolder);
122 TRACE("(%p)->(%p)\n",sv, pFolder);
123 shell32_ObjCount++;
124 return (IShellView *) sv;
127 /**********************************************************
129 * ##### helperfunctions for communication with ICommDlgBrowser #####
131 static BOOL IsInCommDlg(IShellViewImpl * This)
132 { return(This->pCommDlgBrowser != NULL);
135 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
137 HRESULT ret = S_OK;
139 if ( IsInCommDlg(This) )
141 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
142 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl);
143 TRACE("--0x%08lx\n", ret);
145 return ret;
148 static HRESULT OnDefaultCommand(IShellViewImpl * This)
150 HRESULT ret = S_FALSE;
152 if (IsInCommDlg(This))
154 TRACE("ICommDlgBrowser::OnDefaultCommand\n");
155 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);
156 TRACE("--\n");
158 return ret;
161 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
163 HRESULT ret = S_FALSE;
165 if (IsInCommDlg(This))
167 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
168 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags);
169 TRACE("--\n");
171 return ret;
173 /**********************************************************
175 * ##### helperfunctions for initializing the view #####
177 /**********************************************************
178 * set the toolbar buttons
180 static void CheckToolbar(IShellViewImpl * This)
182 LRESULT result;
184 TRACE("\n");
186 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
187 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);
188 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
189 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);
190 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
191 FCIDM_TB_SMALLICON, TRUE, &result);
192 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
193 FCIDM_TB_REPORTVIEW, TRUE, &result);
196 /**********************************************************
197 * change the style of the listview control
200 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
202 DWORD tmpstyle;
204 TRACE("(%p)\n", This);
206 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE);
207 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
210 /**********************************************************
211 * ShellView_CreateList()
214 static BOOL ShellView_CreateList (IShellViewImpl * This)
215 { DWORD dwStyle;
217 TRACE("%p\n",This);
219 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER |
220 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
222 switch (This->FolderSettings.ViewMode)
224 case FVM_ICON: dwStyle |= LVS_ICON; break;
225 case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
226 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
227 case FVM_LIST: dwStyle |= LVS_LIST; break;
228 default: dwStyle |= LVS_LIST; break;
231 if (This->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
232 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
233 if (This->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
235 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE,
236 WC_LISTVIEWA,
237 NULL,
238 dwStyle,
239 0,0,0,0,
240 This->hWnd,
241 (HMENU)ID_LISTVIEW,
242 shell32_hInstance,
243 NULL);
245 if(!This->hWndList)
246 return FALSE;
248 /* UpdateShellSettings(); */
249 return TRUE;
251 /**********************************************************
252 * ShellView_InitList()
254 int nColumn1=120; /* width of column */
255 int nColumn2=80;
256 int nColumn3=170;
257 int nColumn4=60;
259 static BOOL ShellView_InitList(IShellViewImpl * This)
261 LVCOLUMNA lvColumn;
262 CHAR szString[50];
264 TRACE("%p\n",This);
266 ListView_DeleteAllItems(This->hWndList);
268 /*initialize the columns */
269 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/
270 lvColumn.fmt = LVCFMT_LEFT;
271 lvColumn.pszText = szString;
273 lvColumn.cx = nColumn1;
274 strcpy(szString,"File");
275 /*LoadStringA(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/
276 ListView_InsertColumnA(This->hWndList, 0, &lvColumn);
278 lvColumn.cx = nColumn2;
279 strcpy(szString,"Size");
280 ListView_InsertColumnA(This->hWndList, 1, &lvColumn);
282 lvColumn.cx = nColumn3;
283 strcpy(szString,"Type");
284 ListView_InsertColumnA(This->hWndList, 2, &lvColumn);
286 lvColumn.cx = nColumn4;
287 strcpy(szString,"Modified");
288 ListView_InsertColumnA(This->hWndList, 3, &lvColumn);
290 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL);
291 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL);
293 return TRUE;
295 /**********************************************************
296 * ShellView_CompareItems()
298 * NOTES
299 * internal, CALLBACK for DSA_Sort
301 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
303 int ret;
304 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
306 if(!lpData) return 0;
308 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2));
309 TRACE("ret=%i\n",ret);
310 return ret;
313 /**********************************************************
314 * ShellView_FillList()
316 * NOTES
317 * internal
320 static HRESULT ShellView_FillList(IShellViewImpl * This)
322 LPENUMIDLIST pEnumIDList;
323 LPITEMIDLIST pidl;
324 DWORD dwFetched;
325 UINT i;
326 LVITEMA lvItem;
327 HRESULT hRes;
328 HDPA hdpa;
330 TRACE("%p\n",This);
332 /* get the itemlist from the shfolder*/
333 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
334 if (hRes != S_OK)
336 if (hRes==S_FALSE)
337 return(NOERROR);
338 return(hRes);
341 /* create a pointer array */
342 hdpa = pDPA_Create(16);
343 if (!hdpa)
345 return(E_OUTOFMEMORY);
348 /* copy the items into the array*/
349 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
351 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
353 SHFree(pidl);
357 /*sort the array*/
358 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
360 /*turn the listview's redrawing off*/
361 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0);
363 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/
365 pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i);
366 if (IncludeObject(This, pidl) == S_OK) /* in a commdlg This works as a filemask*/
368 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/
369 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
370 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/
371 lvItem.lParam = (LPARAM) pidl; /*set the item's data*/
372 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/
373 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
374 ListView_InsertItemA(This->hWndList, &lvItem);
376 else
377 SHFree(pidl); /* the listview has the COPY*/
380 /*turn the listview's redrawing back on and force it to draw*/
381 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0);
382 InvalidateRect(This->hWndList, NULL, TRUE);
383 UpdateWindow(This->hWndList);
385 IEnumIDList_Release(pEnumIDList); /* destroy the list*/
386 pDPA_Destroy(hdpa);
388 return S_OK;
391 /**********************************************************
392 * ShellView_OnCreate()
394 static LRESULT ShellView_OnCreate(IShellViewImpl * This)
396 TRACE("%p\n",This);
398 if(ShellView_CreateList(This))
400 if(ShellView_InitList(This))
402 ShellView_FillList(This);
405 return S_OK;
408 /**********************************************************
409 * #### Handling of the menus ####
412 /**********************************************************
413 * ShellView_BuildFileMenu()
415 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
416 { CHAR szText[MAX_PATH];
417 MENUITEMINFOA mii;
418 int nTools,i;
419 HMENU hSubMenu;
421 TRACE("(%p) semi-stub\n",This);
423 hSubMenu = CreatePopupMenu();
424 if(hSubMenu)
425 { /*get the number of items in our global array*/
426 for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){}
428 /*add the menu items*/
429 for(i = 0; i < nTools; i++)
430 { strcpy(szText, "dummy BuildFileMenu");
432 ZeroMemory(&mii, sizeof(mii));
433 mii.cbSize = sizeof(mii);
434 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
436 if(TBSTYLE_SEP != g_Tools[i].bStyle) /* no seperator*/
437 { mii.fType = MFT_STRING;
438 mii.fState = MFS_ENABLED;
439 mii.dwTypeData = szText;
440 mii.wID = g_Tools[i].idCommand;
442 else
443 { mii.fType = MFT_SEPARATOR;
445 /* tack This item onto the end of the menu */
446 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii);
449 TRACE("-- return (menu=0x%x)\n",hSubMenu);
450 return hSubMenu;
452 /**********************************************************
453 * ShellView_MergeFileMenu()
455 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
456 { TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu);
458 if(hSubMenu)
459 { /*insert This item at the beginning of the menu */
460 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
461 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
464 TRACE("--\n");
467 /**********************************************************
468 * ShellView_MergeViewMenu()
471 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
472 { MENUITEMINFOA mii;
474 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu);
476 if(hSubMenu)
477 { /*add a separator at the correct position in the menu*/
478 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
480 ZeroMemory(&mii, sizeof(mii));
481 mii.cbSize = sizeof(mii);
482 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;
483 mii.fType = MFT_STRING;
484 mii.dwTypeData = "View";
485 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");
486 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
490 /**********************************************************
491 * ShellView_GetSelections()
493 * RETURNS
494 * number of selected items
496 static UINT ShellView_GetSelections(IShellViewImpl * This)
498 LVITEMA lvItem;
499 UINT i = 0;
501 if (This->apidl)
503 SHFree(This->apidl);
506 This->cidl = ListView_GetSelectedCount(This->hWndList);
507 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
509 TRACE("selected=%i\n", This->cidl);
511 if(This->apidl)
513 TRACE("-- Items selected =%u\n", This->cidl);
515 ZeroMemory(&lvItem, sizeof(lvItem));
516 lvItem.mask = LVIF_STATE | LVIF_PARAM;
517 lvItem.stateMask = LVIS_SELECTED;
519 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl))
521 if(lvItem.state & LVIS_SELECTED)
523 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;
524 i++;
525 TRACE("-- selected Item found\n");
527 lvItem.iItem++;
530 return This->cidl;
533 /**********************************************************
534 * ShellView_DoContextMenu()
536 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault)
537 { UINT uCommand;
538 DWORD wFlags;
539 HMENU hMenu;
540 BOOL fExplore = FALSE;
541 HWND hwndTree = 0;
542 LPCONTEXTMENU pContextMenu = NULL;
543 IContextMenu * pCM = NULL;
544 CMINVOKECOMMANDINFO cmi;
546 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);
548 /* look, what's selected and create a context menu object of it*/
549 if( ShellView_GetSelections(This) )
551 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl,
552 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);
554 if(pContextMenu)
556 TRACE("-- pContextMenu\n");
557 hMenu = CreatePopupMenu();
559 if( hMenu )
561 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/
562 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
564 TRACE("-- explore mode\n");
565 fExplore = TRUE;
568 /* build the flags depending on what we can do with the selected item */
569 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
571 /* let the ContextMenu merge its items in */
572 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))
574 if( bDefault )
576 TRACE("-- get menu default command\n");
577 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS);
579 else
581 TRACE("-- track popup\n");
582 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
585 if(uCommand > 0)
587 TRACE("-- uCommand=%u\n", uCommand);
588 if (IsInCommDlg(This) && ((uCommand==IDM_EXPLORE) || (uCommand==IDM_OPEN)))
590 TRACE("-- dlg: OnDefaultCommand\n");
591 OnDefaultCommand(This);
593 else
595 TRACE("-- explore -- invoke command\n");
596 ZeroMemory(&cmi, sizeof(cmi));
597 cmi.cbSize = sizeof(cmi);
598 cmi.hwnd = This->hWndParent;
599 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
600 IContextMenu_InvokeCommand(pContextMenu, &cmi);
603 DestroyMenu(hMenu);
606 if (pContextMenu)
607 IContextMenu_Release(pContextMenu);
610 else /* background context menu */
612 hMenu = CreatePopupMenu();
614 pCM = ISvBgCm_Constructor();
615 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
617 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
618 DestroyMenu(hMenu);
620 FIXME("-- (%p)->(uCommand=0x%08x )\n",This, uCommand);
622 ZeroMemory(&cmi, sizeof(cmi));
623 cmi.cbSize = sizeof(cmi);
624 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);
625 cmi.hwnd = This->hWndParent;
626 IContextMenu_InvokeCommand(pCM, &cmi);
628 IContextMenu_Release(pCM);
632 /**********************************************************
633 * ##### message handling #####
636 /**********************************************************
637 * ShellView_OnSize()
639 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight)
641 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight);
643 /*resize the ListView to fit our window*/
644 if(This->hWndList)
646 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);
649 return S_OK;
651 /**********************************************************
652 * ShellView_OnDeactivate()
654 * NOTES
655 * internal
657 static void ShellView_OnDeactivate(IShellViewImpl * This)
659 TRACE("%p\n",This);
661 if(This->uState != SVUIA_DEACTIVATE)
663 if(This->hMenu)
665 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);
666 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);
667 DestroyMenu(This->hMenu);
668 This->hMenu = 0;
671 This->uState = SVUIA_DEACTIVATE;
675 /**********************************************************
676 * ShellView_OnActivate()
678 static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
679 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
680 MENUITEMINFOA mii;
681 CHAR szText[MAX_PATH];
683 TRACE("%p uState=%x\n",This,uState);
685 /*don't do anything if the state isn't really changing */
686 if(This->uState == uState)
688 return S_OK;
691 ShellView_OnDeactivate(This);
693 /*only do This if we are active */
694 if(uState != SVUIA_DEACTIVATE)
696 /*merge the menus */
697 This->hMenu = CreateMenu();
699 if(This->hMenu)
701 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
702 TRACE("-- after fnInsertMenusSB\n");
704 /*build the top level menu get the menu item's text*/
705 strcpy(szText,"dummy 31");
707 ZeroMemory(&mii, sizeof(mii));
708 mii.cbSize = sizeof(mii);
709 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
710 mii.fType = MFT_STRING;
711 mii.fState = MFS_ENABLED;
712 mii.dwTypeData = szText;
713 mii.hSubMenu = ShellView_BuildFileMenu(This);
715 /*insert our menu into the menu bar*/
716 if(mii.hSubMenu)
718 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
721 /*get the view menu so we can merge with it*/
722 ZeroMemory(&mii, sizeof(mii));
723 mii.cbSize = sizeof(mii);
724 mii.fMask = MIIM_SUBMENU;
726 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
728 ShellView_MergeViewMenu(This, mii.hSubMenu);
731 /*add the items that should only be added if we have the focus*/
732 if(SVUIA_ACTIVATE_FOCUS == uState)
734 /*get the file menu so we can merge with it */
735 ZeroMemory(&mii, sizeof(mii));
736 mii.cbSize = sizeof(mii);
737 mii.fMask = MIIM_SUBMENU;
739 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
741 ShellView_MergeFileMenu(This, mii.hSubMenu);
744 TRACE("-- before fnSetMenuSB\n");
745 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
748 This->uState = uState;
749 TRACE("--\n");
750 return S_OK;
753 /**********************************************************
754 * ShellView_OnSetFocus()
757 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
759 TRACE("%p\n",This);
761 /* Tell the browser one of our windows has received the focus. This
762 should always be done before merging menus (OnActivate merges the
763 menus) if one of our windows has the focus.*/
765 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
766 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
768 return 0;
771 /**********************************************************
772 * ShellView_OnKillFocus()
774 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
776 TRACE("(%p) stub\n",This);
778 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
780 return 0;
783 /**********************************************************
784 * ShellView_OnCommand()
786 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
788 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd);
790 switch(dwCmdID)
792 case FCIDM_SHVIEW_SMALLICON:
793 This->FolderSettings.ViewMode = FVM_SMALLICON;
794 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
795 break;
797 case FCIDM_SHVIEW_BIGICON:
798 This->FolderSettings.ViewMode = FVM_ICON;
799 SetStyle (This, LVS_ICON, LVS_TYPEMASK);
800 break;
802 case FCIDM_SHVIEW_LISTVIEW:
803 This->FolderSettings.ViewMode = FVM_LIST;
804 SetStyle (This, LVS_LIST, LVS_TYPEMASK);
805 break;
807 case FCIDM_SHVIEW_REPORTVIEW:
808 This->FolderSettings.ViewMode = FVM_DETAILS;
809 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
810 break;
812 default:
813 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID);
815 return 0;
818 /**********************************************************
819 * ShellView_OnNotify()
822 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
823 { NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh;
824 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;
825 LPITEMIDLIST pidl;
826 DWORD dwCursor;
827 STRRET str;
829 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);
831 switch(lpnmh->code)
833 case NM_SETFOCUS:
834 TRACE("-- NM_SETFOCUS %p\n",This);
835 ShellView_OnSetFocus(This);
836 break;
838 case NM_KILLFOCUS:
839 TRACE("-- NM_KILLFOCUS %p\n",This);
840 ShellView_OnDeactivate(This);
841 break;
843 case HDN_ENDTRACKA:
844 TRACE("-- HDN_ENDTRACKA %p\n",This);
845 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
846 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
847 break;
849 case LVN_DELETEITEM:
850 TRACE("-- LVN_DELETEITEM %p\n",This);
851 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
852 break;
854 case LVN_ITEMACTIVATE:
855 TRACE("-- LVN_ITEMACTIVATE %p\n",This);
856 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
857 ShellView_DoContextMenu(This, 0, 0, TRUE);
858 break;
860 case NM_RCLICK:
861 TRACE("-- NM_RCLICK %p\n",This);
862 dwCursor = GetMessagePos();
863 ShellView_DoContextMenu(This, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
864 break;
866 case LVN_GETDISPINFOA:
867 TRACE("-- LVN_GETDISPINFOA %p\n",This);
868 pidl = (LPITEMIDLIST)lpdi->item.lParam;
871 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/
872 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
873 { if(_ILIsValue(pidl)) /*is This a value or a folder?*/
874 { switch (lpdi->item.iSubItem)
875 { case 1: /* size */
876 _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
877 break;
878 case 2: /* extension */
879 { char sTemp[64];
880 if (_ILGetExtension (pidl, sTemp, 64))
881 { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64)
882 && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax )))
883 { lstrcpynA (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax);
884 strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax);
887 else /* no extension found */
888 { lpdi->item.pszText[0]=0x00;
891 break;
892 case 3: /* date */
893 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
894 break;
897 else /*its a folder*/
898 { switch (lpdi->item.iSubItem)
899 { case 1:
900 strcpy(lpdi->item.pszText, "");
901 break;
902 case 2:
903 lstrcpynA (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax);
904 break;
905 case 3:
906 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
907 break;
910 TRACE("-- text=%s\n",lpdi->item.pszText);
913 else /*the item text is being requested*/
914 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
915 { if(SUCCEEDED(IShellFolder_GetDisplayNameOf(This->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)))
916 { if(STRRET_WSTR == str.uType)
917 { WideCharToLocal(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax);
918 SHFree(str.u.pOleStr);
920 else if(STRRET_CSTRA == str.uType)
921 { lstrcpynA(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax);
923 else
924 { FIXME("type wrong\n");
927 TRACE("-- text=%s\n",lpdi->item.pszText);
930 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/
931 { lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
934 break;
936 case LVN_ITEMCHANGED:
937 TRACE("-- LVN_ITEMCHANGED %p\n",This);
938 /* ShellView_GetSelections(This); */
939 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
940 break;
942 default:
943 TRACE("-- %p WM_COMMAND %s unhandled\n", This, SPY_GetMsgName(lpnmh->code));
944 break;;
946 return 0;
949 /**********************************************************
950 * ShellView_WndProc
953 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
955 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA);
956 LPCREATESTRUCTA lpcs;
957 DWORD dwCursor;
959 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
961 switch (uMessage)
963 case WM_NCCREATE:
964 lpcs = (LPCREATESTRUCTA)lParam;
965 pThis = (IShellViewImpl*)(lpcs->lpCreateParams);
966 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis);
967 pThis->hWnd = hWnd; /*set the window handle*/
968 break;
970 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
971 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis);
972 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis);
973 case WM_CREATE: return ShellView_OnCreate(pThis);
974 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
975 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
976 case WM_COMMAND: return ShellView_OnCommand(pThis,
977 GET_WM_COMMAND_ID(wParam, lParam),
978 GET_WM_COMMAND_CMD(wParam, lParam),
979 GET_WM_COMMAND_HWND(wParam, lParam));
981 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList);
982 break;
984 case WM_PARENTNOTIFY:
985 /* fixme: should not be handled here*/
986 TRACE("-- WM_PARENTNOTIFY\n");
987 if ( LOWORD(wParam) == WM_RBUTTONDOWN )
989 dwCursor = GetMessagePos();
990 ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
991 return TRUE;
993 break;
995 default:
996 TRACE("-- message %s unhandled\n", SPY_GetMsgName(uMessage));
997 break;
1000 return DefWindowProcA (hWnd, uMessage, wParam, lParam);
1002 /**********************************************************
1005 * The INTERFACE of the IShellView object
1008 **********************************************************
1009 * IShellView_QueryInterface
1011 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj)
1013 ICOM_THIS(IShellViewImpl, iface);
1015 char xriid[50];
1016 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1017 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1019 *ppvObj = NULL;
1021 if(IsEqualIID(riid, &IID_IUnknown))
1023 *ppvObj = This;
1025 else if(IsEqualIID(riid, &IID_IShellView))
1027 *ppvObj = (IShellView*)This;
1029 else if(IsEqualIID(riid, &IID_IOleCommandTarget))
1031 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget);
1033 else if(IsEqualIID(riid, &IID_IDropTarget))
1035 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);
1037 else if(IsEqualIID(riid, &IID_IViewObject))
1039 *ppvObj = (IViewObject*)&(This->lpvtblViewObject);
1042 if(*ppvObj)
1044 IUnknown_AddRef( (IUnknown*)*ppvObj );
1045 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1046 return S_OK;
1048 TRACE("-- Interface: E_NOINTERFACE\n");
1049 return E_NOINTERFACE;
1052 /**********************************************************
1053 * IShellView_AddRef
1055 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
1057 ICOM_THIS(IShellViewImpl, iface);
1059 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1061 shell32_ObjCount++;
1062 return ++(This->ref);
1064 /**********************************************************
1065 * IShellView_Release
1067 static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
1069 ICOM_THIS(IShellViewImpl, iface);
1071 TRACE("(%p)->()\n",This);
1073 shell32_ObjCount--;
1075 if (!--(This->ref))
1077 TRACE(" destroying IShellView(%p)\n",This);
1079 if(This->pSFParent)
1080 IShellFolder_Release(This->pSFParent);
1082 if (This->apidl)
1083 SHFree(This->apidl);
1085 if (This->pCommDlgBrowser)
1086 ICommDlgBrowser_Release(This->pCommDlgBrowser);
1088 HeapFree(GetProcessHeap(),0,This);
1089 return 0;
1091 return This->ref;
1094 /**********************************************************
1095 * ShellView_GetWindow
1097 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd)
1099 ICOM_THIS(IShellViewImpl, iface);
1101 TRACE("(%p)\n",This);
1103 *phWnd = This->hWnd;
1105 return S_OK;
1108 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode)
1110 ICOM_THIS(IShellViewImpl, iface);
1112 FIXME("(%p) stub\n",This);
1114 return E_NOTIMPL;
1117 /**********************************************************
1118 * IShellView_TranslateAccelerator
1120 * FIXME:
1121 * use the accel functions
1123 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG lpmsg)
1125 ICOM_THIS(IShellViewImpl, iface);
1127 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1130 switch (lpmsg->message)
1131 { case WM_KEYDOWN: TRACE("-- key=0x04%x",lpmsg->wParam) ;
1133 return NOERROR;
1136 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable)
1138 ICOM_THIS(IShellViewImpl, iface);
1140 FIXME("(%p) stub\n",This);
1142 return E_NOTIMPL;
1145 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
1147 ICOM_THIS(IShellViewImpl, iface);
1149 CHAR szName[MAX_PATH];
1150 LRESULT lResult;
1151 int nPartArray[1] = {-1};
1153 TRACE("(%p)->(state=%x) stub\n",This, uState);
1155 /*don't do anything if the state isn't really changing*/
1156 if(This->uState == uState)
1158 return S_OK;
1161 /*OnActivate handles the menu merging and internal state*/
1162 ShellView_OnActivate(This, uState);
1164 /*only do This if we are active*/
1165 if(uState != SVUIA_DEACTIVATE)
1168 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );
1170 /* set the number of parts */
1171 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1172 (LPARAM)nPartArray, &lResult);
1174 /* set the text for the parts */
1175 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1176 0, (LPARAM)szName, &lResult);
1179 return S_OK;
1182 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface)
1184 ICOM_THIS(IShellViewImpl, iface);
1186 TRACE("(%p)\n",This);
1188 ListView_DeleteAllItems(This->hWndList);
1189 ShellView_FillList(This);
1191 return S_OK;
1194 static HRESULT WINAPI IShellView_fnCreateViewWindow(
1195 IShellView * iface,
1196 IShellView *lpPrevView,
1197 LPCFOLDERSETTINGS lpfs,
1198 IShellBrowser * psb,
1199 RECT * prcView,
1200 HWND *phWnd)
1202 ICOM_THIS(IShellViewImpl, iface);
1204 WNDCLASSA wc;
1205 *phWnd = 0;
1208 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);
1209 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);
1211 /*set up the member variables*/
1212 This->pShellBrowser = psb;
1213 This->FolderSettings = *lpfs;
1215 /*get our parent window*/
1216 IShellBrowser_AddRef(This->pShellBrowser);
1217 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent));
1219 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */
1220 This->pCommDlgBrowser=NULL;
1221 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser,
1222 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))
1224 TRACE("-- CommDlgBrowser\n");
1227 /*if our window class has not been registered, then do so*/
1228 if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc))
1230 ZeroMemory(&wc, sizeof(wc));
1231 wc.style = CS_HREDRAW | CS_VREDRAW;
1232 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc;
1233 wc.cbClsExtra = 0;
1234 wc.cbWndExtra = 0;
1235 wc.hInstance = shell32_hInstance;
1236 wc.hIcon = 0;
1237 wc.hCursor = LoadCursorA (0, IDC_ARROWA);
1238 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
1239 wc.lpszMenuName = NULL;
1240 wc.lpszClassName = SV_CLASS_NAME;
1242 if(!RegisterClassA(&wc))
1243 return E_FAIL;
1246 *phWnd = CreateWindowExA(0,
1247 SV_CLASS_NAME,
1248 NULL,
1249 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
1250 prcView->left,
1251 prcView->top,
1252 prcView->right - prcView->left,
1253 prcView->bottom - prcView->top,
1254 This->hWndParent,
1256 shell32_hInstance,
1257 (LPVOID)This);
1259 CheckToolbar(This);
1261 if(!*phWnd)
1262 return E_FAIL;
1264 return S_OK;
1267 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
1269 ICOM_THIS(IShellViewImpl, iface);
1271 TRACE("(%p)\n",This);
1273 /*Make absolutely sure all our UI is cleaned up.*/
1274 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE);
1276 if(This->hMenu)
1278 DestroyMenu(This->hMenu);
1281 DestroyWindow(This->hWnd);
1282 IShellBrowser_Release(This->pShellBrowser);
1284 return S_OK;
1287 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs)
1289 ICOM_THIS(IShellViewImpl, iface);
1291 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs,
1292 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
1294 if (!lpfs) return E_INVALIDARG;
1296 *lpfs = This->FolderSettings;
1297 return NOERROR;
1300 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1302 ICOM_THIS(IShellViewImpl, iface);
1304 FIXME("(%p) stub\n",This);
1306 return E_NOTIMPL;
1309 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface)
1311 ICOM_THIS(IShellViewImpl, iface);
1313 FIXME("(%p) stub\n",This);
1315 return S_OK;
1318 static HRESULT WINAPI IShellView_fnSelectItem(IShellView * iface, LPCITEMIDLIST pidlItem, UINT uFlags)
1319 { ICOM_THIS(IShellViewImpl, iface);
1321 FIXME("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidlItem, uFlags);
1323 return E_NOTIMPL;
1326 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
1328 ICOM_THIS(IShellViewImpl, iface);
1330 char xriid[50];
1332 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1333 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, xriid, ppvOut);
1335 *ppvOut = NULL;
1337 switch(uItem)
1339 case SVGIO_BACKGROUND:
1340 *ppvOut = ISvBgCm_Constructor();
1341 break;
1343 case SVGIO_SELECTION:
1344 ShellView_GetSelections(This);
1345 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut);
1346 break;
1348 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);
1350 if(!*ppvOut) return E_OUTOFMEMORY;
1352 return S_OK;
1355 static struct ICOM_VTABLE(IShellView) svvt =
1357 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1358 IShellView_fnQueryInterface,
1359 IShellView_fnAddRef,
1360 IShellView_fnRelease,
1361 IShellView_fnGetWindow,
1362 IShellView_fnContextSensitiveHelp,
1363 IShellView_fnTranslateAccelerator,
1364 IShellView_fnEnableModeless,
1365 IShellView_fnUIActivate,
1366 IShellView_fnRefresh,
1367 IShellView_fnCreateViewWindow,
1368 IShellView_fnDestroyViewWindow,
1369 IShellView_fnGetCurrentInfo,
1370 IShellView_fnAddPropertySheetPages,
1371 IShellView_fnSaveViewState,
1372 IShellView_fnSelectItem,
1373 IShellView_fnGetItemObject
1377 /**********************************************************
1378 * ISVOleCmdTarget_QueryInterface (IUnknown)
1380 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
1381 IOleCommandTarget * iface,
1382 REFIID iid,
1383 LPVOID* ppvObj)
1385 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1387 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
1390 /**********************************************************
1391 * ISVOleCmdTarget_AddRef (IUnknown)
1393 static ULONG WINAPI ISVOleCmdTarget_AddRef(
1394 IOleCommandTarget * iface)
1396 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface);
1398 return IShellFolder_AddRef((IShellFolder*)This);
1401 /**********************************************************
1402 * ISVOleCmdTarget_Release (IUnknown)
1404 static ULONG WINAPI ISVOleCmdTarget_Release(
1405 IOleCommandTarget * iface)
1407 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1409 return IShellFolder_Release((IShellFolder*)This);
1412 /**********************************************************
1413 * ISVOleCmdTarget_QueryStatus (IOleCommandTarget)
1415 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
1416 IOleCommandTarget *iface,
1417 const GUID* pguidCmdGroup,
1418 ULONG cCmds,
1419 OLECMD * prgCmds,
1420 OLECMDTEXT* pCmdText)
1422 char xguid[50];
1424 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1426 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid);
1428 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", This, pguidCmdGroup, xguid, cCmds, prgCmds, pCmdText);
1429 return E_NOTIMPL;
1432 /**********************************************************
1433 * ISVOleCmdTarget_Exec (IOleCommandTarget)
1435 * nCmdID is the OLECMDID_* enumeration
1437 static HRESULT WINAPI ISVOleCmdTarget_Exec(
1438 IOleCommandTarget *iface,
1439 const GUID* pguidCmdGroup,
1440 DWORD nCmdID,
1441 DWORD nCmdexecopt,
1442 VARIANT* pvaIn,
1443 VARIANT* pvaOut)
1445 char xguid[50];
1447 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1449 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid);
1451 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", This, xguid, nCmdID, nCmdexecopt, pvaIn, pvaOut);
1452 return E_NOTIMPL;
1455 static ICOM_VTABLE(IOleCommandTarget) ctvt =
1457 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1458 ISVOleCmdTarget_QueryInterface,
1459 ISVOleCmdTarget_AddRef,
1460 ISVOleCmdTarget_Release,
1461 ISVOleCmdTarget_QueryStatus,
1462 ISVOleCmdTarget_Exec
1465 /**********************************************************
1466 * ISVDropTarget implementation
1469 static HRESULT WINAPI ISVDropTarget_QueryInterface(
1470 IDropTarget *iface,
1471 REFIID riid,
1472 LPVOID *ppvObj)
1474 char xriid[50];
1476 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1478 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1480 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1482 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1485 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
1487 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1489 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1491 return IShellFolder_AddRef((IShellFolder*)This);
1494 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface)
1496 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1498 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1500 return IShellFolder_Release((IShellFolder*)This);
1503 static HRESULT WINAPI ISVDropTarget_DragEnter(
1504 IDropTarget *iface,
1505 IDataObject *pDataObject,
1506 DWORD grfKeyState,
1507 POINTL pt,
1508 DWORD *pdwEffect)
1511 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1513 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject);
1515 return E_NOTIMPL;
1518 static HRESULT WINAPI ISVDropTarget_DragOver(
1519 IDropTarget *iface,
1520 DWORD grfKeyState,
1521 POINTL pt,
1522 DWORD *pdwEffect)
1524 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1526 FIXME("Stub: This=%p\n",This);
1528 return E_NOTIMPL;
1531 static HRESULT WINAPI ISVDropTarget_DragLeave(
1532 IDropTarget *iface)
1534 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1536 FIXME("Stub: This=%p\n",This);
1538 return E_NOTIMPL;
1541 static HRESULT WINAPI ISVDropTarget_Drop(
1542 IDropTarget *iface,
1543 IDataObject* pDataObject,
1544 DWORD grfKeyState,
1545 POINTL pt,
1546 DWORD *pdwEffect)
1548 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1550 FIXME("Stub: This=%p\n",This);
1552 return E_NOTIMPL;
1555 static struct ICOM_VTABLE(IDropTarget) dtvt =
1557 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1558 ISVDropTarget_QueryInterface,
1559 ISVDropTarget_AddRef,
1560 ISVDropTarget_Release,
1561 ISVDropTarget_DragEnter,
1562 ISVDropTarget_DragOver,
1563 ISVDropTarget_DragLeave,
1564 ISVDropTarget_Drop
1567 /**********************************************************
1568 * ISVViewObject implementation
1571 static HRESULT WINAPI ISVViewObject_QueryInterface(
1572 IViewObject *iface,
1573 REFIID riid,
1574 LPVOID *ppvObj)
1576 char xriid[50];
1578 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1580 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1582 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1584 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1587 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface)
1589 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1591 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1593 return IShellFolder_AddRef((IShellFolder*)This);
1596 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface)
1598 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1600 TRACE("(%p)->(count=%lu)\n",This,This->ref);
1602 return IShellFolder_Release((IShellFolder*)This);
1605 static HRESULT WINAPI ISVViewObject_Draw(
1606 IViewObject *iface,
1607 DWORD dwDrawAspect,
1608 LONG lindex,
1609 void* pvAspect,
1610 DVTARGETDEVICE* ptd,
1611 HDC hdcTargetDev,
1612 HDC hdcDraw,
1613 LPCRECTL lprcBounds,
1614 LPCRECTL lprcWBounds,
1615 IVO_ContCallback pfnContinue,
1616 DWORD dwContinue)
1619 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1621 FIXME("Stub: This=%p\n",This);
1623 return E_NOTIMPL;
1625 static HRESULT WINAPI ISVViewObject_GetColorSet(
1626 IViewObject *iface,
1627 DWORD dwDrawAspect,
1628 LONG lindex,
1629 void *pvAspect,
1630 DVTARGETDEVICE* ptd,
1631 HDC hicTargetDevice,
1632 LOGPALETTE** ppColorSet)
1635 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1637 FIXME("Stub: This=%p\n",This);
1639 return E_NOTIMPL;
1641 static HRESULT WINAPI ISVViewObject_Freeze(
1642 IViewObject *iface,
1643 DWORD dwDrawAspect,
1644 LONG lindex,
1645 void* pvAspect,
1646 DWORD* pdwFreeze)
1649 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1651 FIXME("Stub: This=%p\n",This);
1653 return E_NOTIMPL;
1655 static HRESULT WINAPI ISVViewObject_Unfreeze(
1656 IViewObject *iface,
1657 DWORD dwFreeze)
1660 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1662 FIXME("Stub: This=%p\n",This);
1664 return E_NOTIMPL;
1666 static HRESULT WINAPI ISVViewObject_SetAdvise(
1667 IViewObject *iface,
1668 DWORD aspects,
1669 DWORD advf,
1670 IAdviseSink* pAdvSink)
1673 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1675 FIXME("Stub: This=%p\n",This);
1677 return E_NOTIMPL;
1679 static HRESULT WINAPI ISVViewObject_GetAdvise(
1680 IViewObject *iface,
1681 DWORD* pAspects,
1682 DWORD* pAdvf,
1683 IAdviseSink** ppAdvSink)
1686 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1688 FIXME("Stub: This=%p\n",This);
1690 return E_NOTIMPL;
1694 static struct ICOM_VTABLE(IViewObject) vovt =
1696 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1697 ISVViewObject_QueryInterface,
1698 ISVViewObject_AddRef,
1699 ISVViewObject_Release,
1700 ISVViewObject_Draw,
1701 ISVViewObject_GetColorSet,
1702 ISVViewObject_Freeze,
1703 ISVViewObject_Unfreeze,
1704 ISVViewObject_SetAdvise,
1705 ISVViewObject_GetAdvise