blob: 6c4abe5c6bfe378885e8f08acd19af047ef118ce [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"
Juergen Schmiedcf5faa61998-11-15 13:27:16 +000025#include "if_macros.h"
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000026
27/***********************************************************************
28* IShellView implementation
29*/
30static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW,REFIID, LPVOID *);
31static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW) ;
32static ULONG WINAPI IShellView_Release(LPSHELLVIEW);
33 /* IOleWindow methods */
34static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW,HWND32 * lphwnd);
35static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW,BOOL32 fEnterMode);
36 /* IShellView methods */
37static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW,LPMSG32 lpmsg);
38static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW,BOOL32 fEnable);
39static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW,UINT32 uState);
40static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW);
41static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW, IShellView *lpPrevView,LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,RECT32 * prcView, HWND32 *phWnd);
42static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW);
43static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW, LPFOLDERSETTINGS lpfs);
44static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam);
45static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW);
46static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW, LPCITEMIDLIST pidlItem, UINT32 uFlags);
47static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW, UINT32 uItem, REFIID riid,LPVOID *ppv);
48
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000049static BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW);
50
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000051static struct IShellView_VTable svvt =
52{ IShellView_QueryInterface,
53 IShellView_AddRef,
54 IShellView_Release,
55 IShellView_GetWindow,
56 IShellView_ContextSensitiveHelp,
57 IShellView_TranslateAccelerator,
58 IShellView_EnableModeless,
59 IShellView_UIActivate,
60 IShellView_Refresh,
61 IShellView_CreateViewWindow,
62 IShellView_DestroyViewWindow,
63 IShellView_GetCurrentInfo,
64 IShellView_AddPropertySheetPages,
65 IShellView_SaveViewState,
66 IShellView_SelectItem,
67 IShellView_GetItemObject
68};
69
Marcus Meissner73458b01998-12-26 12:54:29 +000070/*menu items */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000071#define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500)
72#define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501)
73#define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502)
Juergen Schmied6acd0591998-10-11 15:50:14 +000074
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000075#define ID_LISTVIEW 2000
Juergen Schmied6acd0591998-10-11 15:50:14 +000076
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000077#define MENU_OFFSET 1
78#define MENU_MAX 100
Juergen Schmied6acd0591998-10-11 15:50:14 +000079
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000080#define TOOLBAR_ID (L"SHELLDLL_DefView")
Marcus Meissner73458b01998-12-26 12:54:29 +000081/*windowsx.h */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000082#define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp)
83#define GET_WM_COMMAND_HWND(wp, lp) (HWND32)(lp)
84#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
Marcus Meissner73458b01998-12-26 12:54:29 +000085/* winuser.h */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000086#define WM_SETTINGCHANGE WM_WININICHANGE
Juergen Schmiedcf5faa61998-11-15 13:27:16 +000087extern void WINAPI _InsertMenuItem (HMENU32 hmenu, UINT32 indexMenu, BOOL32 fByPosition,
88 UINT32 wID, UINT32 fType, LPSTR dwTypeData, UINT32 fState);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000089
Alexandre Julliard85ed45e1998-08-22 19:03:56 +000090typedef struct
91{ int idCommand;
92 int iImage;
93 int idButtonString;
94 int idMenuString;
95 int nStringOffset;
96 BYTE bState;
97 BYTE bStyle;
98} MYTOOLINFO, *LPMYTOOLINFO;
99
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000100extern LPCVOID _Resource_Men_MENU_001_0_data;
101extern LPCVOID _Resource_Men_MENU_002_0_data;
102
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000103MYTOOLINFO g_Tools[] =
104{ {IDM_VIEW_FILES, 0, IDS_TB_VIEW_FILES, IDS_MI_VIEW_FILES, 0, TBSTATE_ENABLED, TBSTYLE_BUTTON},
105 {-1, 0, 0, 0, 0, 0, 0}
106};
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000107BOOL32 g_bViewKeys;
108BOOL32 g_bShowIDW;
109
110typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
111
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000112/**************************************************************************
113* IShellView_Constructor
114*/
Juergen Schmied6acd0591998-10-11 15:50:14 +0000115LPSHELLVIEW IShellView_Constructor( LPSHELLFOLDER pFolder, LPCITEMIDLIST pidl)
116{ LPSHELLVIEW sv;
117 sv=(LPSHELLVIEW)HeapAlloc(GetProcessHeap(),0,sizeof(IShellView));
118 sv->ref=1;
119 sv->lpvtbl=&svvt;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000120
Juergen Schmied6acd0591998-10-11 15:50:14 +0000121 sv->mpidl = ILClone(pidl);
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000122 sv->hMenu = 0;
Juergen Schmied6acd0591998-10-11 15:50:14 +0000123 sv->pSFParent = pFolder;
124 sv->uSelected = 0;
125 sv->aSelectedItems = NULL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000126
Juergen Schmied6acd0591998-10-11 15:50:14 +0000127 if(sv->pSFParent)
128 sv->pSFParent->lpvtbl->fnAddRef(sv->pSFParent);
129
130 TRACE(shell,"(%p)->(%p pidl=%p)\n",sv, pFolder, pidl);
131 return sv;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000132}
133/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000134* helperfunctions for communication with ICommDlgBrowser
135*
136*/
137static BOOL32 IsInCommDlg(LPSHELLVIEW this)
138{ return(this->pCommDlgBrowser != NULL);
139}
140static HRESULT IncludeObject(LPSHELLVIEW this, LPCITEMIDLIST pidl)
141{ if ( IsInCommDlg(this) )
142 { TRACE(shell,"ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);
143 return (this->pCommDlgBrowser->lpvtbl->fnIncludeObject(this->pCommDlgBrowser, this, pidl));
144 }
145 return S_OK;
146}
147static HRESULT OnDefaultCommand(LPSHELLVIEW this)
148{ if (IsInCommDlg(this))
149 { TRACE(shell,"ICommDlgBrowser::OnDefaultCommand\n");
150 return (this->pCommDlgBrowser->lpvtbl->fnOnDefaultCommand(this->pCommDlgBrowser, this));
151 }
152 return S_FALSE;
153}
154static HRESULT OnStateChange(LPSHELLVIEW this, UINT32 uFlags)
155{ if (IsInCommDlg(this))
156 { TRACE(shell,"ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);
157 return (this->pCommDlgBrowser->lpvtbl->fnOnStateChange(this->pCommDlgBrowser, this, uFlags));
158 }
159 return S_FALSE;
160}
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000161static void SetStyle(LPSHELLVIEW this, DWORD dwAdd, DWORD dwRemove)
162{ DWORD tmpstyle;
163
164 TRACE(shell,"(%p)\n", this);
165
166 tmpstyle = GetWindowLong32A(this->hWndList, GWL_STYLE);
167 SetWindowLong32A(this->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
168}
169
170static void CheckToolbar(LPSHELLVIEW this)
171{ LRESULT result;
172
173 TRACE(shell,"\n");
174
175 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
176 FCIDM_TB_SMALLICON, (this->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);
177 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
178 FCIDM_TB_REPORTVIEW, (this->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);
179 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
180 FCIDM_TB_SMALLICON, TRUE, &result);
181 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
182 FCIDM_TB_REPORTVIEW, TRUE, &result);
183 TRACE(shell,"--\n");
184}
185
186static void MergeToolBar(LPSHELLVIEW this)
187{ LRESULT iStdBMOffset;
188 LRESULT iViewBMOffset;
189 TBADDBITMAP ab;
190 TBBUTTON tbActual[6];
191 int i;
192 enum
193 { IN_STD_BMP = 0x4000,
194 IN_VIEW_BMP = 0x8000,
195 } ;
196 static const TBBUTTON c_tbDefault[] =
197 { { STD_COPY | IN_STD_BMP, FCIDM_SHVIEW_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0, -1},
198 { 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0,0}, 0, -1 },
199 { VIEW_LARGEICONS | IN_VIEW_BMP, FCIDM_SHVIEW_BIGICON, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
200 { VIEW_SMALLICONS | IN_VIEW_BMP, FCIDM_SHVIEW_SMALLICON, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
201 { VIEW_LIST | IN_VIEW_BMP, FCIDM_SHVIEW_LISTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
202 { VIEW_DETAILS | IN_VIEW_BMP, FCIDM_SHVIEW_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0,0}, 0L, -1 },
203 } ;
204
205 TRACE(shell,"\n");
206
Marcus Meissner73458b01998-12-26 12:54:29 +0000207 ab.hInst = HINST_COMMCTRL; /* hinstCommctrl */
208 ab.nID = IDB_STD_SMALL_COLOR; /* std bitmaps */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000209 IShellBrowser_SendControlMsg(this->pShellBrowser,FCW_TOOLBAR,
210 TB_ADDBITMAP, 8, (LPARAM)&ab, &iStdBMOffset);
211
Juergen Schmiedbcd05e91998-11-25 16:47:05 +0000212 TRACE(shell,"TB_ADDBITMAP returns %lx\n", iStdBMOffset);
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000213
Marcus Meissner73458b01998-12-26 12:54:29 +0000214 ab.nID = IDB_VIEW_SMALL_COLOR; /* std view bitmaps */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000215 IShellBrowser_SendControlMsg(this->pShellBrowser,FCW_TOOLBAR,
216 TB_ADDBITMAP, 8, (LPARAM)&ab, &iViewBMOffset);
217
Juergen Schmiedbcd05e91998-11-25 16:47:05 +0000218 TRACE(shell,"TB_ADDBITMAP returns %lx\n", iViewBMOffset);
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000219
220 for (i=0; i<6; ++i)
221 { tbActual[i] = c_tbDefault[i];
222 if (!(tbActual[i].fsStyle & TBSTYLE_SEP))
223 { if (tbActual[i].iBitmap & IN_VIEW_BMP)
224 { tbActual[i].iBitmap = (tbActual[i].iBitmap & ~IN_VIEW_BMP) + iViewBMOffset;
225 }
226 else if (tbActual[i].iBitmap & IN_STD_BMP)
227 { tbActual[i].iBitmap = (tbActual[i].iBitmap & ~IN_STD_BMP) + iStdBMOffset;
228 }
229 }
230 }
231
232 IShellBrowser_SetToolbarItems(this->pShellBrowser,tbActual, 6, FCT_MERGE);
233
234 CheckToolbar(this);
235 TRACE(shell,"--\n");
236
237}
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000238
239/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000240* ShellView_CreateList()
241*
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000242*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000243
244BOOL32 ShellView_CreateList (LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000245{ DWORD dwStyle;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000246
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000247 TRACE(shell,"%p\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000248
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000249 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER |
250 LVS_SHAREIMAGELISTS | LVS_EDITLABELS;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000251 switch (this->FolderSettings.ViewMode)
252 { case FVM_ICON: dwStyle |= LVS_ICON; break;
Juergen Schmied47a80041998-11-22 18:29:50 +0000253 case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000254 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
255 case FVM_LIST: dwStyle |= LVS_LIST; break;
Juergen Schmied47a80041998-11-22 18:29:50 +0000256 default: dwStyle |= LVS_LIST; break;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000257 }
258 if (this->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
259 /*if (this->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/
260 if (this->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000261
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000262 this->hWndList=CreateWindowEx32A( WS_EX_CLIENTEDGE,
263 WC_LISTVIEW32A,
264 NULL,
265 dwStyle,
266 0,0,0,0,
267 this->hWnd,
268 (HMENU32)ID_LISTVIEW,
269 shell32_hInstance,
270 NULL);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000271
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000272 if(!this->hWndList)
273 return FALSE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000274
Marcus Meissner73458b01998-12-26 12:54:29 +0000275 /* UpdateShellSettings(); */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000276 return TRUE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000277}
278/**************************************************************************
279* ShellView_InitList()
280*
281* NOTES
282* internal
283*/
Juergen Schmied47a80041998-11-22 18:29:50 +0000284int nColumn1=120; /* width of column */
Juergen Schmiedbcd05e91998-11-25 16:47:05 +0000285int nColumn2=80;
Juergen Schmied47a80041998-11-22 18:29:50 +0000286int nColumn3=170;
287int nColumn4=60;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000288
289BOOL32 ShellView_InitList(LPSHELLVIEW this)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000290{ LVCOLUMN32A lvColumn;
291 CHAR szString[50];
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000292
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000293 TRACE(shell,"%p\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000294
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000295 ListView_DeleteAllItems(this->hWndList);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000296
Marcus Meissner73458b01998-12-26 12:54:29 +0000297 /*initialize the columns */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000298 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/
299 lvColumn.fmt = LVCFMT_LEFT;
300 lvColumn.pszText = szString;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000301
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000302 lvColumn.cx = nColumn1;
303 strcpy(szString,"File");
304 /*LoadString32A(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/
305 ListView_InsertColumn32A(this->hWndList, 0, &lvColumn);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000306
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000307 lvColumn.cx = nColumn2;
308 strcpy(szString,"Size");
309 ListView_InsertColumn32A(this->hWndList, 1, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000310
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000311 lvColumn.cx = nColumn3;
312 strcpy(szString,"Type");
313 ListView_InsertColumn32A(this->hWndList, 2, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000314
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000315 lvColumn.cx = nColumn4;
316 strcpy(szString,"Modified");
317 ListView_InsertColumn32A(this->hWndList, 3, &lvColumn);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000318
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000319 ListView_SetImageList(this->hWndList, ShellSmallIconList, LVSIL_SMALL);
320 ListView_SetImageList(this->hWndList, ShellBigIconList, LVSIL_NORMAL);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000321
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000322 return TRUE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000323}
324/**************************************************************************
Juergen Schmied6acd0591998-10-11 15:50:14 +0000325* ShellView_CompareItems()
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000326*
327* NOTES
Juergen Schmied6acd0591998-10-11 15:50:14 +0000328* internal, CALLBACK for DSA_Sort
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000329*/
Juergen Schmied882c1be1998-12-14 17:40:25 +0000330INT32 CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData)
Juergen Schmied6acd0591998-10-11 15:50:14 +0000331{ int ret;
332 TRACE(shell,"pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000333
Juergen Schmied6acd0591998-10-11 15:50:14 +0000334 if(!lpData)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000335 return 0;
Juergen Schmied6acd0591998-10-11 15:50:14 +0000336
337 ret = (int)((LPSHELLFOLDER)lpData)->lpvtbl->fnCompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2);
338 TRACE(shell,"ret=%i\n",ret);
339 return ret;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000340}
341
342/**************************************************************************
343* ShellView_FillList()
344*
345* NOTES
346* internal
347*/
348
Juergen Schmied6acd0591998-10-11 15:50:14 +0000349static HRESULT ShellView_FillList(LPSHELLVIEW this)
350{ LPENUMIDLIST pEnumIDList;
351 LPITEMIDLIST pidl;
352 DWORD dwFetched;
353 UINT32 i;
354 LVITEM32A lvItem;
355 HRESULT hRes;
356 HDPA hdpa;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000357
Juergen Schmied6acd0591998-10-11 15:50:14 +0000358 TRACE(shell,"%p\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000359
Juergen Schmied6acd0591998-10-11 15:50:14 +0000360 /* get the itemlist from the shfolder*/
361 hRes = this->pSFParent->lpvtbl->fnEnumObjects(this->pSFParent,this->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);
362 if (hRes != S_OK)
363 { if (hRes==S_FALSE)
364 return(NOERROR);
365 return(hRes);
366 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000367
Juergen Schmied6acd0591998-10-11 15:50:14 +0000368 /* create a pointer array */
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000369 hdpa = pDPA_Create(16);
Juergen Schmied6acd0591998-10-11 15:50:14 +0000370 if (!hdpa)
371 { return(E_OUTOFMEMORY);
372 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000373
Juergen Schmied6acd0591998-10-11 15:50:14 +0000374 /* copy the items into the array*/
375 while((S_OK == pEnumIDList->lpvtbl->fnNext(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000376 { if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)
Juergen Schmied6acd0591998-10-11 15:50:14 +0000377 { SHFree(pidl);
378 }
379 }
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000380
Juergen Schmied6acd0591998-10-11 15:50:14 +0000381 /*sort the array*/
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000382 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)this->pSFParent);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000383
Juergen Schmied6acd0591998-10-11 15:50:14 +0000384 /*turn the listview's redrawing off*/
385 SendMessage32A(this->hWndList, WM_SETREDRAW, FALSE, 0);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000386
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000387 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/
Juergen Schmied6acd0591998-10-11 15:50:14 +0000388 { pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i);
389 if (IncludeObject(this, pidl) == S_OK) /* in a commdlg this works as a filemask*/
390 { ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/
391 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/
392 lvItem.iItem = ListView_GetItemCount(this->hWndList); /*add the item to the end of the list*/
393 lvItem.lParam = (LPARAM)ILClone(pidl); /*set the item's data*/
394 lvItem.pszText = LPSTR_TEXTCALLBACK32A; /*get text on a callback basis*/
395 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/
396 ListView_InsertItem32A(this->hWndList, &lvItem);
397 }
398 else
399 SHFree(pidl); /* the listview has a COPY*/
400 }
401
402 /*turn the listview's redrawing back on and force it to draw*/
403 SendMessage32A(this->hWndList, WM_SETREDRAW, TRUE, 0);
404 InvalidateRect32(this->hWndList, NULL, TRUE);
405 UpdateWindow32(this->hWndList);
406
407 pEnumIDList->lpvtbl->fnRelease(pEnumIDList); /* destroy the list*/
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000408 pDPA_Destroy(hdpa);
Juergen Schmied6acd0591998-10-11 15:50:14 +0000409
410 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000411}
412
413/**************************************************************************
414* ShellView_OnCreate()
415*
416* NOTES
417* internal
418*/
419LRESULT ShellView_OnCreate(LPSHELLVIEW this)
420{ TRACE(shell,"%p\n",this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000421
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000422 if(ShellView_CreateList(this))
423 { if(ShellView_InitList(this))
424 { ShellView_FillList(this);
425 }
426 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000427
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000428 return S_OK;
429}
430/**************************************************************************
431* ShellView_OnSize()
432*/
433LRESULT ShellView_OnSize(LPSHELLVIEW this, WORD wWidth, WORD wHeight)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000434{ TRACE(shell,"%p width=%u height=%u\n",this, wWidth,wHeight);
435
436 /*resize the ListView to fit our window*/
437 if(this->hWndList)
438 { MoveWindow32(this->hWndList, 0, 0, wWidth, wHeight, TRUE);
439 }
440
441 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000442}
443/**************************************************************************
444* ShellView_BuildFileMenu()
445*/
446HMENU32 ShellView_BuildFileMenu(LPSHELLVIEW this)
Juergen Schmied61013241998-10-16 15:40:20 +0000447{ CHAR szText[MAX_PATH];
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000448 MENUITEMINFO32A mii;
Juergen Schmied61013241998-10-16 15:40:20 +0000449 int nTools,i;
450 HMENU32 hSubMenu;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000451
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000452 TRACE(shell,"(%p) semi-stub\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000453
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000454 hSubMenu = CreatePopupMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000455 if(hSubMenu)
456 { /*get the number of items in our global array*/
457 for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){}
458
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000459 /*add the menu items*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000460 for(i = 0; i < nTools; i++)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000461 { strcpy(szText, "dummy BuildFileMenu");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000462
463 ZeroMemory(&mii, sizeof(mii));
464 mii.cbSize = sizeof(mii);
465 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
466
Juergen Schmied61013241998-10-16 15:40:20 +0000467 if(TBSTYLE_SEP != g_Tools[i].bStyle) /* no seperator*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000468 { mii.fType = MFT_STRING;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000469 mii.fState = MFS_ENABLED;
470 mii.dwTypeData = szText;
471 mii.wID = g_Tools[i].idCommand;
472 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000473 else
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000474 { mii.fType = MFT_SEPARATOR;
475 }
476 /* tack this item onto the end of the menu */
477 InsertMenuItem32A(hSubMenu, (UINT32)-1, TRUE, &mii);
478 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000479 }
Juergen Schmied61013241998-10-16 15:40:20 +0000480 TRACE(shell,"-- return (menu=0x%x)\n",hSubMenu);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000481 return hSubMenu;
482}
483/**************************************************************************
484* ShellView_MergeFileMenu()
485*/
486void ShellView_MergeFileMenu(LPSHELLVIEW this, HMENU32 hSubMenu)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000487{ TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",this,hSubMenu);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000488
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000489 if(hSubMenu)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000490 { /*insert this item at the beginning of the menu */
491 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
Juergen Schmied0bb85b11998-12-25 08:55:15 +0000492 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000493
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000494 }
Juergen Schmied61013241998-10-16 15:40:20 +0000495 TRACE(shell,"--\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000496}
497
498/**************************************************************************
499* ShellView_MergeViewMenu()
500*/
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000501
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000502void ShellView_MergeViewMenu(LPSHELLVIEW this, HMENU32 hSubMenu)
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000503{ MENUITEMINFO32A mii;
504
505 TRACE(shell,"(%p)->(submenu=0x%08x)\n",this,hSubMenu);
506
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000507 if(hSubMenu)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000508 { /*add a separator at the correct position in the menu*/
509 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000510
511 ZeroMemory(&mii, sizeof(mii));
512 mii.cbSize = sizeof(mii);
513 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;
514 mii.fType = MFT_STRING;
515 mii.dwTypeData = "View";
516 mii.hSubMenu = LoadMenuIndirect32A(&_Resource_Men_MENU_001_0_data);
517 InsertMenuItem32A(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000518 }
519}
520/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000521* ShellView_UpdateMenu()
522*/
523LRESULT ShellView_UpdateMenu(LPSHELLVIEW this, HMENU32 hMenu)
Juergen Schmied61013241998-10-16 15:40:20 +0000524{ TRACE(shell,"(%p)->(menu=0x%08x)\n",this,hMenu);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000525 CheckMenuItem32(hMenu, IDM_VIEW_FILES, MF_BYCOMMAND | (g_bViewKeys ? MF_CHECKED: MF_UNCHECKED));
526
527 if(ShellView_CanDoIDockingWindow(this))
528 { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED);
529 CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED));
530 }
531 else
532 { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
533 CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED);
534 }
Juergen Schmied61013241998-10-16 15:40:20 +0000535 return S_OK;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000536}
537
538/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000539* ShellView_OnDeactivate()
540*
541* NOTES
542* internal
543*/
544void ShellView_OnDeactivate(LPSHELLVIEW this)
545{ TRACE(shell,"%p\n",this);
546 if(this->uState != SVUIA_DEACTIVATE)
547 { if(this->hMenu)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000548 { IShellBrowser_SetMenuSB(this->pShellBrowser,0, 0, 0);
549 IShellBrowser_RemoveMenusSB(this->pShellBrowser,this->hMenu);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000550 DestroyMenu32(this->hMenu);
551 this->hMenu = 0;
552 }
553
554 this->uState = SVUIA_DEACTIVATE;
555 }
556}
557
558/**************************************************************************
Juergen Schmied61013241998-10-16 15:40:20 +0000559* ShellView_OnActivate()
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000560*/
561LRESULT ShellView_OnActivate(LPSHELLVIEW this, UINT32 uState)
562{ OLEMENUGROUPWIDTHS32 omw = { {0, 0, 0, 0, 0, 0} };
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000563 MENUITEMINFO32A mii;
564 CHAR szText[MAX_PATH];
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000565
566 TRACE(shell,"%p uState=%x\n",this,uState);
567
Marcus Meissner73458b01998-12-26 12:54:29 +0000568 /*don't do anything if the state isn't really changing */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000569 if(this->uState == uState)
570 { return S_OK;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000571 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000572
573 ShellView_OnDeactivate(this);
574
Marcus Meissner73458b01998-12-26 12:54:29 +0000575 /*only do this if we are active */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000576 if(uState != SVUIA_DEACTIVATE)
Marcus Meissner73458b01998-12-26 12:54:29 +0000577 { /*merge the menus */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000578 this->hMenu = CreateMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000579
580 if(this->hMenu)
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000581 { IShellBrowser_InsertMenusSB(this->pShellBrowser, this->hMenu, &omw);
Juergen Schmied61013241998-10-16 15:40:20 +0000582 TRACE(shell,"-- after fnInsertMenusSB\n");
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000583 /*build the top level menu get the menu item's text*/
584 strcpy(szText,"dummy 31");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000585
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000586 ZeroMemory(&mii, sizeof(mii));
587 mii.cbSize = sizeof(mii);
588 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;
589 mii.fType = MFT_STRING;
590 mii.fState = MFS_ENABLED;
591 mii.dwTypeData = szText;
592 mii.hSubMenu = ShellView_BuildFileMenu(this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000593
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000594 /*insert our menu into the menu bar*/
595 if(mii.hSubMenu)
596 { InsertMenuItem32A(this->hMenu, FCIDM_MENU_HELP, FALSE, &mii);
597 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000598
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000599 /*get the view menu so we can merge with it*/
600 ZeroMemory(&mii, sizeof(mii));
601 mii.cbSize = sizeof(mii);
602 mii.fMask = MIIM_SUBMENU;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000603
604 if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))
605 { ShellView_MergeViewMenu(this, mii.hSubMenu);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000606 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000607
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000608 /*add the items that should only be added if we have the focus*/
609 if(SVUIA_ACTIVATE_FOCUS == uState)
Marcus Meissner73458b01998-12-26 12:54:29 +0000610 { /*get the file menu so we can merge with it */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000611 ZeroMemory(&mii, sizeof(mii));
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000612 mii.cbSize = sizeof(mii);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000613 mii.fMask = MIIM_SUBMENU;
614
615 if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_FILE, FALSE, &mii))
616 { ShellView_MergeFileMenu(this, mii.hSubMenu);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000617 }
618 }
Juergen Schmied61013241998-10-16 15:40:20 +0000619 TRACE(shell,"-- before fnSetMenuSB\n");
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000620 IShellBrowser_SetMenuSB(this->pShellBrowser, this->hMenu, 0, this->hWnd);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000621 }
622 }
623 this->uState = uState;
Juergen Schmied61013241998-10-16 15:40:20 +0000624 TRACE(shell,"--\n");
625 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000626}
627
628/**************************************************************************
629* ShellView_OnSetFocus()
630*
631* NOTES
632* internal
633*/
634LRESULT ShellView_OnSetFocus(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000635{ TRACE(shell,"%p\n",this);
636 /* Tell the browser one of our windows has received the focus. This should always
637 be done before merging menus (OnActivate merges the menus) if one of our
638 windows has the focus.*/
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000639 IShellBrowser_OnViewWindowActive(this->pShellBrowser,this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000640 ShellView_OnActivate(this, SVUIA_ACTIVATE_FOCUS);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000641
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000642 return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000643}
644
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000645/**************************************************************************
646* ShellView_OnKillFocus()
647*/
648LRESULT ShellView_OnKillFocus(LPSHELLVIEW this)
649{ TRACE(shell,"(%p) stub\n",this);
650 ShellView_OnActivate(this, SVUIA_ACTIVATE_NOFOCUS);
651 return 0;
652}
653
654/**************************************************************************
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000655* ShellView_AddRemoveDockingWindow()
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000656*/
657BOOL32 ShellView_AddRemoveDockingWindow(LPSHELLVIEW this, BOOL32 bAdd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000658{ BOOL32 bReturn = FALSE;
659 HRESULT hr;
660 LPSERVICEPROVIDER pSP;
661 LPDOCKINGWINDOWFRAME pFrame;
662
Juergen Schmied61013241998-10-16 15:40:20 +0000663 WARN(shell,"(%p)->(badd=0x%08x) semi-stub\n",this,bAdd);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000664
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000665 /* get the browser's IServiceProvider */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000666 hr = IShellBrowser_QueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000667 if(SUCCEEDED(hr))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000668 { /*get the IDockingWindowFrame pointer*/
Juergen Schmied6acd0591998-10-11 15:50:14 +0000669 hr = pSP->lpvtbl->fnQueryService(pSP, (REFGUID)&SID_SShellBrowser, (REFIID)&IID_IDockingWindowFrame, (LPVOID*)&pFrame);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000670 if(SUCCEEDED(hr))
671 { if(bAdd)
672 { hr = S_OK;
Juergen Schmied61013241998-10-16 15:40:20 +0000673 FIXME(shell,"no docking implemented\n");
Marcus Meissner73458b01998-12-26 12:54:29 +0000674#if 0
675 if(!this->pDockingWindow)
676 { /* create the toolbar object */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000677 this->pDockingWindow = DockingWindow_Constructor(this, this->hWnd);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000678 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000679
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000680 if(this->pDockingWindow)
Marcus Meissner73458b01998-12-26 12:54:29 +0000681 { /*add the toolbar object */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000682 hr = pFrame->lpvtbl->fnAddToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, TOOLBAR_ID, 0);
683
684 if(SUCCEEDED(hr))
685 { bReturn = TRUE;
686 }
Marcus Meissner73458b01998-12-26 12:54:29 +0000687 }
688#endif
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000689 }
690 else
Juergen Schmied61013241998-10-16 15:40:20 +0000691 { FIXME(shell,"no docking implemented\n");
Marcus Meissner73458b01998-12-26 12:54:29 +0000692#if 0
693 if(this->pDockingWindow)
Juergen Schmied61013241998-10-16 15:40:20 +0000694 { hr = pFrame->lpvtbl->fnRemoveToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, DWFRF_NORMAL);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000695
696 if(SUCCEEDED(hr))
Marcus Meissner73458b01998-12-26 12:54:29 +0000697 { /* RemoveToolbar should release the toolbar object which will cause */
698 /*it to destroy itself. Our toolbar object is no longer valid at */
699 /*this point. */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000700
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000701 this->pDockingWindow = NULL;
702 bReturn = TRUE;
703 }
Marcus Meissner73458b01998-12-26 12:54:29 +0000704 }
705#endif
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000706 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000707 pFrame->lpvtbl->fnRelease(pFrame);
708 }
709 pSP->lpvtbl->fnRelease(pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000710 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000711 return bReturn;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000712}
713
714/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000715* ShellView_CanDoIDockingWindow()
716*/
717BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000718{ BOOL32 bReturn = FALSE;
719 HRESULT hr;
720 LPSERVICEPROVIDER pSP;
721 LPDOCKINGWINDOWFRAME pFrame;
722
723 FIXME(shell,"(%p) stub\n",this);
724
725 /*get the browser's IServiceProvider*/
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000726 hr = IShellBrowser_QueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000727 if(hr==S_OK)
Juergen Schmied6acd0591998-10-11 15:50:14 +0000728 { hr = pSP->lpvtbl->fnQueryService(pSP, (REFGUID)&SID_SShellBrowser, (REFIID)&IID_IDockingWindowFrame, (LPVOID*)&pFrame);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000729 if(SUCCEEDED(hr))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000730 { bReturn = TRUE;
731 pFrame->lpvtbl->fnRelease(pFrame);
732 }
733 pSP->lpvtbl->fnRelease(pSP);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000734 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000735 return bReturn;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000736}
737
738/**************************************************************************
739* ShellView_UpdateShellSettings()
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000740*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000741void ShellView_UpdateShellSettings(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000742{ FIXME(shell,"(%p) stub\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000743 return ;
744/*
745 SHELLFLAGSTATE sfs;
746 HINSTANCE hinstShell32;
747*/
748 /* Since SHGetSettings is not implemented in all versions of the shell, get the
749 function address manually at run time. This allows the code to run on all
750 platforms.*/
751/*
752 ZeroMemory(&sfs, sizeof(sfs));
753*/
754 /* The default, in case any of the following steps fails, is classic Windows 95
755 style.*/
756/*
757 sfs.fWin95Classic = TRUE;
758
Juergen Schmied0bb85b11998-12-25 08:55:15 +0000759 hinstShell32 = LoadLibrary("shell32.dll");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000760 if(hinstShell32)
761 { PFNSHGETSETTINGSPROC pfnSHGetSettings;
762
763 pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(hinstShell32, "SHGetSettings");
764 if(pfnSHGetSettings)
765 { (*pfnSHGetSettings)(&sfs, SSF_DOUBLECLICKINWEBVIEW | SSF_WIN95CLASSIC);
766 }
767 FreeLibrary(hinstShell32);
768 }
769
770 DWORD dwExStyles = 0;
771
772 if(!sfs.fWin95Classic && !sfs.fDoubleClickInWebView)
773 dwExStyles |= LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT;
774
775 ListView_SetExtendedListViewStyle(this->hWndList, dwExStyles);
776*/
777}
778
779/**************************************************************************
780* ShellView_OnSettingChange()
781*/
782LRESULT ShellView_OnSettingChange(LPSHELLVIEW this, LPCSTR lpszSection)
783{ TRACE(shell,"(%p) stub\n",this);
Marcus Meissner73458b01998-12-26 12:54:29 +0000784/*if(0 == lstrcmpi(lpszSection, "ShellState"))*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000785 { ShellView_UpdateShellSettings(this);
786 return 0;
787 }
788 return 0;
789}
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000790/**************************************************************************
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000791* ShellView_OnCommand()
792*/
793LRESULT ShellView_OnCommand(LPSHELLVIEW this,DWORD dwCmdID, DWORD dwCmd, HWND32 hwndCmd)
794{ TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",this, dwCmdID, dwCmd, hwndCmd);
795 switch(dwCmdID)
796 { case IDM_VIEW_FILES:
797 g_bViewKeys = ! g_bViewKeys;
798 IShellView_Refresh(this);
799 break;
800
801 case IDM_VIEW_IDW:
802 g_bShowIDW = ! g_bShowIDW;
803 ShellView_AddRemoveDockingWindow(this, g_bShowIDW);
804 break;
805
806 case IDM_MYFILEITEM:
807 MessageBeep32(MB_OK);
808 break;
809
810 case FCIDM_SHVIEW_SMALLICON:
811 this->FolderSettings.ViewMode = FVM_SMALLICON;
812 SetStyle (this, LVS_SMALLICON, LVS_TYPEMASK);
813 break;
814
815 case FCIDM_SHVIEW_BIGICON:
816 this->FolderSettings.ViewMode = FVM_ICON;
817 SetStyle (this, LVS_ICON, LVS_TYPEMASK);
818 break;
819
820 case FCIDM_SHVIEW_LISTVIEW:
821 this->FolderSettings.ViewMode = FVM_LIST;
822 SetStyle (this, LVS_LIST, LVS_TYPEMASK);
823 break;
824
825 case FCIDM_SHVIEW_REPORTVIEW:
826 this->FolderSettings.ViewMode = FVM_DETAILS;
827 SetStyle (this, LVS_REPORT, LVS_TYPEMASK);
828 break;
829
830 default:
831 FIXME(shell,"-- COMMAND unhandled\n");
832 }
833 return 0;
834}
835
836/**************************************************************************
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000837* ShellView_GetSelections()
838*
839* RETURNS
840* number of selected items
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000841*/
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000842UINT32 ShellView_GetSelections(LPSHELLVIEW this)
843{ LVITEM32A lvItem;
844 UINT32 i;
845
Juergen Schmied6acd0591998-10-11 15:50:14 +0000846 this->uSelected = ListView_GetSelectedCount(this->hWndList);
847 this->aSelectedItems = (LPITEMIDLIST*)SHAlloc(this->uSelected * sizeof(LPITEMIDLIST));
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000848
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000849 TRACE(shell,"selected=%i\n", this->uSelected);
850
Juergen Schmied6acd0591998-10-11 15:50:14 +0000851 if(this->aSelectedItems)
852 { TRACE(shell,"-- Items selected =%u\n", this->uSelected);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000853 ZeroMemory(&lvItem, sizeof(lvItem));
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000854 lvItem.mask = LVIF_STATE | LVIF_PARAM;
855 lvItem.stateMask = LVIS_SELECTED;
856 lvItem.iItem = 0;
857
858 i = 0;
859
Juergen Schmied6acd0591998-10-11 15:50:14 +0000860 while(ListView_GetItem32A(this->hWndList, &lvItem) && (i < this->uSelected))
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000861 { if(lvItem.state & LVIS_SELECTED)
Juergen Schmied6acd0591998-10-11 15:50:14 +0000862 { this->aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000863 i++;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000864 TRACE(shell,"-- selected Item found\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000865 }
866 lvItem.iItem++;
867 }
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000868 }
869 return this->uSelected;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000870
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000871}
872/**************************************************************************
873* ShellView_DoContextMenu()
874*/
875void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault)
876{ UINT32 uCommand;
877 DWORD wFlags;
878 HMENU32 hMenu;
879 BOOL32 fExplore = FALSE;
880 HWND32 hwndTree = 0;
881 INT32 nMenuIndex;
882 MENUITEMINFO32A mii;
883 LPCONTEXTMENU pContextMenu = NULL;
884 CMINVOKECOMMANDINFO32 cmi;
885
886 TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault);
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000887
Juergen Schmiedcf5faa61998-11-15 13:27:16 +0000888 /* look, what's selected and create a context menu object of it*/
Juergen Schmiede8d281d1998-10-24 09:22:57 +0000889 if(ShellView_GetSelections(this))
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000890 { this->pSFParent->lpvtbl->fnGetUIObjectOf( this->pSFParent, this->hWndParent, this->uSelected,
891 this->aSelectedItems, (REFIID)&IID_IContextMenu,
892 NULL, (LPVOID *)&pContextMenu);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000893
894 if(pContextMenu)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000895 { TRACE(shell,"-- pContextMenu\n");
896 hMenu = CreatePopupMenu32();
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000897
Juergen Schmied47a80041998-11-22 18:29:50 +0000898 if( hMenu )
899 { /* See if we are in Explore or Open mode. If the browser's tree
900 is present, then we are in Explore mode.*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000901
Juergen Schmied47a80041998-11-22 18:29:50 +0000902 if(SUCCEEDED(IShellBrowser_GetControlWindow(this->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)
903 { TRACE(shell,"-- explore mode\n");
904 fExplore = TRUE;
905 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000906
Juergen Schmied47a80041998-11-22 18:29:50 +0000907 wFlags = CMF_NORMAL | (this->uSelected != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000908
Juergen Schmied47a80041998-11-22 18:29:50 +0000909 if (SUCCEEDED(pContextMenu->lpvtbl->fnQueryContextMenu( pContextMenu, hMenu, 0, MENU_OFFSET, MENU_MAX, wFlags )))
910 { if( fDefault )
911 { TRACE(shell,"-- get menu default command\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000912
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000913 uCommand = nMenuIndex = 0;
Juergen Schmied47a80041998-11-22 18:29:50 +0000914 ZeroMemory(&mii, sizeof(mii));
915 mii.cbSize = sizeof(mii);
916 mii.fMask = MIIM_STATE | MIIM_ID;
917
918 while(GetMenuItemInfo32A(hMenu, nMenuIndex, TRUE, &mii)) /*find the default item in the menu*/
919 { if(mii.fState & MFS_DEFAULT)
920 { uCommand = mii.wID;
921 break;
922 }
923 nMenuIndex++;
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000924 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000925 }
Juergen Schmied47a80041998-11-22 18:29:50 +0000926 else
927 { TRACE(shell,"-- track popup\n");
928 uCommand = TrackPopupMenu32( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL);
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000929 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000930
Juergen Schmied47a80041998-11-22 18:29:50 +0000931 if(uCommand > 0)
932 { TRACE(shell,"-- uCommand=%u\n", uCommand);
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000933 if (IsInCommDlg(this) && (((uCommand-MENU_OFFSET)==IDM_EXPLORE) || ((uCommand-MENU_OFFSET)==IDM_OPEN)))
934 { TRACE(shell,"-- dlg: OnDefaultCommand\n");
935 OnDefaultCommand(this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000936 }
Juergen Schmied47a80041998-11-22 18:29:50 +0000937 else
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000938 { TRACE(shell,"-- explore -- invoke command\n");
939 ZeroMemory(&cmi, sizeof(cmi));
940 cmi.cbSize = sizeof(cmi);
941 cmi.hwnd = this->hWndParent;
942 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE32A(uCommand - MENU_OFFSET);
943 pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000944 }
Juergen Schmied47a80041998-11-22 18:29:50 +0000945 }
946 DestroyMenu32(hMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000947 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000948 }
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000949 if (pContextMenu)
950 pContextMenu->lpvtbl->fnRelease(pContextMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000951 }
Juergen Schmied6acd0591998-10-11 15:50:14 +0000952 SHFree(this->aSelectedItems);
953 this->aSelectedItems=NULL;
954 this->uSelected=0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000955 }
Juergen Schmiedbaae7c41998-12-11 11:06:50 +0000956 else /* background context menu */
957 { hMenu = LoadMenuIndirect32A(&_Resource_Men_MENU_002_0_data);
958 uCommand = TrackPopupMenu32( GetSubMenu32(hMenu,0),TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL);
959 ShellView_OnCommand(this, uCommand, 0,0);
960 DestroyMenu32(hMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000961 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000962}
963
964/**************************************************************************
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000965* ShellView_OnNotify()
966*/
967
968LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh)
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000969{ NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh;
970 NMLVDISPINFO32A *lpdi = (NMLVDISPINFO32A *)lpnmh;
971 LPITEMIDLIST pidl;
972 DWORD dwCursor;
973 STRRET str;
974 UINT32 uFlags;
975 IExtractIcon *pei;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000976
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000977 TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",this,CtlID,lpnmh->code);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000978
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000979 switch(lpnmh->code)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000980 { case NM_SETFOCUS:
981 TRACE(shell,"-- NM_SETFOCUS %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000982 ShellView_OnSetFocus(this);
983 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000984
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000985 case NM_KILLFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000986 TRACE(shell,"-- NM_KILLFOCUS %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000987 ShellView_OnDeactivate(this);
988 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000989
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000990 case HDN_ENDTRACK32A:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000991 TRACE(shell,"-- HDN_ENDTRACK32A %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000992 /*nColumn1 = ListView_GetColumnWidth(this->hWndList, 0);
993 nColumn2 = ListView_GetColumnWidth(this->hWndList, 1);*/
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000994 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +0000995
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000996 case LVN_DELETEITEM:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000997 TRACE(shell,"-- LVN_DELETEITEM %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +0000998 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/
999 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001000
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001001 case NM_DBLCLK:
1002 case NM_RETURN:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001003 TRACE(shell,"-- NM_RETURN|NM_DBLCLK ignored, waiting for LVN_ITEMACTIVATE\n");
1004 break;
1005
1006 case LVN_ITEMACTIVATE:
1007 TRACE(shell,"-- LVN_ITEMACTIVATE %p\n",this);
Juergen Schmied47a80041998-11-22 18:29:50 +00001008 OnStateChange(this, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001009 ShellView_DoContextMenu(this, 0, 0, TRUE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001010 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001011
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001012 case NM_RCLICK:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001013 TRACE(shell,"-- NM_RCLICK %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001014 dwCursor = GetMessagePos();
1015 ShellView_DoContextMenu(this, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001016 break;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001017
1018 case LVN_GETDISPINFO32A:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001019 TRACE(shell,"-- LVN_GETDISPINFO32A %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001020 pidl = (LPITEMIDLIST)lpdi->item.lParam;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001021
1022
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001023 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/
1024 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
1025 { if(_ILIsValue(pidl)) /*is this a value or a folder?*/
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001026 { switch (lpdi->item.iSubItem)
Juergen Schmiedbcd05e91998-11-25 16:47:05 +00001027 { case 1: /* size */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001028 _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1029 break;
Juergen Schmiedbcd05e91998-11-25 16:47:05 +00001030 case 2: /* extension */
Juergen Schmied47a80041998-11-22 18:29:50 +00001031 { char sTemp[64];
Juergen Schmiedbcd05e91998-11-25 16:47:05 +00001032 if (_ILGetExtension (pidl, sTemp, 64))
1033 { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64)
1034 && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax )))
1035 { strncpy (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax);
1036 strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax);
1037 }
1038 }
1039 else /* no extension found */
1040 { lpdi->item.pszText[0]=0x00;
1041 }
Juergen Schmied47a80041998-11-22 18:29:50 +00001042 }
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001043 break;
Juergen Schmiedbcd05e91998-11-25 16:47:05 +00001044 case 3: /* date */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001045 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1046 break;
1047 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001048 }
1049 else /*its a folder*/
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001050 { switch (lpdi->item.iSubItem)
1051 { case 1:
Juergen Schmied47a80041998-11-22 18:29:50 +00001052 strcpy(lpdi->item.pszText, "");
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001053 break;
1054 case 2:
1055 strncpy (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax);
1056 break;
1057 case 3:
1058 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax);
1059 break;
1060 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001061 }
Juergen Schmied47a80041998-11-22 18:29:50 +00001062 TRACE(shell,"-- text=%s\n",lpdi->item.pszText);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001063 }
1064 }
1065 else /*the item text is being requested*/
1066 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/
1067 { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetDisplayNameOf(this->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)))
1068 { if(STRRET_WSTR == str.uType)
1069 { WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax);
1070 SHFree(str.u.pOleStr);
1071 }
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001072 else if(STRRET_CSTRA == str.uType)
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001073 { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax);
1074 }
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001075 else
1076 { FIXME(shell,"type wrong\n");
1077 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001078 }
Juergen Schmied47a80041998-11-22 18:29:50 +00001079 TRACE(shell,"-- text=%s\n",lpdi->item.pszText);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001080 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001081
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001082 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/
1083 { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent,this->hWnd,1,
1084 (LPCITEMIDLIST*)&pidl, (REFIID)&IID_IExtractIcon, NULL, (LPVOID*)&pei)))
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001085 { pei->lpvtbl->fnGetIconLocation(pei, GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001086 pei->lpvtbl->fnRelease(pei);
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001087 TRACE(shell,"-- image=%x\n",lpdi->item.iImage);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001088 }
1089 }
1090 }
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001091 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001092
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001093 case NM_CLICK:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001094 WARN(shell,"-- NM_CLICK %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001095 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001096
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001097 case LVN_ITEMCHANGING:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001098 WARN(shell,"-- LVN_ITEMCHANGING %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001099 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001100
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001101 case LVN_ITEMCHANGED:
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001102 TRACE(shell,"-- LVN_ITEMCHANGED %p\n",this);
1103 ShellView_GetSelections(this);
1104 OnStateChange(this, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001105 break;
1106
1107 case LVN_DELETEALLITEMS:
1108 WARN(shell,"-- LVN_DELETEALLITEMS %p\n",this);
1109 break;
1110
1111 case LVN_INSERTITEM:
1112 WARN(shell,"-- LVN_INSERTITEM %p\n",this);
1113 break;
1114
1115 case LVN_BEGINDRAG:
1116 WARN(shell,"-- LVN_BEGINDRAG %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001117 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001118
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001119 case NM_CUSTOMDRAW:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001120 WARN(shell,"NM_CUSTOMDRAW %p\n",this);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001121 break;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001122
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001123 default:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001124 FIXME (shell,"-- WM_NOTIFY unhandled\n");
1125 break;;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001126 }
1127 return 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001128}
1129
1130/**************************************************************************
1131* ShellView_WndProc
1132*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001133
1134LRESULT CALLBACK ShellView_WndProc(HWND32 hWnd, UINT32 uMessage, WPARAM32 wParam, LPARAM lParam)
1135{ LPSHELLVIEW pThis = (LPSHELLVIEW)GetWindowLong32A(hWnd, GWL_USERDATA);
1136 LPCREATESTRUCT32A lpcs;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001137 DWORD dwCursor;
1138
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001139 TRACE(shell,"(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001140
1141 switch (uMessage)
1142 { case WM_NCCREATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001143 { TRACE(shell,"-- WM_NCCREATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001144 lpcs = (LPCREATESTRUCT32A)lParam;
1145 pThis = (LPSHELLVIEW)(lpcs->lpCreateParams);
1146 SetWindowLong32A(hWnd, GWL_USERDATA, (LONG)pThis);
1147 pThis->hWnd = hWnd; /*set the window handle*/
1148 }
1149 break;
1150
1151 case WM_SIZE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001152 TRACE(shell,"-- WM_SIZE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001153 return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));
1154
1155 case WM_SETFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001156 TRACE(shell,"-- WM_SETFOCUS\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001157 return ShellView_OnSetFocus(pThis);
1158
1159 case WM_KILLFOCUS:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001160 TRACE(shell,"-- WM_KILLFOCUS\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001161 return ShellView_OnKillFocus(pThis);
1162
1163 case WM_CREATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001164 TRACE(shell,"-- WM_CREATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001165 return ShellView_OnCreate(pThis);
1166
1167 case WM_SHOWWINDOW:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001168 TRACE(shell,"-- WM_SHOWWINDOW\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001169 UpdateWindow32(pThis->hWndList);
1170 break;
1171
1172 case WM_ACTIVATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001173 TRACE(shell,"-- WM_ACTIVATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001174 return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);
1175
1176 case WM_COMMAND:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001177 TRACE(shell,"-- WM_COMMAND\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001178 return ShellView_OnCommand(pThis, GET_WM_COMMAND_ID(wParam, lParam),
1179 GET_WM_COMMAND_CMD(wParam, lParam),
1180 GET_WM_COMMAND_HWND(wParam, lParam));
1181
1182 case WM_INITMENUPOPUP:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001183 TRACE(shell,"-- WM_INITMENUPOPUP\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001184 return ShellView_UpdateMenu(pThis, (HMENU32)wParam);
1185
1186 case WM_NOTIFY:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001187 TRACE(shell,"-- WM_NOTIFY\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001188 return ShellView_OnNotify(pThis,(UINT32)wParam, (LPNMHDR)lParam);
1189
1190 case WM_SETTINGCHANGE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001191 TRACE(shell,"-- WM_SETTINGCHANGE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001192 return ShellView_OnSettingChange(pThis,(LPCSTR)lParam);
1193
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001194 case WM_PARENTNOTIFY:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001195 TRACE(shell,"-- WM_PARENTNOTIFY\n");
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001196 if ( LOWORD(wParam) == WM_RBUTTONDOWN ) /* fixme: should not be handled here*/
1197 { dwCursor = GetMessagePos();
1198 ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE);
1199 return TRUE;
1200 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001201 break;
1202
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001203/* -------------*/
1204 case WM_MOVE:
1205 WARN(shell,"-- WM_MOVE\n");
1206 break;
1207
1208 case WM_ACTIVATEAPP:
1209 WARN(shell,"-- WM_ACTIVATEAPP\n");
1210 break;
1211
1212 case WM_NOTIFYFORMAT:
1213 WARN(shell,"-- WM_NOTIFYFORMAT\n");
1214 break;
1215
1216 case WM_NCPAINT:
1217 WARN(shell,"-- WM_NCPAINT\n");
1218 break;
1219
1220 case WM_ERASEBKGND:
1221 WARN(shell,"-- WM_ERASEBKGND\n");
1222 break;
1223
1224 case WM_PAINT:
1225 WARN(shell,"-- WM_PAINT\n");
1226 break;
1227
1228 case WM_NCCALCSIZE:
1229 WARN(shell,"-- WM_NCCALCSIZE\n");
1230 break;
1231
1232 case WM_WINDOWPOSCHANGING:
1233 WARN(shell,"-- WM_WINDOWPOSCHANGING\n");
1234 break;
1235
1236 case WM_WINDOWPOSCHANGED:
1237 WARN(shell,"-- WM_WINDOWPOSCHANGED\n");
1238 break;
1239
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001240 case WM_MOUSEACTIVATE:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001241 WARN(shell,"-- WM_MOUSEACTIVATE\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001242 break;
1243
1244 case WM_SETCURSOR:
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001245 WARN(shell,"-- WM_SETCURSOR\n");
1246 break;
1247
1248 case WM_DESTROY:
1249 WARN(shell,"-- WM_DESTROY\n");
1250 break;
1251
1252 case WM_NCDESTROY:
1253 WARN(shell,"-- WM_NCDESTROY\n");
1254 break;
1255
1256 case WM_CONTEXTMENU:
1257 WARN(shell,"-- WM_CONTEXTMENU\n");
1258 break;
1259
1260 case WM_MENUSELECT:
1261 WARN(shell,"-- WM_MENUSELECT\n");
1262 break;
1263
1264 case WM_CAPTURECHANGED:
1265 WARN(shell,"-- WM_CAPTURECHANGED\n");
1266 break;
1267
1268 case WM_CHILDACTIVATE:
1269 WARN(shell,"-- WM_CHILDACTIVATE\n");
1270 break;
1271
1272 case WM_ENTERIDLE:
1273 WARN(shell,"-- WM_ENTERIDLE\n");
1274 break;
1275
1276 default:
1277 FIXME(shell,"-- MESSAGE unhandled\n");
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001278 break;
1279 }
1280 return DefWindowProc32A (hWnd, uMessage, wParam, lParam);
1281}
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001282/**************************************************************************
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001283*
1284*
1285* The INTERFACE of the IShellView object
1286*
1287*
1288***************************************************************************
Juergen Schmied6acd0591998-10-11 15:50:14 +00001289* IShellView_QueryInterface
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001290*/
1291static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW this,REFIID riid, LPVOID *ppvObj)
1292{ char xriid[50];
1293 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1294 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
1295
1296 *ppvObj = NULL;
1297
1298 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
1299 { *ppvObj = this;
1300 }
1301 else if(IsEqualIID(riid, &IID_IShellView)) /*IShellView*/
1302 { *ppvObj = (IShellView*)this;
1303 }
1304
1305 if(*ppvObj)
1306 { (*(LPSHELLVIEW*)ppvObj)->lpvtbl->fnAddRef(this);
1307 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
1308 return S_OK;
1309 }
1310 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
1311 return E_NOINTERFACE;
1312}
1313/**************************************************************************
1314* IShellView::AddRef
1315*/
1316static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW this)
1317{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
1318 return ++(this->ref);
1319}
1320/**************************************************************************
Juergen Schmied6acd0591998-10-11 15:50:14 +00001321* IShellView_Release
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001322*/
1323static ULONG WINAPI IShellView_Release(LPSHELLVIEW this)
1324{ TRACE(shell,"(%p)->()\n",this);
1325 if (!--(this->ref))
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001326 { TRACE(shell," destroying IShellView(%p)\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001327
1328 if(this->pSFParent)
1329 this->pSFParent->lpvtbl->fnRelease(this->pSFParent);
1330
1331 HeapFree(GetProcessHeap(),0,this);
1332 return 0;
1333 }
1334 return this->ref;
1335}
1336/**************************************************************************
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001337* ShellView_GetWindow
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001338*/
1339static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW this,HWND32 * phWnd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001340{ TRACE(shell,"(%p) stub\n",this);
1341 *phWnd = this->hWnd;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001342
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001343 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001344}
1345static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW this,BOOL32 fEnterMode)
1346{ FIXME(shell,"(%p) stub\n",this);
1347 return E_NOTIMPL;
1348}
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001349/**************************************************************************
1350* IShellView_TranslateAccelerator
1351*
1352* FIXME:
1353* use the accel functions
1354*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001355static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW this,LPMSG32 lpmsg)
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001356{ FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",this,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001357
1358
1359 switch (lpmsg->message)
1360 { case WM_KEYDOWN: TRACE(shell,"-- key=0x04%x",lpmsg->wParam) ;
1361 }
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001362 return S_FALSE;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001363}
1364static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW this,BOOL32 fEnable)
1365{ FIXME(shell,"(%p) stub\n",this);
1366 return E_NOTIMPL;
1367}
1368static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW this,UINT32 uState)
1369{ CHAR szName[MAX_PATH];
1370 LRESULT lResult;
Juergen Schmied6acd0591998-10-11 15:50:14 +00001371 int nPartArray[1] = {-1};
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001372
Juergen Schmied6acd0591998-10-11 15:50:14 +00001373 TRACE(shell,"(%p)->(state=%x) stub\n",this, uState);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001374 /*don't do anything if the state isn't really changing*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001375 if(this->uState == uState)
1376 { return S_OK;
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001377 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001378
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001379 /*OnActivate handles the menu merging and internal state*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001380 ShellView_OnActivate(this, uState);
1381
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001382 /*remove the docking window*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001383 if(g_bShowIDW)
1384 { ShellView_AddRemoveDockingWindow(this, FALSE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001385 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001386
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001387 /*only do this if we are active*/
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001388 if(uState != SVUIA_DEACTIVATE)
Marcus Meissner73458b01998-12-26 12:54:29 +00001389 { /*update the status bar */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001390 strcpy(szName, "dummy32");
1391
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001392 this->pSFParent->lpvtbl->fnGetFolderPath( this->pSFParent,
1393 szName + strlen(szName),
1394 sizeof(szName) - strlen(szName));
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001395
1396 /* set the number of parts */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001397 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,
1398 (LPARAM)nPartArray, &lResult);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001399
1400 /* set the text for the parts */
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001401 IShellBrowser_SendControlMsg(this->pShellBrowser, FCW_STATUS, SB_SETTEXT32A,
1402 0, (LPARAM)szName, &lResult);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001403
Marcus Meissner73458b01998-12-26 12:54:29 +00001404 /*add the docking window if necessary */
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001405 if(g_bShowIDW)
1406 { ShellView_AddRemoveDockingWindow(this, TRUE);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001407 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001408 }
1409 return S_OK;
1410}
1411static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001412{ TRACE(shell,"(%p)\n",this);
1413
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001414 ListView_DeleteAllItems(this->hWndList);
1415 ShellView_FillList(this);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001416
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001417 return S_OK;
1418}
1419static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW this, IShellView *lpPrevView,
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001420 LPCFOLDERSETTINGS lpfs, IShellBrowser * psb, RECT32 * prcView, HWND32 *phWnd)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001421{ WNDCLASS32A wc;
Juergen Schmied6acd0591998-10-11 15:50:14 +00001422/* LRESULT dwResult;*/
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001423 *phWnd = 0;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001424
Juergen Schmied6acd0591998-10-11 15:50:14 +00001425
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001426 TRACE(shell,"(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",this, lpPrevView,lpfs, psb, prcView, phWnd);
1427 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);
1428
1429 /*set up the member variables*/
1430 this->pShellBrowser = psb;
1431 this->FolderSettings = *lpfs;
1432
1433 /*get our parent window*/
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001434 IShellBrowser_AddRef(this->pShellBrowser);
1435 IShellBrowser_GetWindow(this->pShellBrowser, &(this->hWndParent));
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001436
1437 /* try to get the ICommDlgBrowserInterface */
1438 this->pCommDlgBrowser=NULL;
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001439 if ( SUCCEEDED (IShellBrowser_QueryInterface( this->pShellBrowser,
Juergen Schmied6acd0591998-10-11 15:50:14 +00001440 (REFIID)&IID_ICommDlgBrowser,
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001441 (LPVOID*) &this->pCommDlgBrowser)))
1442 { TRACE(shell,"-- CommDlgBrowser\n");
1443 }
1444
1445 /*if our window class has not been registered, then do so*/
1446 if(!GetClassInfo32A(shell32_hInstance, SV_CLASS_NAME, &wc))
1447 { ZeroMemory(&wc, sizeof(wc));
1448 wc.style = CS_HREDRAW | CS_VREDRAW;
1449 wc.lpfnWndProc = (WNDPROC32) ShellView_WndProc;
1450 wc.cbClsExtra = 0;
1451 wc.cbWndExtra = 0;
1452 wc.hInstance = shell32_hInstance;
1453 wc.hIcon = 0;
1454 wc.hCursor = LoadCursor32A (0, IDC_ARROW32A);
1455 wc.hbrBackground = (HBRUSH32) (COLOR_WINDOW + 1);
1456 wc.lpszMenuName = NULL;
1457 wc.lpszClassName = SV_CLASS_NAME;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001458
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001459 if(!RegisterClass32A(&wc))
1460 return E_FAIL;
1461 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001462
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001463 *phWnd = CreateWindowEx32A(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001464 prcView->left, prcView->top, prcView->right - prcView->left, prcView->bottom - prcView->top,
1465 this->hWndParent, 0, shell32_hInstance, (LPVOID)this);
1466
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001467 MergeToolBar(this);
1468
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001469 if(!*phWnd)
1470 return E_FAIL;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001471
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001472 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001473}
1474
1475static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW this)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001476{ TRACE(shell,"(%p)\n",this);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001477
1478 /*Make absolutely sure all our UI is cleaned up.*/
1479 IShellView_UIActivate(this, SVUIA_DEACTIVATE);
1480 if(this->hMenu)
1481 { DestroyMenu32(this->hMenu);
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001482 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001483 DestroyWindow32(this->hWnd);
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001484 IShellBrowser_Release(this->pShellBrowser);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001485 return S_OK;
1486}
1487static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW this, LPFOLDERSETTINGS lpfs)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001488{ TRACE(shell,"(%p)->(%p) vmode=%x flags=%x\n",this, lpfs,
1489 this->FolderSettings.ViewMode, this->FolderSettings.fFlags);
1490
1491 if (lpfs)
1492 { *lpfs = this->FolderSettings;
1493 return NOERROR;
1494 }
1495 else
1496 return E_INVALIDARG;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001497}
1498static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW this, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam)
1499{ FIXME(shell,"(%p) stub\n",this);
1500 return E_NOTIMPL;
1501}
1502static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW this)
1503{ FIXME(shell,"(%p) stub\n",this);
1504 return S_OK;
1505}
1506static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW this, LPCITEMIDLIST pidlItem, UINT32 uFlags)
1507{ FIXME(shell,"(%p)->(pidl=%p, 0x%08x) stub\n",this, pidlItem, uFlags);
1508 return E_NOTIMPL;
1509}
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001510static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW this, UINT32 uItem, REFIID riid, LPVOID *ppvOut)
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001511{ LPUNKNOWN pObj = NULL;
Juergen Schmied6acd0591998-10-11 15:50:14 +00001512 char xriid[50];
Juergen Schmied6acd0591998-10-11 15:50:14 +00001513
1514 WINE_StringFromCLSID((LPCLSID)riid,xriid);
1515 TRACE(shell,"(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",this, uItem, xriid, ppvOut);
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001516
Juergen Schmied6acd0591998-10-11 15:50:14 +00001517 *ppvOut = NULL;
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001518 if(IsEqualIID(riid, &IID_IContextMenu))
Juergen Schmiedcf5faa61998-11-15 13:27:16 +00001519 { pObj =(LPUNKNOWN)IContextMenu_Constructor(this->pSFParent,this->aSelectedItems,this->uSelected);
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001520 }
1521 else if (IsEqualIID(riid, &IID_IDataObject))
Juergen Schmied47a80041998-11-22 18:29:50 +00001522 { ShellView_GetSelections(this);
1523 pObj =(LPUNKNOWN)IDataObject_Constructor(this->hWndParent, this->pSFParent,this->aSelectedItems,this->uSelected);
1524 SHFree(this->aSelectedItems);
1525 this->aSelectedItems=NULL;
1526 this->uSelected=0;
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001527 }
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001528
Juergen Schmied6acd0591998-10-11 15:50:14 +00001529 TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
1530
Juergen Schmiede8d281d1998-10-24 09:22:57 +00001531 if(!pObj)
1532 return E_OUTOFMEMORY;
1533 *ppvOut = pObj;
1534 return S_OK;
Alexandre Julliard85ed45e1998-08-22 19:03:56 +00001535}