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