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