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