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