From f8a69bddfb71762be71960016eb7837738f12adb Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Tue, 9 Dec 2014 21:55:56 +0000 Subject: [PATCH] [EXPLORER] * Remove dragdrop.cpp. It was never used. svn path=/trunk/; revision=65598 --- reactos/base/shell/explorer/CMakeLists.txt | 1 - reactos/base/shell/explorer/dragdrop.cpp | 314 --------------------- reactos/base/shell/explorer/precomp.h | 34 --- 3 files changed, 349 deletions(-) delete mode 100644 reactos/base/shell/explorer/dragdrop.cpp diff --git a/reactos/base/shell/explorer/CMakeLists.txt b/reactos/base/shell/explorer/CMakeLists.txt index 5b4ec0836bb..138d90a8fdb 100644 --- a/reactos/base/shell/explorer/CMakeLists.txt +++ b/reactos/base/shell/explorer/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories(${REACTOS_SOURCE_DIR}/lib/atl) list(APPEND SOURCE desktop.cpp - dragdrop.cpp explorer.cpp rshell.cpp settings.cpp diff --git a/reactos/base/shell/explorer/dragdrop.cpp b/reactos/base/shell/explorer/dragdrop.cpp deleted file mode 100644 index d9c21e6f42a..00000000000 --- a/reactos/base/shell/explorer/dragdrop.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - * ReactOS Explorer - * - * Copyright 2006 - 2007 Thomas Weidenmueller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "precomp.h" - -class CDropTarget : - public CComCoClass, - public CComObjectRootEx, - public IDropTarget -{ - HWND hwndTarget; - CComPtr DropTargetHelper; - PVOID Context; - BOOL CanDrop; - DROPTARGET_CALLBACKS Callbacks; - DWORD FormatsCount; - FORMATETC* Formats; - - const FORMATETC * - FindSupportedFormat(IN IDataObject *pDataObject) - { - FORMATETC *Current, *Last; - HRESULT hr; - - /* NOTE: we could use IDataObject::EnumFormatEtc(), - but this appears to be a lot easier! */ - Last = Formats + FormatsCount; - for (Current = Formats; - Current != Last; - Current++) - { - hr = pDataObject->QueryGetData(Current); - if (SUCCEEDED(hr)) - return Current; - } - - return NULL; - } - -public: - CDropTarget() : - hwndTarget(NULL), - Context(NULL), - CanDrop(FALSE), - FormatsCount(0), - Formats(NULL) - { - ZeroMemory(&Callbacks, sizeof(Callbacks)); - } - - virtual ~CDropTarget() { } - - HRESULT Initialize(IN HWND hwndTarget, - IN DWORD nSupportedFormats, - IN const FORMATETC *formats OPTIONAL, - IN PVOID Context OPTIONAL, - IN const DROPTARGET_CALLBACKS *Callbacks OPTIONAL) - { - this->hwndTarget = hwndTarget; - FormatsCount = nSupportedFormats; - if (nSupportedFormats != 0) - { - Formats = new FORMATETC[nSupportedFormats]; - CopyMemory(Formats, - formats, - sizeof(formats[0]) * nSupportedFormats); - } - - this->Context = Context; - if (Callbacks != NULL) - { - CopyMemory(&this->Callbacks, - Callbacks, - sizeof(*Callbacks)); - } - - HRESULT hr = CoCreateInstance(CLSID_DragDropHelper, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IDropTargetHelper, &DropTargetHelper)); - - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE DragEnter( - IN IDataObject *pDataObject, - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect) - { - const FORMATETC *Format; - HRESULT hr; - - if (pDataObject == NULL) - return E_INVALIDARG; - - CanDrop = FALSE; - - hr = DropTargetHelper->DragEnter( - hwndTarget, - pDataObject, - (POINT *) &pt, - *pdwEffect); - - if (SUCCEEDED(hr)) - { - Format = FindSupportedFormat( - pDataObject); - if (Format != NULL) - { - /* We found a format that we support! */ - if (Callbacks.OnDragEnter != NULL) - { - hr = Callbacks.OnDragEnter(this, - Context, - Format, - grfKeyState, - pt, - pdwEffect); - if (SUCCEEDED(hr)) - { - if (hr == S_OK) - CanDrop = TRUE; - else - { - /* Special return value by the callback routine, - doesn't want to allow dragging */ - *pdwEffect = DROPEFFECT_NONE; - } - - hr = S_OK; - } - else - { - *pdwEffect = DROPEFFECT_NONE; - hr = S_OK; - } - } - else - *pdwEffect = DROPEFFECT_NONE; - } - else - *pdwEffect = DROPEFFECT_NONE; - } - - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE DragOver( - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect) - { - HRESULT hr; - - hr = DropTargetHelper->DragOver( - (POINT *) &pt, - *pdwEffect); - - if (SUCCEEDED(hr)) - { - if (CanDrop) - { - if (Callbacks.OnDragOver != NULL) - { - hr = Callbacks.OnDragOver(this, - Context, - grfKeyState, - pt, - pdwEffect); - if (SUCCEEDED(hr)) - { - if (hr != S_OK) - { - /* Special return value by the callback routine, - doesn't want to allow dropping here */ - *pdwEffect = DROPEFFECT_NONE; - } - - hr = S_OK; - } - else - { - *pdwEffect = DROPEFFECT_NONE; - hr = S_OK; - } - } - else - *pdwEffect = DROPEFFECT_NONE; - } - else - *pdwEffect = DROPEFFECT_NONE; - } - - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE DragLeave() - { - HRESULT hr; - - hr = DropTargetHelper->DragLeave(); - if (SUCCEEDED(hr)) - { - if (Callbacks.OnDragLeave != NULL) - { - hr = Callbacks.OnDragLeave(this, - Context); - } - } - - return hr; - } - - virtual HRESULT STDMETHODCALLTYPE Drop( - IN IDataObject *pDataObject, - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect) - { - const FORMATETC *Format; - HRESULT hr; - - if (pDataObject == NULL) - return E_INVALIDARG; - - hr = DropTargetHelper->Drop( - pDataObject, - (POINT *) &pt, - *pdwEffect); - - if (SUCCEEDED(hr) && CanDrop) - { - Format = FindSupportedFormat(pDataObject); - if (Format != NULL) - { - /* We found a format that we support! */ - if (Callbacks.OnDrop != NULL) - { - hr = Callbacks.OnDrop(this, - Context, - Format, - grfKeyState, - pt, - pdwEffect); - if (SUCCEEDED(hr)) - { - if (hr == S_OK) - CanDrop = TRUE; - else - { - /* Special return value by the callback routine, - doesn't want to allow dragging */ - *pdwEffect = DROPEFFECT_NONE; - } - - hr = S_OK; - } - else - { - *pdwEffect = DROPEFFECT_NONE; - hr = S_OK; - } - } - else - *pdwEffect = DROPEFFECT_NONE; - } - else - *pdwEffect = DROPEFFECT_NONE; - } - - return hr; - } - - DECLARE_NOT_AGGREGATABLE(CDropTarget) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - BEGIN_COM_MAP(CDropTarget) - COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) - END_COM_MAP() -}; - -IDropTarget * -CreateDropTarget(IN HWND hwndTarget, - IN DWORD nSupportedFormats, - IN const FORMATETC *Formats OPTIONAL, - IN PVOID Context OPTIONAL, - IN const DROPTARGET_CALLBACKS *Callbacks OPTIONAL) -{ - IDropTarget *dt; - - HRESULT hr = ShellObjectCreatorInit(hwndTarget, nSupportedFormats, Formats, Context, Callbacks, IID_IDropTarget, &dt); - if (FAILED_UNEXPECTEDLY(hr)) - return NULL; - - return dt; -} diff --git a/reactos/base/shell/explorer/precomp.h b/reactos/base/shell/explorer/precomp.h index 4c84118fd70..de88514231b 100644 --- a/reactos/base/shell/explorer/precomp.h +++ b/reactos/base/shell/explorer/precomp.h @@ -52,40 +52,6 @@ extern HINSTANCE hExplorerInstance; extern HANDLE hProcessHeap; extern HKEY hkExplorer; -/* - * dragdrop.c - */ - -typedef struct _DROPTARGET_CALLBACKS -{ - HRESULT(*OnDragEnter)(IN IDropTarget *pDropTarget, - IN PVOID Context, - IN const FORMATETC *Format, - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect); - HRESULT(*OnDragOver)(IN IDropTarget *pDropTarget, - IN PVOID Context, - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect); - HRESULT(*OnDragLeave)(IN IDropTarget *pDropTarget, - IN PVOID Context); - HRESULT(*OnDrop)(IN IDropTarget *pDropTarget, - IN PVOID Context, - IN const FORMATETC *Format, - IN DWORD grfKeyState, - IN POINTL pt, - IN OUT DWORD *pdwEffect); -} DROPTARGET_CALLBACKS, *PDROPTARGET_CALLBACKS; - -IDropTarget * -CreateDropTarget(IN HWND hwndTarget, -IN DWORD nSupportedFormats, -IN const FORMATETC *Formats OPTIONAL, -IN PVOID Context OPTIONAL, -IN const DROPTARGET_CALLBACKS *Callbacks OPTIONAL); - /* * explorer.c */