2016-08-12 11:35:24 +00:00
|
|
|
/*
|
|
|
|
* file system folder drop target
|
|
|
|
*
|
|
|
|
* Copyright 1997 Marcus Meissner
|
|
|
|
* Copyright 1998, 1999, 2002 Juergen Schmied
|
|
|
|
* Copyright 2009 Andrew Hill
|
|
|
|
*
|
|
|
|
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CFSDROPTARGET_H_
|
|
|
|
#define _CFSDROPTARGET_H_
|
|
|
|
|
|
|
|
class CFSDropTarget :
|
|
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
2018-02-16 18:33:44 +00:00
|
|
|
public IDropTarget,
|
|
|
|
public IObjectWithSite
|
2016-08-12 11:35:24 +00:00
|
|
|
{
|
|
|
|
private:
|
2018-02-17 20:01:04 +00:00
|
|
|
UINT m_cfShellIDList; /* clipboardformat for IDropTarget */
|
|
|
|
BOOL m_fAcceptFmt; /* flag for pending Drop */
|
|
|
|
LPWSTR m_sPathTarget;
|
2018-02-16 18:33:44 +00:00
|
|
|
HWND m_hwndSite;
|
|
|
|
DWORD m_grfKeyState;
|
2018-02-17 11:59:51 +00:00
|
|
|
DWORD m_dwDefaultEffect;
|
2018-02-16 18:33:44 +00:00
|
|
|
CComPtr<IUnknown> m_site;
|
2016-08-12 11:35:24 +00:00
|
|
|
|
2018-02-17 20:01:04 +00:00
|
|
|
BOOL _QueryDrop (DWORD dwKeyState, LPDWORD pdwEffect);
|
|
|
|
HRESULT _DoDrop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
HRESULT _CopyItems(IShellFolder *pSFFrom, UINT cidl, LPCITEMIDLIST *apidl, BOOL bCopy);
|
|
|
|
BOOL _GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut);
|
2016-08-12 11:35:24 +00:00
|
|
|
static DWORD WINAPI _DoDropThreadProc(LPVOID lpParameter);
|
2018-02-17 11:59:51 +00:00
|
|
|
HRESULT _GetEffectFromMenu(IDataObject *pDataObject, POINTL pt, DWORD *pdwEffect, DWORD dwAvailableEffects);
|
2018-02-16 18:33:44 +00:00
|
|
|
HRESULT _RepositionItems(IShellFolderView *psfv, IDataObject *pDataObject, POINTL pt);
|
2016-08-12 11:35:24 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CFSDropTarget();
|
|
|
|
~CFSDropTarget();
|
2018-02-17 20:01:04 +00:00
|
|
|
HRESULT Initialize(LPWSTR PathTarget);
|
2016-08-12 11:35:24 +00:00
|
|
|
|
|
|
|
// IDropTarget
|
|
|
|
virtual HRESULT WINAPI DragEnter(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
virtual HRESULT WINAPI DragOver(DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
virtual HRESULT WINAPI DragLeave();
|
|
|
|
virtual HRESULT WINAPI Drop(IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect);
|
|
|
|
|
2018-02-16 18:33:44 +00:00
|
|
|
// IObjectWithSite
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
|
|
|
|
|
2016-08-12 11:35:24 +00:00
|
|
|
DECLARE_NOT_AGGREGATABLE(CFSDropTarget)
|
|
|
|
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CFSDropTarget)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
|
2018-02-16 18:33:44 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
2016-08-12 11:35:24 +00:00
|
|
|
END_COM_MAP()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _DoDropData {
|
|
|
|
CFSDropTarget *This;
|
|
|
|
IStream *pStream;
|
|
|
|
DWORD dwKeyState;
|
|
|
|
POINTL pt;
|
|
|
|
DWORD pdwEffect;
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID * ppvOut);
|
|
|
|
|
|
|
|
#endif /* _CFSFOLDER_H_ */
|