blob: 13322f5b6dc392b309c71eb1b335142fcc3298a3 [file] [log] [blame]
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001/*
2 * ShellView
3 *
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00004 * Copyright 1998 <juergen.schmied@metronet.de>
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00005 */
6
7#include <ctype.h>
8#include <stdlib.h>
9#include <string.h>
10#include "ole.h"
11#include "ole2.h"
12#include "debug.h"
13#include "compobj.h"
14#include "interfaces.h"
15#include "shlobj.h"
16#include "shell.h"
17#include "winerror.h"
18#include "winnls.h"
19#include "winproc.h"
20#include "commctrl.h"
21
22#include "shell32_main.h"
23#include "pidl.h"
24#include "shresdef.h"
25
26/***********************************************************************
27* IShellView implementation
28*/
29static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW,REFIID, LPVOID *);
30static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW) ;
31static ULONG WINAPI IShellView_Release(LPSHELLVIEW);
32 /* IOleWindow methods */
33static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW,HWND32 * lphwnd);
34static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW,BOOL32 fEnterMode);
35 /* IShellView methods */
36static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW,LPMSG32 lpmsg);
37static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW,BOOL32 fEnable);
38static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW,UINT32 uState);
39static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW);
40static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW, IShellView *lpPrevView,LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,RECT32 * prcView, HWND32 *phWnd);
41static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW);
42static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW, LPFOLDERSETTINGS lpfs);
43static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam);
44static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW);
45static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW, LPCITEMIDLIST pidlItem, UINT32 uFlags);
46static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW, UINT32 uItem, REFIID riid,LPVOID *ppv);
47
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000048static BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW);
49
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000050static struct IShellView_VTable svvt =
51{ IShellView_QueryInterface,
52 IShellView_AddRef,
53 IShellView_Release,
54 IShellView_GetWindow,
55 IShellView_ContextSensitiveHelp,
56 IShellView_TranslateAccelerator,
57 IShellView_EnableModeless,
58 IShellView_UIActivate,
59 IShellView_Refresh,
60 IShellView_CreateViewWindow,
61 IShellView_DestroyViewWindow,
62 IShellView_GetCurrentInfo,
63 IShellView_AddPropertySheetPages,
64 IShellView_SaveViewState,
65 IShellView_SelectItem,
66 IShellView_GetItemObject
67};
68
69//menu items
70#define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
71#define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
72#define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000073#define ID_LISTVIEW 2000
74#define MENU_OFFSET 1
75#define MENU_MAX 100
76#define TOOLBAR_ID (L"SHELLDLL_DefView")
77//windowsx.h
78#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
79#define GET_WM_COMMAND_HWND(wp, lp) (HWND32)(lp)
80#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
81// winuser.h
82#define WM_SETTINGCHANGE WM_WININICHANGE
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000083
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000084typedef 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;
93
94MYTOOLINFO g_Tools[] =
95{ {IDM_VIEW_FILES, 0, IDS_TB_VIEW_FILES, IDS_MI_VIEW_FILES, 0, TBSTATE_ENABLED, TBSTYLE_BUTTON},
96 {-1, 0, 0, 0, 0, 0, 0}
97};
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000098BOOL32 g_bViewKeys;
99BOOL32 g_bShowIDW;
100
101typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
102
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000103/**************************************************************************
104* IShellView_Constructor
105*/
106LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER pFolder, LPCITEMIDLIST pidl)
107{ LPSHELLVIEW sv;
108 sv=(LPSHELLVIEW)HeapAlloc(GetProcessHeap(),0,sizeof(IShellView));
109 sv->ref=1;
110 sv->lpvtbl=&svvt;
111
112 sv->mpidl = ILClone(pidl);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000113 sv->hMenu=0;
114
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000115 sv->pSFParent = pFolder;
116 if(sv->pSFParent)
117 sv->pSFParent->lpvtbl->fnAddRef(sv->pSFParent);
118
119 TRACE(shell,"(%p)->(%p pidl=%p)\n",sv, pFolder, pidl);
120 return sv;
121}
122/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000123* helperfunctions for communication with ICommDlgBrowser
124*
125*/
126static BOOL32 IsInCommDlg(LPSHELLVIEW this)
127{ return(this->pCommDlgBrowser != NULL);
128}
129static HRESULT IncludeObject(LPSHELLVIEW this, LPCITEMIDLIST pidl)
130{ if ( IsInCommDlg(this) )
131 { TRACE(shell,"ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
132 return (this->pCommDlgBrowser->lpvtbl->fnIncludeObject(this->pCommDlgBrowser, this, pidl));
133 }
134 return S_OK;
135}
136static HRESULT OnDefaultCommand(LPSHELLVIEW this)
137{ if (IsInCommDlg(this))
138 { TRACE(shell,"ICommDlgBrowser::OnDefaultCommand\n");
139 return (this->pCommDlgBrowser->lpvtbl->fnOnDefaultCommand(this->pCommDlgBrowser, this));
140 }
141 return S_FALSE;
142}
143static HRESULT OnStateChange(LPSHELLVIEW this, UINT32 uFlags)
144{ if (IsInCommDlg(this))
145 { TRACE(shell,"ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
146 return (this->pCommDlgBrowser->lpvtbl->fnOnStateChange(this->pCommDlgBrowser, this, uFlags));
147 }
148 return S_FALSE;
149}
150
151/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000152* ShellView_CreateList()
153*
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000154*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000155
156BOOL32 ShellView_CreateList (LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000157{ DWORD dwStyle;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000158
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000159 TRACE(shell,"%p\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000160
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000161 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_SHAREIMAGELISTS | LVS_EDITLABELS;
162 switch (this->FolderSettings.ViewMode)
163 { case FVM_ICON: dwStyle |= LVS_ICON; break;
164 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
165 case FVM_LIST: dwStyle |= LVS_LIST; break;
166 case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
167 }
168 if (this->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
169 /*if (this->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
170 if (this->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000171
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000172 this->hWndList=CreateWindowEx32A( WS_EX_CLIENTEDGE,
173 WC_LISTVIEW32A,
174 NULL,
175 dwStyle,
176 0,0,0,0,
177 this->hWnd,
178 (HMENU32)ID_LISTVIEW,
179 shell32_hInstance,
180 NULL);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000181
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000182 if(!this->hWndList)
183 return FALSE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000184
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000185 // UpdateShellSettings();
186 return TRUE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000187}
188/**************************************************************************
189* ShellView_InitList()
190*
191* NOTES
192* internal
193*/
194int nColumn1=100; /* width of column */
195int nColumn2=100;
196int nColumn3=100;
197int nColumn4=100;
198
199BOOL32 ShellView_InitList(LPSHELLVIEW this)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000200{ LVCOLUMN32A lvColumn;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000201 CHAR szString[50];
202
203 TRACE(shell,"%p\n",this);
204
205
206 ListView_DeleteAllItems(this->hWndList); /*empty the list*/
207
208 //initialize the columns
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000209 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
210
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000211 lvColumn.fmt = LVCFMT_LEFT;
212 lvColumn.pszText = szString;
213
214 lvColumn.cx = nColumn1;
215 strcpy(szString,"File");
216 /*LoadString32A(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000217 ListView_InsertColumn32A(this->hWndList, 0, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000218
219 lvColumn.cx = nColumn2;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000220 strcpy(szString,"COLUMN2");
221 ListView_InsertColumn32A(this->hWndList, 1, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000222
223 lvColumn.cx = nColumn3;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000224 strcpy(szString,"COLUMN3");
225 ListView_InsertColumn32A(this->hWndList, 2, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000226
227 lvColumn.cx = nColumn4;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000228 strcpy(szString,"COLUMN4");
229 ListView_InsertColumn32A(this->hWndList, 3, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000230
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000231 ListView_SetImageList(this->hWndList, ShellSmallIconList, LVSIL_SMALL);
232 ListView_SetImageList(this->hWndList, ShellBigIconList, LVSIL_NORMAL);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000233
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000234 return TRUE;
235}
236/**************************************************************************
237* ShellView_CompareItems()
238*
239* NOTES
240* internal
241*/
242int CALLBACK ShellView_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000243{ LPSHELLFOLDER pFolder = (LPSHELLFOLDER)lpData;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000244
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000245 TRACE(shell,"\n");
246 if(!pFolder)
247 return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000248
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000249 return (int)pFolder->lpvtbl->fnCompareIDs(pFolder, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000250}
251
252/**************************************************************************
253* ShellView_FillList()
254*
255* NOTES
256* internal
257*/
258
259void ShellView_FillList(LPSHELLVIEW this)
260{ LPENUMIDLIST pEnumIDList;
261 LPITEMIDLIST pidl;
262 DWORD dwFetched;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000263 LVITEM32A lvItem;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000264
265 TRACE(shell,"%p\n",this);
266
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000267 if(SUCCEEDED(this->pSFParent->lpvtbl->fnEnumObjects(this->pSFParent,this->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList)))
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000268 { SendMessage32A(this->hWndList, WM_SETREDRAW, FALSE, 0); /*turn the listview's redrawing off*/
269
270 while((S_OK == pEnumIDList->lpvtbl->fnNext(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
271 { ZeroMemory(&lvItem, sizeof(lvItem));
272
273 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
274 lvItem.iItem = ListView_GetItemCount(this->hWndList); /*add the item to the end of the list*/
275 lvItem.lParam = (LPARAM)ILClone(pidl); /*set the item's data*/
276 lvItem.pszText = LPSTR_TEXTCALLBACK32A; /*get text on a callback basis*/
277 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000278 if ( S_OK == IncludeObject(this, ILClone(pidl) )) /* fixme free the pidl*/
279 { ListView_InsertItem32A(this->hWndList, &lvItem); /*add the item*/
280 }
281 else
282 { SHFree(pidl); /* not viewed */
283 }
284
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000285 }
286
287 /*sort the items*/
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000288 /* ListView_SortItems(this->hWndList, ShellView_CompareItems, (LPARAM)this->pSFParent);*/
289
290
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000291 /*turn the listview's redrawing back on and force it to draw*/
292 SendMessage32A(this->hWndList, WM_SETREDRAW, TRUE, 0);
293 InvalidateRect32(this->hWndList, NULL, TRUE);
294 UpdateWindow32(this->hWndList);
295
296 pEnumIDList->lpvtbl->fnRelease(pEnumIDList);
297 }
298}
299
300/**************************************************************************
301* ShellView_OnCreate()
302*
303* NOTES
304* internal
305*/
306LRESULT ShellView_OnCreate(LPSHELLVIEW this)
307{ TRACE(shell,"%p\n",this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000308
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000309 if(ShellView_CreateList(this))
310 { if(ShellView_InitList(this))
311 { ShellView_FillList(this);
312 }
313 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000314
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000315 return S_OK;
316}
317/**************************************************************************
318* ShellView_OnSize()
319*/
320LRESULT ShellView_OnSize(LPSHELLVIEW this, WORD wWidth, WORD wHeight)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000321{ TRACE(shell,"%p width=%u height=%u\n",this, wWidth,wHeight);
322
323 /*resize the ListView to fit our window*/
324 if(this->hWndList)
325 { MoveWindow32(this->hWndList, 0, 0, wWidth, wHeight, TRUE);
326 }
327
328 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000329}
330/**************************************************************************
331* ShellView_BuildFileMenu()
332*/
333HMENU32 ShellView_BuildFileMenu(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000334{ CHAR szText[MAX_PATH];
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000335 MENUITEMINFO32A mii;
336 int nTools,i;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000337 HMENU32 hSubMenu;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000338
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000339 TRACE(shell,"(%p) semi-stub\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000340
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000341 hSubMenu = CreatePopupMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000342 if(hSubMenu)
343 { /*get the number of items in our global array*/
344 for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){}
345
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000346 /*add the menu items*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000347 for(i = 0; i < nTools; i++)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000348 { strcpy(szText, "dummy BuildFileMenu");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000349
350 ZeroMemory(&mii, sizeof(mii));
351 mii.cbSize = sizeof(mii);
352 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
353
354 if(TBSTYLE_SEP != g_Tools[i].bStyle)
355 { mii.fType = MFT_STRING;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000356 mii.fState = MFS_ENABLED;
357 mii.dwTypeData = szText;
358 mii.wID = g_Tools[i].idCommand;
359 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000360 else
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000361 { mii.fType = MFT_SEPARATOR;
362 }
363 /* tack this item onto the end of the menu */
364 InsertMenuItem32A(hSubMenu, (UINT32)-1, TRUE, &mii);
365 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000366 }
367 return hSubMenu;
368}
369/**************************************************************************
370* ShellView_MergeFileMenu()
371*/
372void ShellView_MergeFileMenu(LPSHELLVIEW this, HMENU32 hSubMenu)
373{ MENUITEMINFO32A mii;
374 CHAR szText[MAX_PATH];
375
376 TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",this,hSubMenu);
377 if(hSubMenu)
378 { ZeroMemory(&mii, sizeof(mii));
379
380 /* add a separator */
381 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
382 mii.fType = MFT_SEPARATOR;
383 mii.fState = MFS_ENABLED;
384
385 /*insert this item at the beginning of the menu */
386 InsertMenuItem32A(hSubMenu, 0, TRUE, &mii);
387
388 /*add the file menu items */
389 strcpy(szText,"dummy 45");
390
391 mii.cbSize = sizeof(mii);
392 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
393 mii.fType = MFT_STRING;
394 mii.fState = MFS_ENABLED;
395 mii.dwTypeData = szText;
396 mii.wID = IDM_MYFILEITEM;
397
398 /*insert this item at the beginning of the menu */
399 InsertMenuItem32A(hSubMenu, 0, TRUE, &mii);
400 }
401}
402
403/**************************************************************************
404* ShellView_MergeViewMenu()
405*/
406void ShellView_MergeViewMenu(LPSHELLVIEW this, HMENU32 hSubMenu)
407{ MENUITEMINFO32A mii;
408 CHAR szText[MAX_PATH];
409
410 TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",this,hSubMenu);
411 if(hSubMenu)
412 { ZeroMemory(&mii, sizeof(mii));
413
414 /*add a separator at the correct position in the menu*/
415 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
416 mii.fType = MFT_SEPARATOR;
417 mii.fState = MFS_ENABLED;
418 InsertMenuItem32A(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
419
420 /*add the view menu items at the correct position in the menu*/
421 strcpy(szText,"Dummy 46");
422
423 mii.cbSize = sizeof(mii);
424 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
425 mii.fType = MFT_STRING;
426 mii.fState = MFS_ENABLED;
427 mii.dwTypeData = szText;
428 mii.wID = IDM_VIEW_FILES;
429 InsertMenuItem32A(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
430 }
431}
432/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000433* ShellView_UpdateMenu()
434*/
435LRESULT ShellView_UpdateMenu(LPSHELLVIEW this, HMENU32 hMenu)
436{ TRACE(shell,"(%p)->(menu=0x%08x\n",this,hMenu);
437 CheckMenuItem32(hMenu, IDM_VIEW_FILES, MF_BYCOMMAND | (g_bViewKeys ? MF_CHECKED: MF_UNCHECKED));
438
439 if(ShellView_CanDoIDockingWindow(this))
440 { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED);
441 CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED));
442 }
443 else
444 { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
445 CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED);
446 }
447 return 0;
448}
449
450/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000451* ShellView_OnDeactivate()
452*
453* NOTES
454* internal
455*/
456void ShellView_OnDeactivate(LPSHELLVIEW this)
457{ TRACE(shell,"%p\n",this);
458 if(this->uState != SVUIA_DEACTIVATE)
459 { if(this->hMenu)
460 { this->pShellBrowser->lpvtbl->fnSetMenuSB(this->pShellBrowser,0, 0, 0);
461 this->pShellBrowser->lpvtbl->fnRemoveMenusSB(this->pShellBrowser,this->hMenu);
462 DestroyMenu32(this->hMenu);
463 this->hMenu = 0;
464 }
465
466 this->uState = SVUIA_DEACTIVATE;
467 }
468}
469
470/**************************************************************************
471* CShellView_OnActivate()
472*/
473LRESULT ShellView_OnActivate(LPSHELLVIEW this, UINT32 uState)
474{ OLEMENUGROUPWIDTHS32 omw = { {0, 0, 0, 0, 0, 0} };
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000475 MENUITEMINFO32A mii;
476 CHAR szText[MAX_PATH];
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000477
478 TRACE(shell,"%p uState=%x\n",this,uState);
479
480 //don't do anything if the state isn't really changing
481 if(this->uState == uState)
482 { return S_OK;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000483 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000484
485 ShellView_OnDeactivate(this);
486
487 //only do this if we are active
488 if(uState != SVUIA_DEACTIVATE)
489 { //merge the menus
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000490 this->hMenu = CreateMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000491
492 if(this->hMenu)
493 { this->pShellBrowser->lpvtbl->fnInsertMenusSB(this->pShellBrowser, this->hMenu, &omw);
494
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000495 /*build the top level menu get the menu item's text*/
496 strcpy(szText,"dummy 31");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000497
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000498 ZeroMemory(&mii, sizeof(mii));
499 mii.cbSize = sizeof(mii);
500 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
501 mii.fType = MFT_STRING;
502 mii.fState = MFS_ENABLED;
503 mii.dwTypeData = szText;
504 mii.hSubMenu = ShellView_BuildFileMenu(this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000505
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000506 /*insert our menu into the menu bar*/
507 if(mii.hSubMenu)
508 { InsertMenuItem32A(this->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
509 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000510
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000511 /*get the view menu so we can merge with it*/
512 ZeroMemory(&mii, sizeof(mii));
513 mii.cbSize = sizeof(mii);
514 mii.fMask = MIIM_SUBMENU;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000515
516 if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
517 { ShellView_MergeViewMenu(this, mii.hSubMenu);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000518 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000519
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000520 /*add the items that should only be added if we have the focus*/
521 if(SVUIA_ACTIVATE_FOCUS == uState)
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000522 { //get the file menu so we can merge with it
523 ZeroMemory(&mii, sizeof(mii));
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000524 mii.cbSize = sizeof(mii);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000525 mii.fMask = MIIM_SUBMENU;
526
527 if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
528 { ShellView_MergeFileMenu(this, mii.hSubMenu);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000529 }
530 }
531 this->pShellBrowser->lpvtbl->fnSetMenuSB(this->pShellBrowser, this->hMenu, 0, this->hWnd);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000532 }
533 }
534 this->uState = uState;
535 return 0;
536}
537
538/**************************************************************************
539* ShellView_OnSetFocus()
540*
541* NOTES
542* internal
543*/
544LRESULT ShellView_OnSetFocus(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000545{ TRACE(shell,"%p\n",this);
546 /* Tell the browser one of our windows has received the focus. This should always
547 be done before merging menus (OnActivate merges the menus) if one of our
548 windows has the focus.*/
549 this->pShellBrowser->lpvtbl->fnOnViewWindowActive(this->pShellBrowser,this);
550 ShellView_OnActivate(this, SVUIA_ACTIVATE_FOCUS);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000551
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000552 return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000553}
554
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000555/**************************************************************************
556* ShellView_OnKillFocus()
557*/
558LRESULT ShellView_OnKillFocus(LPSHELLVIEW this)
559{ TRACE(shell,"(%p) stub\n",this);
560 ShellView_OnActivate(this, SVUIA_ACTIVATE_NOFOCUS);
561 return 0;
562}
563
564/**************************************************************************
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000565* ShellView_AddRemoveDockingWindow()
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000566*/
567BOOL32 ShellView_AddRemoveDockingWindow(LPSHELLVIEW this, BOOL32 bAdd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000568{ BOOL32 bReturn = FALSE;
569 HRESULT hr;
570 LPSERVICEPROVIDER pSP;
571 LPDOCKINGWINDOWFRAME pFrame;
572
573 FIXME(shell,"(%p)->(badd=0x%08x) stub\n",this,bAdd);
574
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000575 /* get the browser's IServiceProvider */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000576 hr = this->pShellBrowser->lpvtbl->fnQueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000577 if(SUCCEEDED(hr))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000578 { /*get the IDockingWindowFrame pointer*/
579 hr = pSP->lpvtbl->fnQueryService(pSP, &SID_SShellBrowser, &IID_IDockingWindowFrame, (LPVOID*)&pFrame);
580 if(SUCCEEDED(hr))
581 { if(bAdd)
582 { hr = S_OK;
583 /*if(!this->pDockingWindow)
584 { //create the toolbar object
585 this->pDockingWindow = DockingWindow_Constructor(this, this->hWnd);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000586 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000587
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000588 if(this->pDockingWindow)
589 { //add the toolbar object
590 hr = pFrame->lpvtbl->fnAddToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, TOOLBAR_ID, 0);
591
592 if(SUCCEEDED(hr))
593 { bReturn = TRUE;
594 }
595 }*/
596 }
597 else
598 { /*if(this->pDockingWindow)
599 { hr = pFrame->->lpvtbl->fnRemoveToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, DWFRF_NORMAL);
600
601 if(SUCCEEDED(hr))
602 { // RemoveToolbar should release the toolbar object which will cause
603 //it to destroy itself. Our toolbar object is no longer valid at
604 //this point.
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000605
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000606 this->pDockingWindow = NULL;
607 bReturn = TRUE;
608 }
609 }*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000610 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000611 pFrame->lpvtbl->fnRelease(pFrame);
612 }
613 pSP->lpvtbl->fnRelease(pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000614 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000615 return bReturn;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000616}
617
618/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000619* ShellView_CanDoIDockingWindow()
620*/
621BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000622{ BOOL32 bReturn = FALSE;
623 HRESULT hr;
624 LPSERVICEPROVIDER pSP;
625 LPDOCKINGWINDOWFRAME pFrame;
626
627 FIXME(shell,"(%p) stub\n",this);
628
629 /*get the browser's IServiceProvider*/
630 hr = this->pShellBrowser->lpvtbl->fnQueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000631 if(hr==S_OK)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000632 { hr = pSP->lpvtbl->fnQueryService(pSP, &SID_SShellBrowser, &IID_IDockingWindowFrame, (LPVOID*)&pFrame);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000633 if(SUCCEEDED(hr))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000634 { bReturn = TRUE;
635 pFrame->lpvtbl->fnRelease(pFrame);
636 }
637 pSP->lpvtbl->fnRelease(pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000638 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000639 return bReturn;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000640}
641
642/**************************************************************************
643* ShellView_UpdateShellSettings()
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000644*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000645void ShellView_UpdateShellSettings(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000646{ FIXME(shell,"(%p) stub\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000647 return ;
648/*
649 SHELLFLAGSTATE sfs;
650 HINSTANCE hinstShell32;
651*/
652 /* Since SHGetSettings is not implemented in all versions of the shell, get the
653 function address manually at run time. This allows the code to run on all
654 platforms.*/
655/*
656 ZeroMemory(&sfs, sizeof(sfs));
657*/
658 /* The default, in case any of the following steps fails, is classic Windows 95
659 style.*/
660/*
661 sfs.fWin95Classic = TRUE;
662
663 hinstShell32 = LoadLibrary(TEXT("shell32.dll"));
664 if(hinstShell32)
665 { PFNSHGETSETTINGSPROC pfnSHGetSettings;
666
667 pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(hinstShell32, "SHGetSettings");
668 if(pfnSHGetSettings)
669 { (*pfnSHGetSettings)(&sfs, SSF_DOUBLECLICKINWEBVIEW | SSF_WIN95CLASSIC);
670 }
671 FreeLibrary(hinstShell32);
672 }
673
674 DWORD dwExStyles = 0;
675
676 if(!sfs.fWin95Classic && !sfs.fDoubleClickInWebView)
677 dwExStyles |= LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT;
678
679 ListView_SetExtendedListViewStyle(this->hWndList, dwExStyles);
680*/
681}
682
683/**************************************************************************
684* ShellView_OnSettingChange()
685*/
686LRESULT ShellView_OnSettingChange(LPSHELLVIEW this, LPCSTR lpszSection)
687{ TRACE(shell,"(%p) stub\n",this);
688 //if(0 == lstrcmpi(lpszSection, TEXT("ShellState")))
689 { ShellView_UpdateShellSettings(this);
690 return 0;
691 }
692 return 0;
693}
694
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000695/**************************************************************************
696* ShellView_DoContextMenu()
697*/
698void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000699{ UINT32 uCommand, i, uSelected = ListView_GetSelectedCount(this->hWndList);
700 DWORD wFlags;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000701 HMENU32 hMenu;
702 BOOL32 fExplore = FALSE;
703 HWND32 hwndTree = 0;
704 INT32 nMenuIndex;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000705 LPITEMIDLIST *aSelectedItems;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000706 LVITEM32A lvItem;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000707 MENUITEMINFO32A mii;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000708 LPCONTEXTMENU pContextMenu = NULL;
709 CMINVOKECOMMANDINFO32 cmi;
710
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000711 TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault);
712 aSelectedItems = (LPITEMIDLIST*)SHAlloc(uSelected * sizeof(LPITEMIDLIST));
713
714 if(aSelectedItems)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000715 { TRACE(shell,"-- Items selected =%u\n", uSelected);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000716 ZeroMemory(&lvItem, sizeof(lvItem));
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000717 lvItem.mask = LVIF_STATE | LVIF_PARAM;
718 lvItem.stateMask = LVIS_SELECTED;
719 lvItem.iItem = 0;
720
721 i = 0;
722
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000723 while(ListView_GetItem32A(this->hWndList, &lvItem) && (i < uSelected))
724 { if(lvItem.state & LVIS_SELECTED)
725 { aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam;
726 i++;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000727 TRACE(shell,"-- selected Item found\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000728 }
729 lvItem.iItem++;
730 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000731
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000732 this->pSFParent->lpvtbl->fnGetUIObjectOf( this->pSFParent,
733 this->hWndParent,
734 uSelected,
735 (LPCITEMIDLIST*)aSelectedItems,
736 &IID_IContextMenu,
737 NULL,
738 (LPVOID*)&pContextMenu);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000739
740 if(pContextMenu)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000741 { TRACE(shell,"-- pContextMenu\n");
742 hMenu = CreatePopupMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000743
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000744 /* See if we are in Explore or Open mode. If the browser's tree is present,
745 then we are in Explore mode.*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000746
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000747 fExplore = FALSE;
748 hwndTree = 0;
749 if(SUCCEEDED(this->pShellBrowser->lpvtbl->fnGetControlWindow(this->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
750 { TRACE(shell,"-- fExplore\n");
751 fExplore = TRUE;
752 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000753
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000754 if(hMenu && SUCCEEDED(pContextMenu->lpvtbl->fnQueryContextMenu( pContextMenu,
755 hMenu,
756 0,
757 MENU_OFFSET,
758 MENU_MAX,
759 CMF_NORMAL | (uSelected != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0))))
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000760 { if(fDefault)
761 { TRACE(shell,"-- fDefault\n");
762 uCommand = 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000763
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000764 ZeroMemory(&mii, sizeof(mii));
765 mii.cbSize = sizeof(mii);
766 mii.fMask = MIIM_STATE | MIIM_ID;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000767
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000768 nMenuIndex = 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000769
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000770 /*find the default item in the menu*/
771 while(GetMenuItemInfo32A(hMenu, nMenuIndex, TRUE, &mii))
772 { if(mii.fState & MFS_DEFAULT)
773 { uCommand = mii.wID;
774 break;
775 }
776 nMenuIndex++;
777 }
778 }
779 else
780 { TRACE(shell,"-- ! fDefault\n");
781 uCommand = TrackPopupMenu32( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL);
782 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000783
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000784 if(uCommand > 0)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000785 { TRACE(shell,"-- uCommand=%u\n", uCommand);
786 if (((uCommand-MENU_OFFSET) == IDM_EXPLORE) || ((uCommand-MENU_OFFSET) == IDM_OPEN))
787 { if (IsInCommDlg(this)) /* are we part of a commctrl? */
788 { TRACE(shell,"-- fnOnDefaultCommand\n");
789 OnDefaultCommand(this);
790 }
791 else /* we are acting with a full featured IShellBrowser */
792 { TRACE(shell,"-- fnBrowseObject pidl =%p\n", aSelectedItems[0]);
793 wFlags = SBSP_DEFBROWSER | SBSP_DEFMODE | SBSP_RELATIVE;
794 this->pShellBrowser->lpvtbl->fnBrowseObject( this->pShellBrowser,
795 aSelectedItems[0],
796 wFlags);
797 }
798 }
799 else
800 { ZeroMemory(&cmi, sizeof(cmi));
801 cmi.cbSize = sizeof(cmi);
802 cmi.hwnd = this->hWndParent;
803 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE32A(uCommand - MENU_OFFSET);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000804 pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000805 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000806 }
807 DestroyMenu32(hMenu);
808 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000809 pContextMenu->lpvtbl->fnRelease(pContextMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000810 }
811 SHFree(aSelectedItems);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000812 }
813}
814
815/**************************************************************************
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000816* ShellView_OnCommand()
817*/
818LRESULT ShellView_OnCommand(LPSHELLVIEW this,DWORD dwCmdID, DWORD dwCmd, HWND32 hwndCmd)
819{ TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",this, dwCmdID, dwCmd, hwndCmd);
820 switch(dwCmdID)
821 { case IDM_VIEW_FILES:
822 g_bViewKeys = ! g_bViewKeys;
823 IShellView_Refresh(this);
824 break;
825
826 case IDM_VIEW_IDW:
827 g_bShowIDW = ! g_bShowIDW;
828 ShellView_AddRemoveDockingWindow(this, g_bShowIDW);
829 break;
830
831 case IDM_MYFILEITEM:
832 MessageBeep32(MB_OK);
833 break;
834
835 default:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000836 FIXME(shell,"-- COMMAND unhandled\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000837 }
838 return 0;
839}
840
841/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000842* ShellView_OnNotify()
843*/
844
845LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000846{ NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh;
847 NMLVDISPINFO32A *lpdi = (NMLVDISPINFO32A *)lpnmh;
848 LPITEMIDLIST pidl;
849 DWORD dwCursor;
850 STRRET str;
851 UINT32 uFlags;
852 IExtractIcon *pei;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000853
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000854 TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",this,CtlID,lpnmh->code);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000855
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000856 switch(lpnmh->code)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000857 { case NM_SETFOCUS:
858 TRACE(shell,"-- NM_SETFOCUS %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000859 ShellView_OnSetFocus(this);
860 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000861
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000862 case NM_KILLFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000863 TRACE(shell,"-- NM_KILLFOCUS %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000864 ShellView_OnDeactivate(this);
865 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000866
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000867 case HDN_ENDTRACK32A:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000868 TRACE(shell,"-- HDN_ENDTRACK32A %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000869 /*nColumn1 = ListView_GetColumnWidth(this->hWndList, 0);
870 nColumn2 = ListView_GetColumnWidth(this->hWndList, 1);*/
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000871 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000872
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000873 case LVN_DELETEITEM:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000874 TRACE(shell,"-- LVN_DELETEITEM %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000875 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
876 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000877
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000878 case NM_DBLCLK:
879 case NM_RETURN:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000880 TRACE(shell,"-- NM_RETURN|NM_DBLCLK ignored, waiting for LVN_ITEMACTIVATE\n");
881 break;
882
883 case LVN_ITEMACTIVATE:
884 TRACE(shell,"-- LVN_ITEMACTIVATE %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000885 ShellView_DoContextMenu(this, 0, 0, TRUE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000886 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000887
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000888 case NM_RCLICK:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000889 TRACE(shell,"-- NM_RCLICK %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000890 dwCursor = GetMessagePos();
891 ShellView_DoContextMenu(this, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000892 break;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000893
894 case LVN_GETDISPINFO32A:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000895 TRACE(shell,"-- LVN_GETDISPINFO32A %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000896 pidl = (LPITEMIDLIST)lpdi->item.lParam;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000897
898
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000899 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/
900 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
901 { if(_ILIsValue(pidl)) /*is this a value or a folder?*/
902 { _ILGetDataText(this->mpidl, pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
903 if(!*lpdi->item.pszText)
904 sprintf(lpdi->item.pszText, "file attrib %u", lpdi->item.iSubItem );
905 }
906 else /*its a folder*/
907 { sprintf(lpdi->item.pszText, "folder attrib %u", lpdi->item.iSubItem );
908 }
909 }
910 }
911 else /*the item text is being requested*/
912 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
913 { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetDisplayNameOf(this->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)))
914 { if(STRRET_WSTR == str.uType)
915 { WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax);
916 SHFree(str.u.pOleStr);
917 }
918 if(STRRET_CSTR == str.uType)
919 { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax);
920 }
921 }
922 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000923
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000924 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/
925 { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent,this->hWnd,1,
926 (LPCITEMIDLIST*)&pidl, (REFIID)&IID_IExtractIcon, NULL, (LPVOID*)&pei)))
927 { //GetIconLoaction will give us the index into our image list
928 pei->lpvtbl->fnGetIconLocation(pei, GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags);
929 pei->lpvtbl->fnRelease(pei);
930 }
931 }
932 }
933 TRACE(shell,"-- text=%s image=%x\n",lpdi->item.pszText, lpdi->item.iImage);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000934 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000935
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000936 case NM_CLICK:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000937 WARN(shell,"-- NM_CLICK %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000938 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000939
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000940 case LVN_ITEMCHANGING:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000941 WARN(shell,"-- LVN_ITEMCHANGING %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000942 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000943
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000944 case LVN_ITEMCHANGED:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000945 WARN(shell,"-- LVN_ITEMCHANGED %p\n",this);
946 OnStateChange(this, CDBOSC_SELCHANGE);
947 break;
948
949 case LVN_DELETEALLITEMS:
950 WARN(shell,"-- LVN_DELETEALLITEMS %p\n",this);
951 break;
952
953 case LVN_INSERTITEM:
954 WARN(shell,"-- LVN_INSERTITEM %p\n",this);
955 break;
956
957 case LVN_BEGINDRAG:
958 WARN(shell,"-- LVN_BEGINDRAG %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000959 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000960
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000961 case NM_CUSTOMDRAW:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000962 WARN(shell,"NM_CUSTOMDRAW %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000963 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000964
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000965 default:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000966 FIXME (shell,"-- WM_NOTIFY unhandled\n");
967 break;;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000968 }
969 return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000970}
971
972/**************************************************************************
973* ShellView_WndProc
974*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000975
976LRESULT CALLBACK ShellView_WndProc(HWND32 hWnd, UINT32 uMessage, WPARAM32 wParam, LPARAM lParam)
977{ LPSHELLVIEW pThis = (LPSHELLVIEW)GetWindowLong32A(hWnd, GWL_USERDATA);
978 LPCREATESTRUCT32A lpcs;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000979 DWORD dwCursor;
980
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000981 TRACE(shell,"(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000982
983 switch (uMessage)
984 { case WM_NCCREATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000985 { TRACE(shell,"-- WM_NCCREATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000986 lpcs = (LPCREATESTRUCT32A)lParam;
987 pThis = (LPSHELLVIEW)(lpcs->lpCreateParams);
988 SetWindowLong32A(hWnd, GWL_USERDATA, (LONG)pThis);
989 pThis->hWnd = hWnd; /*set the window handle*/
990 }
991 break;
992
993 case WM_SIZE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000994 TRACE(shell,"-- WM_SIZE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000995 return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
996
997 case WM_SETFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000998 TRACE(shell,"-- WM_SETFOCUS\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000999 return ShellView_OnSetFocus(pThis);
1000
1001 case WM_KILLFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001002 TRACE(shell,"-- WM_KILLFOCUS\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001003 return ShellView_OnKillFocus(pThis);
1004
1005 case WM_CREATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001006 TRACE(shell,"-- WM_CREATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001007 return ShellView_OnCreate(pThis);
1008
1009 case WM_SHOWWINDOW:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001010 TRACE(shell,"-- WM_SHOWWINDOW\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001011 UpdateWindow32(pThis->hWndList);
1012 break;
1013
1014 case WM_ACTIVATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001015 TRACE(shell,"-- WM_ACTIVATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001016 return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1017
1018 case WM_COMMAND:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001019 TRACE(shell,"-- WM_COMMAND\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001020 return ShellView_OnCommand(pThis, GET_WM_COMMAND_ID(wParam, lParam),
1021 GET_WM_COMMAND_CMD(wParam, lParam),
1022 GET_WM_COMMAND_HWND(wParam, lParam));
1023
1024 case WM_INITMENUPOPUP:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001025 TRACE(shell,"-- WM_INITMENUPOPUP\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001026 return ShellView_UpdateMenu(pThis, (HMENU32)wParam);
1027
1028 case WM_NOTIFY:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001029 TRACE(shell,"-- WM_NOTIFY\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001030 return ShellView_OnNotify(pThis,(UINT32)wParam, (LPNMHDR)lParam);
1031
1032 case WM_SETTINGCHANGE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001033 TRACE(shell,"-- WM_SETTINGCHANGE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001034 return ShellView_OnSettingChange(pThis,(LPCSTR)lParam);
1035
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001036 case WM_PARENTNOTIFY:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001037 TRACE(shell,"-- WM_PARENTNOTIFY\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001038 if ( LOWORD(wParam) == WM_RBUTTONDOWN ) /* fixme: should not be handled here*/
1039 { dwCursor = GetMessagePos();
1040 ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
1041 return TRUE;
1042 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001043 break;
1044
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001045/* -------------*/
1046 case WM_MOVE:
1047 WARN(shell,"-- WM_MOVE\n");
1048 break;
1049
1050 case WM_ACTIVATEAPP:
1051 WARN(shell,"-- WM_ACTIVATEAPP\n");
1052 break;
1053
1054 case WM_NOTIFYFORMAT:
1055 WARN(shell,"-- WM_NOTIFYFORMAT\n");
1056 break;
1057
1058 case WM_NCPAINT:
1059 WARN(shell,"-- WM_NCPAINT\n");
1060 break;
1061
1062 case WM_ERASEBKGND:
1063 WARN(shell,"-- WM_ERASEBKGND\n");
1064 break;
1065
1066 case WM_PAINT:
1067 WARN(shell,"-- WM_PAINT\n");
1068 break;
1069
1070 case WM_NCCALCSIZE:
1071 WARN(shell,"-- WM_NCCALCSIZE\n");
1072 break;
1073
1074 case WM_WINDOWPOSCHANGING:
1075 WARN(shell,"-- WM_WINDOWPOSCHANGING\n");
1076 break;
1077
1078 case WM_WINDOWPOSCHANGED:
1079 WARN(shell,"-- WM_WINDOWPOSCHANGED\n");
1080 break;
1081
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001082 case WM_MOUSEACTIVATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001083 WARN(shell,"-- WM_MOUSEACTIVATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001084 break;
1085
1086 case WM_SETCURSOR:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001087 WARN(shell,"-- WM_SETCURSOR\n");
1088 break;
1089
1090 case WM_DESTROY:
1091 WARN(shell,"-- WM_DESTROY\n");
1092 break;
1093
1094 case WM_NCDESTROY:
1095 WARN(shell,"-- WM_NCDESTROY\n");
1096 break;
1097
1098 case WM_CONTEXTMENU:
1099 WARN(shell,"-- WM_CONTEXTMENU\n");
1100 break;
1101
1102 case WM_MENUSELECT:
1103 WARN(shell,"-- WM_MENUSELECT\n");
1104 break;
1105
1106 case WM_CAPTURECHANGED:
1107 WARN(shell,"-- WM_CAPTURECHANGED\n");
1108 break;
1109
1110 case WM_CHILDACTIVATE:
1111 WARN(shell,"-- WM_CHILDACTIVATE\n");
1112 break;
1113
1114 case WM_ENTERIDLE:
1115 WARN(shell,"-- WM_ENTERIDLE\n");
1116 break;
1117
1118 default:
1119 FIXME(shell,"-- MESSAGE unhandled\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001120 break;
1121 }
1122 return DefWindowProc32A (hWnd, uMessage, wParam, lParam);
1123}
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001124/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001125*
1126*
1127* The INTERFACE of the IShellView object
1128*
1129*
1130***************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001131* IShellView::QueryInterface
1132*/
1133static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW this,REFIID riid, LPVOID *ppvObj)
1134{ char xriid[50];
1135 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1136 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
1137
1138 *ppvObj = NULL;
1139
1140 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1141 { *ppvObj = this;
1142 }
1143 else if(IsEqualIID(riid, &IID_IShellView)) /*IShellView*/
1144 { *ppvObj = (IShellView*)this;
1145 }
1146
1147 if(*ppvObj)
1148 { (*(LPSHELLVIEW*)ppvObj)->lpvtbl->fnAddRef(this);
1149 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1150 return S_OK;
1151 }
1152 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
1153 return E_NOINTERFACE;
1154}
1155/**************************************************************************
1156* IShellView::AddRef
1157*/
1158static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW this)
1159{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
1160 return ++(this->ref);
1161}
1162/**************************************************************************
1163* IShellView::Release
1164*/
1165static ULONG WINAPI IShellView_Release(LPSHELLVIEW this)
1166{ TRACE(shell,"(%p)->()\n",this);
1167 if (!--(this->ref))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001168 { TRACE(shell," destroying IShellView(%p)\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001169
1170 if(this->pSFParent)
1171 this->pSFParent->lpvtbl->fnRelease(this->pSFParent);
1172
1173 HeapFree(GetProcessHeap(),0,this);
1174 return 0;
1175 }
1176 return this->ref;
1177}
1178/**************************************************************************
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001179* ShellView_GetWindow
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001180*/
1181static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW this,HWND32 * phWnd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001182{ TRACE(shell,"(%p) stub\n",this);
1183 *phWnd = this->hWnd;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001184
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001185 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001186}
1187static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW this,BOOL32 fEnterMode)
1188{ FIXME(shell,"(%p) stub\n",this);
1189 return E_NOTIMPL;
1190}
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001191/**************************************************************************
1192* IShellView_TranslateAccelerator
1193*
1194* FIXME:
1195* use the accel functions
1196*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001197static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW this,LPMSG32 lpmsg)
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001198{ FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",this,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
1199/* switch (lpmsg->message)
1200 { case WM_RBUTTONDOWN:
1201 return SendMessage32A ( lpmsg->hwnd, WM_NOTIFY, );
1202 }*/
1203 return S_FALSE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001204}
1205static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW this,BOOL32 fEnable)
1206{ FIXME(shell,"(%p) stub\n",this);
1207 return E_NOTIMPL;
1208}
1209static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW this,UINT32 uState)
1210{ CHAR szName[MAX_PATH];
1211 LRESULT lResult;
1212 int nPartArray[1] = {-1};
1213
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001214 FIXME(shell,"(%p)->(state=%x) stub\n",this, uState);
1215 /*don't do anything if the state isn't really changing*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001216 if(this->uState == uState)
1217 { return S_OK;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001218 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001219
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001220 /*OnActivate handles the menu merging and internal state*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001221 ShellView_OnActivate(this, uState);
1222
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001223 /*remove the docking window*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001224 if(g_bShowIDW)
1225 { ShellView_AddRemoveDockingWindow(this, FALSE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001226 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001227
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001228 /*only do this if we are active*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001229 if(uState != SVUIA_DEACTIVATE)
1230 { //update the status bar
1231 strcpy(szName, "dummy32");
1232
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001233 this->pSFParent->lpvtbl->fnGetFolderPath( this->pSFParent,
1234 szName + strlen(szName),
1235 sizeof(szName) - strlen(szName));
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001236
1237 /* set the number of parts */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001238 this->pShellBrowser->lpvtbl->fnSendControlMsg(this->pShellBrowser,
1239 FCW_STATUS,
1240 SB_SETPARTS,
1241 1,
1242 (LPARAM)nPartArray,
1243 &lResult);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001244
1245 /* set the text for the parts */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001246 this->pShellBrowser->lpvtbl->fnSendControlMsg(this->pShellBrowser,
1247 FCW_STATUS,
1248 SB_SETTEXT32A,
1249 0,
1250 (LPARAM)szName,
1251 &lResult);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001252
1253 //add the docking window if necessary
1254 if(g_bShowIDW)
1255 { ShellView_AddRemoveDockingWindow(this, TRUE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001256 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001257 }
1258 return S_OK;
1259}
1260static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001261{ TRACE(shell,"(%p)\n",this);
1262
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001263 ListView_DeleteAllItems(this->hWndList);
1264 ShellView_FillList(this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001265
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001266 return S_OK;
1267}
1268static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW this, IShellView *lpPrevView,
1269 LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,RECT32 * prcView, HWND32 *phWnd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001270{ WNDCLASS32A wc;
1271 *phWnd = 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001272
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001273 TRACE(shell,"(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",this, lpPrevView,lpfs, psb, prcView, phWnd);
1274 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);
1275
1276 /*set up the member variables*/
1277 this->pShellBrowser = psb;
1278 this->FolderSettings = *lpfs;
1279
1280 /*get our parent window*/
1281 this->pShellBrowser->lpvtbl->fnAddRef(this->pShellBrowser);
1282 this->pShellBrowser->lpvtbl->fnGetWindow(this->pShellBrowser, &(this->hWndParent));
1283
1284 /* try to get the ICommDlgBrowserInterface */
1285 this->pCommDlgBrowser=NULL;
1286 if ( SUCCEEDED (this->pShellBrowser->lpvtbl->fnQueryInterface( this->pShellBrowser,
1287 &IID_ICommDlgBrowser,
1288 (LPVOID*) &this->pCommDlgBrowser)))
1289 { TRACE(shell,"-- CommDlgBrowser\n");
1290 }
1291
1292 /*if our window class has not been registered, then do so*/
1293 if(!GetClassInfo32A(shell32_hInstance, SV_CLASS_NAME, &wc))
1294 { ZeroMemory(&wc, sizeof(wc));
1295 wc.style = CS_HREDRAW | CS_VREDRAW;
1296 wc.lpfnWndProc = (WNDPROC32) ShellView_WndProc;
1297 wc.cbClsExtra = 0;
1298 wc.cbWndExtra = 0;
1299 wc.hInstance = shell32_hInstance;
1300 wc.hIcon = 0;
1301 wc.hCursor = LoadCursor32A (0, IDC_ARROW32A);
1302 wc.hbrBackground = (HBRUSH32) (COLOR_WINDOW + 1);
1303 wc.lpszMenuName = NULL;
1304 wc.lpszClassName = SV_CLASS_NAME;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001305
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001306 if(!RegisterClass32A(&wc))
1307 return E_FAIL;
1308 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001309
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001310 *phWnd = CreateWindowEx32A(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001311 prcView->left, prcView->top, prcView->right - prcView->left, prcView->bottom - prcView->top,
1312 this->hWndParent, 0, shell32_hInstance, (LPVOID)this);
1313
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001314 if(!*phWnd)
1315 return E_FAIL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001316
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001317 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001318}
1319
1320static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001321{ TRACE(shell,"(%p)\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001322
1323 /*Make absolutely sure all our UI is cleaned up.*/
1324 IShellView_UIActivate(this, SVUIA_DEACTIVATE);
1325 if(this->hMenu)
1326 { DestroyMenu32(this->hMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001327 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001328 DestroyWindow32(this->hWnd);
1329 this->pShellBrowser->lpvtbl->fnRelease(this->pShellBrowser);
1330 return S_OK;
1331}
1332static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW this, LPFOLDERSETTINGS lpfs)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001333{ TRACE(shell,"(%p)->(%p) vmode=%x flags=%x\n",this, lpfs,
1334 this->FolderSettings.ViewMode, this->FolderSettings.fFlags);
1335
1336 if (lpfs)
1337 { *lpfs = this->FolderSettings;
1338 return NOERROR;
1339 }
1340 else
1341 return E_INVALIDARG;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001342}
1343static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW this, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1344{ FIXME(shell,"(%p) stub\n",this);
1345 return E_NOTIMPL;
1346}
1347static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW this)
1348{ FIXME(shell,"(%p) stub\n",this);
1349 return S_OK;
1350}
1351static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW this, LPCITEMIDLIST pidlItem, UINT32 uFlags)
1352{ FIXME(shell,"(%p)->(pidl=%p, 0x%08x) stub\n",this, pidlItem, uFlags);
1353 return E_NOTIMPL;
1354}
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001355static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW this, UINT32 uItem, REFIID riid, LPVOID *ppvOut)
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001356{ char xriid[50];
1357 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1358
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001359 FIXME(shell,"(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)stub\n",this, uItem, xriid, ppvOut);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001360
1361 *ppvOut = NULL;
1362 return E_NOTIMPL;
1363}