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