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