4 * Copyright 1998 <juergen.schmied@metronet.de>
6 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a
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"
30 #include "shell32_main.h"
32 DEFAULT_DEBUG_CHANNEL(shell)
35 { ICOM_VTABLE(IShellView)* lpvtbl;
37 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget;
38 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget;
39 ICOM_VTABLE(IViewObject)* lpvtblViewObject;
40 IShellFolder* pSFParent;
41 IShellBrowser* pShellBrowser;
42 ICommDlgBrowser* pCommDlgBrowser;
46 FOLDERSETTINGS FolderSettings;
50 LPITEMIDLIST *aSelectedItems;
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*)(((void*)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*)(((void*)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*)(((void*)name)-_IViewObject_Offset);
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
77 #define TOOLBAR_ID (L"SHELLDLL_DefView")
79 #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
80 #define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
81 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
83 #define WM_SETTINGCHANGE WM_WININICHANGE
84 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
85 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState);
95 } MYTOOLINFO, *LPMYTOOLINFO;
97 extern LPCVOID _Resource_Men_MENU_001_0_data;
98 extern LPCVOID _Resource_Men_MENU_002_0_data;
100 MYTOOLINFO g_Tools[] =
101 { {IDM_VIEW_FILES, 0, IDS_TB_VIEW_FILES, IDS_MI_VIEW_FILES, 0, TBSTATE_ENABLED, TBSTYLE_BUTTON},
102 {-1, 0, 0, 0, 0, 0, 0}
107 typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
109 /**************************************************************************
110 * IShellView_Constructor
112 IShellView * IShellView_Constructor( IShellFolder * pFolder, LPCITEMIDLIST pidl)
113 { IShellViewImpl * sv;
114 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IShellViewImpl));
117 sv->lpvtblOleCommandTarget=&ctvt;
118 sv->lpvtblDropTarget=&dtvt;
119 sv->lpvtblViewObject=&vovt;
122 sv->pSFParent = pFolder;
124 sv->aSelectedItems = NULL;
127 IShellFolder_AddRef(pFolder);
129 TRACE(shell,"(%p)->(%p pidl=%p)\n",sv, pFolder, pidl);
131 return (IShellView *) sv;
133 /**************************************************************************
134 * helperfunctions for communication with ICommDlgBrowser
137 static BOOL IsInCommDlg(IShellViewImpl * This)
138 { return(This->pCommDlgBrowser != NULL);
140 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl)
142 if ( IsInCommDlg(This) )
143 { TRACE(shell,"ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
144 return (ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl));
149 static HRESULT OnDefaultCommand(IShellViewImpl * This)
151 if (IsInCommDlg(This))
152 { TRACE(shell,"ICommDlgBrowser::OnDefaultCommand\n");
153 return (ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This));
158 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags)
160 if (IsInCommDlg(This))
161 { TRACE(shell,"ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
162 return (ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags));
166 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
169 TRACE(shell,"(%p)\n", This);
171 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE);
172 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
175 static void CheckToolbar(IShellViewImpl * This)
180 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
181 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);
182 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
183 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);
184 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
185 FCIDM_TB_SMALLICON, TRUE, &result);
186 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
187 FCIDM_TB_REPORTVIEW, TRUE, &result);
191 static void MergeToolBar(IShellViewImpl * This)
192 { LRESULT iStdBMOffset;
193 LRESULT iViewBMOffset;
195 TBBUTTON tbActual[6];
198 { IN_STD_BMP = 0x4000,
199 IN_VIEW_BMP = 0x8000,
201 static const TBBUTTON c_tbDefault[] =
202 { { STD_COPY | IN_STD_BMP, FCIDM_SHVIEW_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, -1},
203 { 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0,0}, 0, -1 },
204 { VIEW_LARGEICONS | IN_VIEW_BMP, FCIDM_SHVIEW_BIGICON, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
205 { VIEW_SMALLICONS | IN_VIEW_BMP, FCIDM_SHVIEW_SMALLICON, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
206 { VIEW_LIST | IN_VIEW_BMP, FCIDM_SHVIEW_LISTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
207 { VIEW_DETAILS | IN_VIEW_BMP, FCIDM_SHVIEW_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
212 ab.hInst = HINST_COMMCTRL; /* hinstCommctrl */
213 ab.nID = IDB_STD_SMALL_COLOR; /* std bitmaps */
214 IShellBrowser_SendControlMsg(This->pShellBrowser,FCW_TOOLBAR,
215 TB_ADDBITMAP, 8, (LPARAM)&ab, &iStdBMOffset);
217 TRACE(shell,"TB_ADDBITMAP returns %lx\n", iStdBMOffset);
219 ab.nID = IDB_VIEW_SMALL_COLOR; /* std view bitmaps */
220 IShellBrowser_SendControlMsg(This->pShellBrowser,FCW_TOOLBAR,
221 TB_ADDBITMAP, 8, (LPARAM)&ab, &iViewBMOffset);
223 TRACE(shell,"TB_ADDBITMAP returns %lx\n", iViewBMOffset);
226 { tbActual[i] = c_tbDefault[i];
227 if (!(tbActual[i].fsStyle & TBSTYLE_SEP))
228 { if (tbActual[i].iBitmap & IN_VIEW_BMP)
229 { tbActual[i].iBitmap = (tbActual[i].iBitmap & ~IN_VIEW_BMP) + iViewBMOffset;
231 else if (tbActual[i].iBitmap & IN_STD_BMP)
232 { tbActual[i].iBitmap = (tbActual[i].iBitmap & ~IN_STD_BMP) + iStdBMOffset;
237 IShellBrowser_SetToolbarItems(This->pShellBrowser,tbActual, 6, FCT_MERGE);
244 /**************************************************************************
245 * ShellView_CreateList()
249 BOOL ShellView_CreateList (IShellViewImpl * This)
252 TRACE(shell,"%p\n",This);
254 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER |
255 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT;
256 switch (This->FolderSettings.ViewMode)
257 { case FVM_ICON: dwStyle |= LVS_ICON; break;
258 case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
259 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
260 case FVM_LIST: dwStyle |= LVS_LIST; break;
261 default: dwStyle |= LVS_LIST; break;
263 if (This->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
264 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
265 if (This->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
267 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE,
280 /* UpdateShellSettings(); */
283 /**************************************************************************
284 * ShellView_InitList()
289 int nColumn1=120; /* width of column */
294 BOOL ShellView_InitList(IShellViewImpl * This)
295 { LVCOLUMNA lvColumn;
298 TRACE(shell,"%p\n",This);
300 ListView_DeleteAllItems(This->hWndList);
302 /*initialize the columns */
303 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/
304 lvColumn.fmt = LVCFMT_LEFT;
305 lvColumn.pszText = szString;
307 lvColumn.cx = nColumn1;
308 strcpy(szString,"File");
309 /*LoadStringA(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/
310 ListView_InsertColumnA(This->hWndList, 0, &lvColumn);
312 lvColumn.cx = nColumn2;
313 strcpy(szString,"Size");
314 ListView_InsertColumnA(This->hWndList, 1, &lvColumn);
316 lvColumn.cx = nColumn3;
317 strcpy(szString,"Type");
318 ListView_InsertColumnA(This->hWndList, 2, &lvColumn);
320 lvColumn.cx = nColumn4;
321 strcpy(szString,"Modified");
322 ListView_InsertColumnA(This->hWndList, 3, &lvColumn);
324 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL);
325 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL);
329 /**************************************************************************
330 * ShellView_CompareItems()
333 * internal, CALLBACK for DSA_Sort
335 INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
337 TRACE(shell,"pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
342 ret = (int)((LPSHELLFOLDER)lpData)->lpvtbl->fnCompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2);
343 TRACE(shell,"ret=%i\n",ret);
347 /**************************************************************************
348 * ShellView_FillList()
354 static HRESULT ShellView_FillList(IShellViewImpl * This)
355 { LPENUMIDLIST pEnumIDList;
363 TRACE(shell,"%p\n",This);
365 /* get the itemlist from the shfolder*/
366 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
373 /* create a pointer array */
374 hdpa = pDPA_Create(16);
376 { return(E_OUTOFMEMORY);
379 /* copy the items into the array*/
380 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
381 { if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
387 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);
389 /*turn the listview's redrawing off*/
390 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0);
392 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/
393 { pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i);
394 if (IncludeObject(This, pidl) == S_OK) /* in a commdlg This works as a filemask*/
395 { ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/
396 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
397 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/
398 lvItem.lParam = (LPARAM) pidl; /*set the item's data*/
399 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/
400 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
401 ListView_InsertItemA(This->hWndList, &lvItem);
404 SHFree(pidl); /* the listview has the COPY*/
407 /*turn the listview's redrawing back on and force it to draw*/
408 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0);
409 InvalidateRect(This->hWndList, NULL, TRUE);
410 UpdateWindow(This->hWndList);
412 IEnumIDList_Release(pEnumIDList); /* destroy the list*/
418 /**************************************************************************
419 * ShellView_OnCreate()
424 LRESULT ShellView_OnCreate(IShellViewImpl * This)
425 { TRACE(shell,"%p\n",This);
427 if(ShellView_CreateList(This))
428 { if(ShellView_InitList(This))
429 { ShellView_FillList(This);
435 /**************************************************************************
438 LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight)
439 { TRACE(shell,"%p width=%u height=%u\n",This, wWidth,wHeight);
441 /*resize the ListView to fit our window*/
443 { MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);
448 /**************************************************************************
449 * ShellView_BuildFileMenu()
451 HMENU ShellView_BuildFileMenu(IShellViewImpl * This)
452 { CHAR szText[MAX_PATH];
457 TRACE(shell,"(%p) semi-stub\n",This);
459 hSubMenu = CreatePopupMenu();
461 { /*get the number of items in our global array*/
462 for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){}
464 /*add the menu items*/
465 for(i = 0; i < nTools; i++)
466 { strcpy(szText, "dummy BuildFileMenu");
468 ZeroMemory(&mii, sizeof(mii));
469 mii.cbSize = sizeof(mii);
470 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
472 if(TBSTYLE_SEP != g_Tools[i].bStyle) /* no seperator*/
473 { mii.fType = MFT_STRING;
474 mii.fState = MFS_ENABLED;
475 mii.dwTypeData = szText;
476 mii.wID = g_Tools[i].idCommand;
479 { mii.fType = MFT_SEPARATOR;
481 /* tack This item onto the end of the menu */
482 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii);
485 TRACE(shell,"-- return (menu=0x%x)\n",hSubMenu);
488 /**************************************************************************
489 * ShellView_MergeFileMenu()
491 void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
492 { TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",This,hSubMenu);
495 { /*insert This item at the beginning of the menu */
496 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
497 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
503 /**************************************************************************
504 * ShellView_MergeViewMenu()
507 void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
510 TRACE(shell,"(%p)->(submenu=0x%08x)\n",This,hSubMenu);
513 { /*add a separator at the correct position in the menu*/
514 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
516 ZeroMemory(&mii, sizeof(mii));
517 mii.cbSize = sizeof(mii);
518 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;
519 mii.fType = MFT_STRING;
520 mii.dwTypeData = "View";
521 mii.hSubMenu = LoadMenuIndirectA(&_Resource_Men_MENU_001_0_data);
522 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
526 /**************************************************************************
527 * ShellView_CanDoIDockingWindow()
529 BOOL ShellView_CanDoIDockingWindow(IShellViewImpl * This)
530 { BOOL bReturn = FALSE;
532 LPSERVICEPROVIDER pSP;
533 LPDOCKINGWINDOWFRAME pFrame;
535 FIXME(shell,"(%p) stub\n",This);
537 /*get the browser's IServiceProvider*/
538 hr = IShellBrowser_QueryInterface(This->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
540 { hr = IServiceProvider_QueryService(pSP, (REFGUID)&SID_SShellBrowser, (REFIID)&IID_IDockingWindowFrame, (LPVOID*)&pFrame);
543 pFrame->lpvtbl->fnRelease(pFrame);
545 IServiceProvider_Release(pSP);
550 /**************************************************************************
551 * ShellView_UpdateMenu()
553 LRESULT ShellView_UpdateMenu(IShellViewImpl * This, HMENU hMenu)
554 { TRACE(shell,"(%p)->(menu=0x%08x)\n",This,hMenu);
555 CheckMenuItem(hMenu, IDM_VIEW_FILES, MF_BYCOMMAND | (g_bViewKeys ? MF_CHECKED: MF_UNCHECKED));
557 if(ShellView_CanDoIDockingWindow(This))
558 { EnableMenuItem(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED);
559 CheckMenuItem(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED));
562 { EnableMenuItem(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
563 CheckMenuItem(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED);
568 /**************************************************************************
569 * ShellView_OnDeactivate()
574 void ShellView_OnDeactivate(IShellViewImpl * This)
575 { TRACE(shell,"%p\n",This);
576 if(This->uState != SVUIA_DEACTIVATE)
578 { IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);
579 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);
580 DestroyMenu(This->hMenu);
584 This->uState = SVUIA_DEACTIVATE;
588 /**************************************************************************
589 * ShellView_OnActivate()
591 LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState)
592 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };
594 CHAR szText[MAX_PATH];
596 TRACE(shell,"%p uState=%x\n",This,uState);
598 /*don't do anything if the state isn't really changing */
599 if(This->uState == uState)
603 ShellView_OnDeactivate(This);
605 /*only do This if we are active */
606 if(uState != SVUIA_DEACTIVATE)
607 { /*merge the menus */
608 This->hMenu = CreateMenu();
611 { IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);
612 TRACE(shell,"-- after fnInsertMenusSB\n");
613 /*build the top level menu get the menu item's text*/
614 strcpy(szText,"dummy 31");
616 ZeroMemory(&mii, sizeof(mii));
617 mii.cbSize = sizeof(mii);
618 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
619 mii.fType = MFT_STRING;
620 mii.fState = MFS_ENABLED;
621 mii.dwTypeData = szText;
622 mii.hSubMenu = ShellView_BuildFileMenu(This);
624 /*insert our menu into the menu bar*/
626 { InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
629 /*get the view menu so we can merge with it*/
630 ZeroMemory(&mii, sizeof(mii));
631 mii.cbSize = sizeof(mii);
632 mii.fMask = MIIM_SUBMENU;
634 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
635 { ShellView_MergeViewMenu(This, mii.hSubMenu);
638 /*add the items that should only be added if we have the focus*/
639 if(SVUIA_ACTIVATE_FOCUS == uState)
640 { /*get the file menu so we can merge with it */
641 ZeroMemory(&mii, sizeof(mii));
642 mii.cbSize = sizeof(mii);
643 mii.fMask = MIIM_SUBMENU;
645 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
646 { ShellView_MergeFileMenu(This, mii.hSubMenu);
649 TRACE(shell,"-- before fnSetMenuSB\n");
650 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);
653 This->uState = uState;
658 /**************************************************************************
659 * ShellView_OnSetFocus()
664 LRESULT ShellView_OnSetFocus(IShellViewImpl * This)
665 { TRACE(shell,"%p\n",This);
666 /* Tell the browser one of our windows has received the focus. This should always
667 be done before merging menus (OnActivate merges the menus) if one of our
668 windows has the focus.*/
669 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);
670 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);
675 /**************************************************************************
676 * ShellView_OnKillFocus()
678 LRESULT ShellView_OnKillFocus(IShellViewImpl * This)
679 { TRACE(shell,"(%p) stub\n",This);
680 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);
684 /**************************************************************************
685 * ShellView_AddRemoveDockingWindow()
687 BOOL ShellView_AddRemoveDockingWindow(IShellViewImpl * This, BOOL bAdd)
688 { BOOL bReturn = FALSE;
690 LPSERVICEPROVIDER pSP;
691 LPDOCKINGWINDOWFRAME pFrame;
693 WARN(shell,"(%p)->(badd=0x%08x) semi-stub\n",This,bAdd);
695 /* get the browser's IServiceProvider */
696 hr = IShellBrowser_QueryInterface(This->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
698 { /*get the IDockingWindowFrame pointer*/
699 hr = IServiceProvider_QueryService(pSP, (REFGUID)&SID_SShellBrowser, (REFIID)&IID_IDockingWindowFrame, (LPVOID*)&pFrame);
703 FIXME(shell,"no docking implemented\n");
705 if(!This->pDockingWindow)
706 { /* create the toolbar object */
707 This->pDockingWindow = DockingWindow_Constructor(This, This->hWnd);
710 if(This->pDockingWindow)
711 { /*add the toolbar object */
712 hr = pFrame->lpvtbl->fnAddToolbar(pFrame, (IDockingWindow*)This->pDockingWindow, TOOLBAR_ID, 0);
721 { FIXME(shell,"no docking implemented\n");
723 if(This->pDockingWindow)
724 { hr = pFrame->lpvtbl->fnRemoveToolbar(pFrame, (IDockingWindow*)This->pDockingWindow, DWFRF_NORMAL);
727 { /* RemoveToolbar should release the toolbar object which will cause */
728 /*it to destroy itself. Our toolbar object is no longer valid at */
731 This->pDockingWindow = NULL;
737 pFrame->lpvtbl->fnRelease(pFrame);
739 IServiceProvider_Release(pSP);
744 /**************************************************************************
745 * ShellView_UpdateShellSettings()
747 void ShellView_UpdateShellSettings(IShellViewImpl * This)
748 { FIXME(shell,"(%p) stub\n",This);
752 HINSTANCE hinstShell32;
754 /* Since SHGetSettings is not implemented in all versions of the shell, get the
755 function address manually at run time. This allows the code to run on all
758 ZeroMemory(&sfs, sizeof(sfs));
760 /* The default, in case any of the following steps fails, is classic Windows 95
763 sfs.fWin95Classic = TRUE;
765 hinstShell32 = LoadLibrary("shell32.dll");
767 { PFNSHGETSETTINGSPROC pfnSHGetSettings;
769 pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(hinstShell32, "SHGetSettings");
771 { (*pfnSHGetSettings)(&sfs, SSF_DOUBLECLICKINWEBVIEW | SSF_WIN95CLASSIC);
773 FreeLibrary(hinstShell32);
776 DWORD dwExStyles = 0;
778 if(!sfs.fWin95Classic && !sfs.fDoubleClickInWebView)
779 dwExStyles |= LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT;
781 ListView_SetExtendedListViewStyle(This->hWndList, dwExStyles);
785 /**************************************************************************
786 * ShellView_OnSettingChange()
788 LRESULT ShellView_OnSettingChange(IShellViewImpl * This, LPCSTR lpszSection)
789 { TRACE(shell,"(%p) stub\n",This);
790 /*if(0 == lstrcmpi(lpszSection, "ShellState"))*/
791 { ShellView_UpdateShellSettings(This);
796 /**************************************************************************
797 * ShellView_OnCommand()
799 LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd)
800 { TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd);
802 { case IDM_VIEW_FILES:
803 g_bViewKeys = ! g_bViewKeys;
804 IShellView_Refresh((IShellView*) This);
808 g_bShowIDW = ! g_bShowIDW;
809 ShellView_AddRemoveDockingWindow(This, g_bShowIDW);
816 case FCIDM_SHVIEW_SMALLICON:
817 This->FolderSettings.ViewMode = FVM_SMALLICON;
818 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
821 case FCIDM_SHVIEW_BIGICON:
822 This->FolderSettings.ViewMode = FVM_ICON;
823 SetStyle (This, LVS_ICON, LVS_TYPEMASK);
826 case FCIDM_SHVIEW_LISTVIEW:
827 This->FolderSettings.ViewMode = FVM_LIST;
828 SetStyle (This, LVS_LIST, LVS_TYPEMASK);
831 case FCIDM_SHVIEW_REPORTVIEW:
832 This->FolderSettings.ViewMode = FVM_DETAILS;
833 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
837 TRACE(shell,"-- COMMAND 0x%04lx unhandled\n", dwCmdID);
842 /**************************************************************************
843 * ShellView_GetSelections()
846 * number of selected items
848 UINT ShellView_GetSelections(IShellViewImpl * This)
853 if (This->aSelectedItems)
854 { SHFree(This->aSelectedItems);
857 This->uSelected = ListView_GetSelectedCount(This->hWndList);
858 This->aSelectedItems = (LPITEMIDLIST*)SHAlloc(This->uSelected * sizeof(LPITEMIDLIST));
860 TRACE(shell,"selected=%i\n", This->uSelected);
862 if(This->aSelectedItems)
863 { TRACE(shell,"-- Items selected =%u\n", This->uSelected);
864 ZeroMemory(&lvItem, sizeof(lvItem));
865 lvItem.mask = LVIF_STATE | LVIF_PARAM;
866 lvItem.stateMask = LVIS_SELECTED;
871 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->uSelected))
872 { if(lvItem.state & LVIS_SELECTED)
873 { This->aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam;
875 TRACE(shell,"-- selected Item found\n");
880 return This->uSelected;
883 /**************************************************************************
884 * ShellView_DoContextMenu()
886 void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL fDefault)
890 BOOL fExplore = FALSE;
894 LPCONTEXTMENU pContextMenu = NULL;
895 CMINVOKECOMMANDINFO cmi;
897 TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, fDefault);
899 /* look, what's selected and create a context menu object of it*/
900 if(ShellView_GetSelections(This))
901 { This->pSFParent->lpvtbl->fnGetUIObjectOf( This->pSFParent, This->hWndParent, This->uSelected,
902 This->aSelectedItems, (REFIID)&IID_IContextMenu,
903 NULL, (LPVOID *)&pContextMenu);
906 { TRACE(shell,"-- pContextMenu\n");
907 hMenu = CreatePopupMenu();
910 { /* See if we are in Explore or Open mode. If the browser's tree
911 is present, then we are in Explore mode.*/
913 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
914 { TRACE(shell,"-- explore mode\n");
918 wFlags = CMF_NORMAL | (This->uSelected != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
920 if (SUCCEEDED(pContextMenu->lpvtbl->fnQueryContextMenu( pContextMenu, hMenu, 0, MENU_OFFSET, MENU_MAX, wFlags )))
922 { TRACE(shell,"-- get menu default command\n");
924 uCommand = nMenuIndex = 0;
925 ZeroMemory(&mii, sizeof(mii));
926 mii.cbSize = sizeof(mii);
927 mii.fMask = MIIM_STATE | MIIM_ID;
929 while(GetMenuItemInfoA(hMenu, nMenuIndex, TRUE, &mii)) /*find the default item in the menu*/
930 { if(mii.fState & MFS_DEFAULT)
931 { uCommand = mii.wID;
938 { TRACE(shell,"-- track popup\n");
939 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
943 { TRACE(shell,"-- uCommand=%u\n", uCommand);
944 if (IsInCommDlg(This) && (((uCommand-MENU_OFFSET)==IDM_EXPLORE) || ((uCommand-MENU_OFFSET)==IDM_OPEN)))
945 { TRACE(shell,"-- dlg: OnDefaultCommand\n");
946 OnDefaultCommand(This);
949 { TRACE(shell,"-- explore -- invoke command\n");
950 ZeroMemory(&cmi, sizeof(cmi));
951 cmi.cbSize = sizeof(cmi);
952 cmi.hwnd = This->hWndParent;
953 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand - MENU_OFFSET);
954 pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi);
961 pContextMenu->lpvtbl->fnRelease(pContextMenu);
964 else /* background context menu */
965 { hMenu = LoadMenuIndirectA(&_Resource_Men_MENU_002_0_data);
966 uCommand = TrackPopupMenu( GetSubMenu(hMenu,0),TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);
967 ShellView_OnCommand(This, uCommand, 0,0);
972 /**************************************************************************
973 * ShellView_OnNotify()
976 LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh)
977 { NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh;
978 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;
983 TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);
987 TRACE(shell,"-- NM_SETFOCUS %p\n",This);
988 ShellView_OnSetFocus(This);
992 TRACE(shell,"-- NM_KILLFOCUS %p\n",This);
993 ShellView_OnDeactivate(This);
997 TRACE(shell,"-- HDN_ENDTRACKA %p\n",This);
998 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);
999 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/
1002 case LVN_DELETEITEM:
1003 TRACE(shell,"-- LVN_DELETEITEM %p\n",This);
1004 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
1007 case LVN_ITEMACTIVATE:
1008 TRACE(shell,"-- LVN_ITEMACTIVATE %p\n",This);
1009 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1010 ShellView_DoContextMenu(This, 0, 0, TRUE);
1014 TRACE(shell,"-- NM_RCLICK %p\n",This);
1015 dwCursor = GetMessagePos();
1016 ShellView_DoContextMenu(This, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
1019 case LVN_GETDISPINFOA:
1020 TRACE(shell,"-- LVN_GETDISPINFOA %p\n",This);
1021 pidl = (LPITEMIDLIST)lpdi->item.lParam;
1024 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/
1025 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
1026 { if(_ILIsValue(pidl)) /*is This a value or a folder?*/
1027 { switch (lpdi->item.iSubItem)
1028 { case 1: /* size */
1029 _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1031 case 2: /* extension */
1033 if (_ILGetExtension (pidl, sTemp, 64))
1034 { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64)
1035 && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax )))
1036 { strncpy (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax);
1037 strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax);
1040 else /* no extension found */
1041 { lpdi->item.pszText[0]=0x00;
1046 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1050 else /*its a folder*/
1051 { switch (lpdi->item.iSubItem)
1053 strcpy(lpdi->item.pszText, "");
1056 strncpy (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax);
1059 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1063 TRACE(shell,"-- text=%s\n",lpdi->item.pszText);
1066 else /*the item text is being requested*/
1067 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
1068 { if(SUCCEEDED(IShellFolder_GetDisplayNameOf(This->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)))
1069 { if(STRRET_WSTR == str.uType)
1070 { WideCharToLocal(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax);
1071 SHFree(str.u.pOleStr);
1073 else if(STRRET_CSTRA == str.uType)
1074 { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax);
1077 { FIXME(shell,"type wrong\n");
1080 TRACE(shell,"-- text=%s\n",lpdi->item.pszText);
1083 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/
1084 { lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);
1089 case LVN_ITEMCHANGED:
1090 TRACE(shell,"-- LVN_ITEMCHANGED %p\n",This);
1091 ShellView_GetSelections(This);
1092 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
1096 TRACE (shell,"-- %p WM_COMMAND %s unhandled\n", This, SPY_GetMsgName(lpnmh->code));
1102 /**************************************************************************
1106 LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
1107 { IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA);
1108 LPCREATESTRUCTA lpcs;
1111 TRACE(shell,"(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
1115 { TRACE(shell,"-- WM_NCCREATE\n");
1116 lpcs = (LPCREATESTRUCTA)lParam;
1117 pThis = (IShellViewImpl*)(lpcs->lpCreateParams);
1118 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis);
1119 pThis->hWnd = hWnd; /*set the window handle*/
1124 TRACE(shell,"-- WM_SIZE\n");
1125 return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
1128 TRACE(shell,"-- WM_SETFOCUS\n");
1129 return ShellView_OnSetFocus(pThis);
1132 TRACE(shell,"-- WM_KILLFOCUS\n");
1133 return ShellView_OnKillFocus(pThis);
1136 TRACE(shell,"-- WM_CREATE\n");
1137 return ShellView_OnCreate(pThis);
1140 TRACE(shell,"-- WM_SHOWWINDOW\n");
1141 UpdateWindow(pThis->hWndList);
1145 TRACE(shell,"-- WM_ACTIVATE\n");
1146 return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1149 TRACE(shell,"-- WM_COMMAND\n");
1150 return ShellView_OnCommand(pThis, GET_WM_COMMAND_ID(wParam, lParam),
1151 GET_WM_COMMAND_CMD(wParam, lParam),
1152 GET_WM_COMMAND_HWND(wParam, lParam));
1154 case WM_INITMENUPOPUP:
1155 TRACE(shell,"-- WM_INITMENUPOPUP\n");
1156 return ShellView_UpdateMenu(pThis, (HMENU)wParam);
1159 TRACE(shell,"-- WM_NOTIFY\n");
1160 return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);
1162 case WM_SETTINGCHANGE:
1163 TRACE(shell,"-- WM_SETTINGCHANGE\n");
1164 return ShellView_OnSettingChange(pThis,(LPCSTR)lParam);
1166 case WM_PARENTNOTIFY:
1167 TRACE(shell,"-- WM_PARENTNOTIFY\n");
1168 if ( LOWORD(wParam) == WM_RBUTTONDOWN ) /* fixme: should not be handled here*/
1169 { dwCursor = GetMessagePos();
1170 ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
1176 TRACE(shell,"-- message %s unhandled\n", SPY_GetMsgName(uMessage));
1179 return DefWindowProcA (hWnd, uMessage, wParam, lParam);
1181 /**************************************************************************
1184 * The INTERFACE of the IShellView object
1187 ***************************************************************************
1188 * IShellView_QueryInterface
1190 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj)
1192 ICOM_THIS(IShellViewImpl, iface);
1195 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1196 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1200 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1203 else if(IsEqualIID(riid, &IID_IShellView)) /*IShellView*/
1204 { *ppvObj = (IShellView*)This;
1206 else if(IsEqualIID(riid, &IID_IOleCommandTarget)) /*IOleCommandTarget*/
1207 { *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget);
1209 else if(IsEqualIID(riid, &IID_IDropTarget)) /*IDropTarget*/
1210 { *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);
1212 else if(IsEqualIID(riid, &IID_IViewObject)) /*ViewObject*/
1213 { *ppvObj = (IViewObject*)&(This->lpvtblViewObject);
1217 { IShellView_AddRef( (IShellView*) *ppvObj);
1218 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1221 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
1222 return E_NOINTERFACE;
1225 /**************************************************************************
1226 * IShellView::AddRef
1228 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface)
1230 ICOM_THIS(IShellViewImpl, iface);
1232 TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
1235 return ++(This->ref);
1237 /**************************************************************************
1238 * IShellView_Release
1240 static ULONG WINAPI IShellView_fnRelease(IShellView * iface)
1242 ICOM_THIS(IShellViewImpl, iface);
1244 TRACE(shell,"(%p)->()\n",This);
1248 { TRACE(shell," destroying IShellView(%p)\n",This);
1251 IShellFolder_Release(This->pSFParent);
1253 if (This->aSelectedItems)
1254 SHFree(This->aSelectedItems);
1256 if (This->pCommDlgBrowser)
1257 ICommDlgBrowser_Release(This->pCommDlgBrowser);
1259 HeapFree(GetProcessHeap(),0,This);
1264 /**************************************************************************
1265 * ShellView_GetWindow
1267 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd)
1269 ICOM_THIS(IShellViewImpl, iface);
1271 TRACE(shell,"(%p)\n",This);
1273 *phWnd = This->hWnd;
1278 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode)
1280 ICOM_THIS(IShellViewImpl, iface);
1282 FIXME(shell,"(%p) stub\n",This);
1286 /**************************************************************************
1287 * IShellView_TranslateAccelerator
1290 * use the accel functions
1292 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG lpmsg)
1294 ICOM_THIS(IShellViewImpl, iface);
1296 FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1299 switch (lpmsg->message)
1300 { case WM_KEYDOWN: TRACE(shell,"-- key=0x04%x",lpmsg->wParam) ;
1305 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable)
1307 ICOM_THIS(IShellViewImpl, iface);
1309 FIXME(shell,"(%p) stub\n",This);
1314 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState)
1316 ICOM_THIS(IShellViewImpl, iface);
1318 CHAR szName[MAX_PATH];
1320 int nPartArray[1] = {-1};
1322 TRACE(shell,"(%p)->(state=%x) stub\n",This, uState);
1323 /*don't do anything if the state isn't really changing*/
1324 if(This->uState == uState)
1328 /*OnActivate handles the menu merging and internal state*/
1329 ShellView_OnActivate(This, uState);
1331 /*remove the docking window*/
1333 { ShellView_AddRemoveDockingWindow(This, FALSE);
1336 /*only do This if we are active*/
1337 if(uState != SVUIA_DEACTIVATE)
1338 { /*update the status bar */
1339 strcpy(szName, "dummy32");
1341 IShellFolder_GetFolderPath( This->pSFParent, szName + strlen(szName), sizeof(szName) - strlen(szName));
1343 /* set the number of parts */
1344 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1345 (LPARAM)nPartArray, &lResult);
1347 /* set the text for the parts */
1348 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,
1349 0, (LPARAM)szName, &lResult);
1351 /*add the docking window if necessary */
1353 { ShellView_AddRemoveDockingWindow(This, TRUE);
1358 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface)
1360 ICOM_THIS(IShellViewImpl, iface);
1362 TRACE(shell,"(%p)\n",This);
1364 ListView_DeleteAllItems(This->hWndList);
1365 ShellView_FillList(This);
1369 static HRESULT WINAPI IShellView_fnCreateViewWindow(IShellView * iface, IShellView *lpPrevView,
1370 LPCFOLDERSETTINGS lpfs, IShellBrowser * psb, RECT * prcView, HWND *phWnd)
1372 ICOM_THIS(IShellViewImpl, iface);
1378 TRACE(shell,"(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);
1379 TRACE(shell,"-- 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);
1381 /*set up the member variables*/
1382 This->pShellBrowser = psb;
1383 This->FolderSettings = *lpfs;
1385 /*get our parent window*/
1386 IShellBrowser_AddRef(This->pShellBrowser);
1387 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent));
1389 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */
1390 This->pCommDlgBrowser=NULL;
1391 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser,
1392 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))
1393 { TRACE(shell,"-- CommDlgBrowser\n");
1396 /*if our window class has not been registered, then do so*/
1397 if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc))
1398 { ZeroMemory(&wc, sizeof(wc));
1399 wc.style = CS_HREDRAW | CS_VREDRAW;
1400 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc;
1403 wc.hInstance = shell32_hInstance;
1405 wc.hCursor = LoadCursorA (0, IDC_ARROWA);
1406 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
1407 wc.lpszMenuName = NULL;
1408 wc.lpszClassName = SV_CLASS_NAME;
1410 if(!RegisterClassA(&wc))
1414 *phWnd = CreateWindowExA(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
1415 prcView->left, prcView->top, prcView->right - prcView->left, prcView->bottom - prcView->top,
1416 This->hWndParent, 0, shell32_hInstance, (LPVOID)This);
1426 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface)
1428 ICOM_THIS(IShellViewImpl, iface);
1430 TRACE(shell,"(%p)\n",This);
1432 /*Make absolutely sure all our UI is cleaned up.*/
1433 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE);
1435 { DestroyMenu(This->hMenu);
1437 DestroyWindow(This->hWnd);
1438 IShellBrowser_Release(This->pShellBrowser);
1442 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs)
1444 ICOM_THIS(IShellViewImpl, iface);
1446 TRACE(shell,"(%p)->(%p) vmode=%x flags=%x\n",This, lpfs,
1447 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);
1450 { *lpfs = This->FolderSettings;
1454 return E_INVALIDARG;
1457 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1459 ICOM_THIS(IShellViewImpl, iface);
1461 FIXME(shell,"(%p) stub\n",This);
1466 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface)
1468 ICOM_THIS(IShellViewImpl, iface);
1470 FIXME(shell,"(%p) stub\n",This);
1475 static HRESULT WINAPI IShellView_fnSelectItem(IShellView * iface, LPCITEMIDLIST pidlItem, UINT uFlags)
1476 { ICOM_THIS(IShellViewImpl, iface);
1478 FIXME(shell,"(%p)->(pidl=%p, 0x%08x) stub\n",This, pidlItem, uFlags);
1483 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut)
1485 ICOM_THIS(IShellViewImpl, iface);
1487 LPUNKNOWN pObj = NULL;
1490 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1491 TRACE(shell,"(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, xriid, ppvOut);
1494 if(IsEqualIID(riid, &IID_IContextMenu))
1495 { ShellView_GetSelections(This);
1496 pObj =(LPUNKNOWN)IContextMenu_Constructor(This->pSFParent,This->aSelectedItems,This->uSelected);
1498 else if (IsEqualIID(riid, &IID_IDataObject))
1499 { ShellView_GetSelections(This);
1500 pObj =(LPUNKNOWN)IDataObject_Constructor(This->hWndParent, This->pSFParent,This->aSelectedItems,This->uSelected);
1503 TRACE(shell,"-- (%p)->(interface=%p)\n",This, ppvOut);
1506 return E_OUTOFMEMORY;
1511 static struct ICOM_VTABLE(IShellView) svvt =
1512 { IShellView_fnQueryInterface,
1513 IShellView_fnAddRef,
1514 IShellView_fnRelease,
1515 IShellView_fnGetWindow,
1516 IShellView_fnContextSensitiveHelp,
1517 IShellView_fnTranslateAccelerator,
1518 IShellView_fnEnableModeless,
1519 IShellView_fnUIActivate,
1520 IShellView_fnRefresh,
1521 IShellView_fnCreateViewWindow,
1522 IShellView_fnDestroyViewWindow,
1523 IShellView_fnGetCurrentInfo,
1524 IShellView_fnAddPropertySheetPages,
1525 IShellView_fnSaveViewState,
1526 IShellView_fnSelectItem,
1527 IShellView_fnGetItemObject
1531 /************************************************************************
1532 * ISVOleCmdTarget_QueryInterface (IUnknown)
1534 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface(
1535 IOleCommandTarget * iface,
1539 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1541 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);
1544 /************************************************************************
1545 * ISVOleCmdTarget_AddRef (IUnknown)
1547 static ULONG WINAPI ISVOleCmdTarget_AddRef(
1548 IOleCommandTarget * iface)
1550 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface);
1552 return IShellFolder_AddRef((IShellFolder*)This);
1555 /************************************************************************
1556 * ISVOleCmdTarget_Release (IUnknown)
1558 static ULONG WINAPI ISVOleCmdTarget_Release(
1559 IOleCommandTarget * iface)
1561 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1563 return IShellFolder_Release((IShellFolder*)This);
1566 /************************************************************************
1567 * ISVOleCmdTarget_Exec (IOleCommandTarget)
1569 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
1570 IOleCommandTarget *iface,
1571 const GUID* pguidCmdGroup,
1574 OLECMDTEXT* pCmdText)
1576 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1578 FIXME(shell, "(%p)->(%p 0x%08lx %p %p\n", This, pguidCmdGroup, cCmds, prgCmds, pCmdText);
1582 /************************************************************************
1583 * ISVOleCmdTarget_Exec (IOleCommandTarget)
1585 static HRESULT WINAPI ISVOleCmdTarget_Exec(
1586 IOleCommandTarget *iface,
1587 const GUID* pguidCmdGroup,
1593 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);
1595 FIXME(shell, "(%p)->(%p 0x%08lx 0x%08lx %p %p)\n", This, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
1599 static ICOM_VTABLE(IOleCommandTarget) ctvt =
1601 ISVOleCmdTarget_QueryInterface,
1602 ISVOleCmdTarget_AddRef,
1603 ISVOleCmdTarget_Release,
1604 ISVOleCmdTarget_QueryStatus,
1605 ISVOleCmdTarget_Exec
1608 /****************************************************************************
1609 * ISVDropTarget implementation
1612 static HRESULT WINAPI ISVDropTarget_QueryInterface(
1619 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1621 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1623 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1625 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1628 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface)
1630 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1632 TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
1634 return IShellFolder_AddRef((IShellFolder*)This);
1637 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface)
1639 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1641 TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
1643 return IShellFolder_Release((IShellFolder*)This);
1646 static HRESULT WINAPI ISVDropTarget_DragEnter(
1648 IDataObject *pDataObject,
1654 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1656 FIXME(shell, "Stub: This=%p, DataObject=%p\n",This,pDataObject);
1661 static HRESULT WINAPI ISVDropTarget_DragOver(
1667 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1669 FIXME(shell, "Stub: This=%p\n",This);
1674 static HRESULT WINAPI ISVDropTarget_DragLeave(
1677 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1679 FIXME(shell, "Stub: This=%p\n",This);
1684 static HRESULT WINAPI ISVDropTarget_Drop(
1686 IDataObject* pDataObject,
1691 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);
1693 FIXME(shell, "Stub: This=%p\n",This);
1698 static struct ICOM_VTABLE(IDropTarget) dtvt =
1700 ISVDropTarget_QueryInterface,
1701 ISVDropTarget_AddRef,
1702 ISVDropTarget_Release,
1703 ISVDropTarget_DragEnter,
1704 ISVDropTarget_DragOver,
1705 ISVDropTarget_DragLeave,
1709 /****************************************************************************
1710 * ISVViewObject implementation
1713 static HRESULT WINAPI ISVViewObject_QueryInterface(
1720 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1722 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1724 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
1726 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);
1729 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface)
1731 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1733 TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
1735 return IShellFolder_AddRef((IShellFolder*)This);
1738 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface)
1740 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1742 TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
1744 return IShellFolder_Release((IShellFolder*)This);
1747 static HRESULT WINAPI ISVViewObject_Draw(
1752 DVTARGETDEVICE* ptd,
1755 LPCRECTL lprcBounds,
1756 LPCRECTL lprcWBounds,
1757 pfnContinue pfnContinue,
1761 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1763 FIXME(shell, "Stub: This=%p\n",This);
1767 static HRESULT WINAPI ISVViewObject_GetColorSet(
1772 DVTARGETDEVICE* ptd,
1773 HDC hicTargetDevice,
1774 LOGPALETTE** ppColorSet)
1777 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1779 FIXME(shell, "Stub: This=%p\n",This);
1783 static HRESULT WINAPI ISVViewObject_Freeze(
1791 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1793 FIXME(shell, "Stub: This=%p\n",This);
1797 static HRESULT WINAPI ISVViewObject_Unfreeze(
1802 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1804 FIXME(shell, "Stub: This=%p\n",This);
1808 static HRESULT WINAPI ISVViewObject_SetAdvise(
1812 IAdviseSink* pAdvSink)
1815 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1817 FIXME(shell, "Stub: This=%p\n",This);
1821 static HRESULT WINAPI ISVViewObject_GetAdvise(
1825 IAdviseSink** ppAdvSink)
1828 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);
1830 FIXME(shell, "Stub: This=%p\n",This);
1836 static struct ICOM_VTABLE(IViewObject) vovt =
1838 ISVViewObject_QueryInterface,
1839 ISVViewObject_AddRef,
1840 ISVViewObject_Release,
1842 ISVViewObject_GetColorSet,
1843 ISVViewObject_Freeze,
1844 ISVViewObject_Unfreeze,
1845 ISVViewObject_SetAdvise,
1846 ISVViewObject_GetAdvise