ReactOS 0.4.15-dev-8390-g075894b
CRecyclerDropTarget Class Reference
Inheritance diagram for CRecyclerDropTarget:
Collaboration diagram for CRecyclerDropTarget:

Classes

struct  DeleteThreadData
 

Public Member Functions

 CRecyclerDropTarget ()
 
STDMETHODIMP DragEnter (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHODIMP DragOver (DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHODIMP DragLeave () override
 
STDMETHODIMP Drop (IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT DragEnter ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragOver ([in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragLeave ()
 
HRESULT Drop ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Static Private Member Functions

static HRESULT _DoDeleteDataObject (IDataObject *pda, DWORD fMask)
 
static DWORD WINAPI _DoDeleteThreadProc (LPVOID lpParameter)
 
static void _DoDeleteAsync (IDataObject *pda, DWORD fMask)
 

Private Attributes

BOOL fAcceptFmt
 
UINT cfShellIDList
 

Additional Inherited Members

- Public Types inherited from IDropTarget
typedef IDropTargetLPDROPTARGET
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IDropTarget
const DWORD MK_ALT = 0x20
 
const DWORD DROPEFFECT_NONE = 0
 
const DWORD DROPEFFECT_COPY = 1
 
const DWORD DROPEFFECT_MOVE = 2
 
const DWORD DROPEFFECT_LINK = 4
 
const DWORD DROPEFFECT_SCROLL = 0x80000000
 
const DWORD DD_DEFSCROLLINSET = 11
 
const DWORD DD_DEFSCROLLDELAY = 50
 
const DWORD DD_DEFSCROLLINTERVAL = 50
 
const DWORD DD_DEFDRAGDELAY = 200
 
const DWORD DD_DEFDRAGMINDIST = 2
 

Detailed Description

Definition at line 27 of file CRecyclerDropTarget.cpp.

Constructor & Destructor Documentation

◆ CRecyclerDropTarget()

CRecyclerDropTarget::CRecyclerDropTarget ( )
inline

Definition at line 105 of file CRecyclerDropTarget.cpp.

106 {
109 }
#define FALSE
Definition: types.h:117
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:550
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)

Member Function Documentation

◆ _DoDeleteAsync()

static void CRecyclerDropTarget::_DoDeleteAsync ( IDataObject pda,
DWORD  fMask 
)
inlinestaticprivate

Definition at line 96 of file CRecyclerDropTarget.cpp.

97 {
98 DeleteThreadData *data = static_cast<DeleteThreadData*>(HeapAlloc(GetProcessHeap(), 0, sizeof(DeleteThreadData)));
99 data->fMask = fMask;
102 }
static DWORD WINAPI _DoDeleteThreadProc(LPVOID lpParameter)
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
Definition: marshal.c:2100
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const GUID IID_IDataObject

Referenced by Drop().

◆ _DoDeleteDataObject()

static HRESULT CRecyclerDropTarget::_DoDeleteDataObject ( IDataObject pda,
DWORD  fMask 
)
inlinestaticprivate

Definition at line 35 of file CRecyclerDropTarget.cpp.

36 {
37 HRESULT hr;
38 STGMEDIUM medium;
39 FORMATETC formatetc;
40 InitFormatEtc (formatetc, CF_HDROP, TYMED_HGLOBAL);
41 hr = pda->GetData(&formatetc, &medium);
43 return hr;
44
45 LPDROPFILES lpdf = (LPDROPFILES) GlobalLock(medium.hGlobal);
46 if (!lpdf)
47 {
48 ERR("Error locking global\n");
49 ReleaseStgMedium(&medium);
50 return E_FAIL;
51 }
52
53 /* Delete them */
54 SHFILEOPSTRUCTW FileOp;
55 ZeroMemory(&FileOp, sizeof(FileOp));
56 FileOp.wFunc = FO_DELETE;
57 FileOp.pFrom = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles);;
58 if ((fMask & CMIC_MASK_SHIFT_DOWN) == 0)
59 FileOp.fFlags = FOF_ALLOWUNDO;
60 TRACE("Deleting file (just the first) = %s, allowundo: %d\n", debugstr_w(FileOp.pFrom), (FileOp.fFlags == FOF_ALLOWUNDO));
61
62 int res = SHFileOperationW(&FileOp);
63 if (res)
64 {
65 ERR("SHFileOperation failed with 0x%x\n", res);
66 hr = E_FAIL;
67 }
68
69 GlobalUnlock(medium.hGlobal);
70 ReleaseStgMedium(&medium);
71
72 return hr;
73 }
#define CF_HDROP
Definition: constants.h:410
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_FAIL
Definition: ddrawi.h:102
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:32
GLuint res
Definition: glext.h:9613
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
#define debugstr_w
Definition: kernel32.h:32
#define FOF_ALLOWUNDO
Definition: shellapi.h:147
#define FO_DELETE
Definition: shellapi.h:138
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1987
HRESULT hr
Definition: shlfolder.c:183
struct _DROPFILES * LPDROPFILES
#define TRACE(s)
Definition: solgame.cpp:4
LPCWSTR pFrom
Definition: shellapi.h:357
FILEOP_FLAGS fFlags
Definition: shellapi.h:359
#define ZeroMemory
Definition: winbase.h:1712
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by _DoDeleteThreadProc().

◆ _DoDeleteThreadProc()

static DWORD WINAPI CRecyclerDropTarget::_DoDeleteThreadProc ( LPVOID  lpParameter)
inlinestaticprivate

Definition at line 80 of file CRecyclerDropTarget.cpp.

81 {
82 DeleteThreadData *data = static_cast<DeleteThreadData*>(lpParameter);
84 IDataObject *pDataObject;
86 if (SUCCEEDED(hr))
87 {
88 _DoDeleteDataObject(pDataObject, data->fMask);
89 }
90 pDataObject->Release();
93 return 0;
94 }
static HRESULT _DoDeleteDataObject(IDataObject *pda, DWORD fMask)
#define HeapFree(x, y, z)
Definition: compat.h:735
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2144
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define IID_PPV_ARG(Itype, ppType)

Referenced by _DoDeleteAsync().

◆ DragEnter()

STDMETHODIMP CRecyclerDropTarget::DragEnter ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inlineoverride

Implements IDropTarget.

Definition at line 112 of file CRecyclerDropTarget.cpp.

113 {
114 TRACE("Recycle bin drag over (%p)\n", this);
115 /* The recycle bin accepts pretty much everything, and sets a CSIDL flag. */
117
118 *pdwEffect = DROPEFFECT_MOVE;
119 return S_OK;
120 }
#define TRUE
Definition: types.h:120
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
#define S_OK
Definition: intsafe.h:52

◆ DragLeave()

STDMETHODIMP CRecyclerDropTarget::DragLeave ( void  )
inlineoverride

Implements IDropTarget.

Definition at line 136 of file CRecyclerDropTarget.cpp.

137 {
138 TRACE("(%p)\n", this);
139
141
142 return S_OK;
143 }

◆ DragOver()

STDMETHODIMP CRecyclerDropTarget::DragOver ( DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inlineoverride

Implements IDropTarget.

Definition at line 123 of file CRecyclerDropTarget.cpp.

124 {
125 TRACE("(%p)\n", this);
126
127 if (!pdwEffect)
128 return E_INVALIDARG;
129
130 *pdwEffect = DROPEFFECT_MOVE;
131
132 return S_OK;
133 }
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ Drop()

STDMETHODIMP CRecyclerDropTarget::Drop ( IDataObject pDataObject,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inlineoverride

Implements IDropTarget.

Definition at line 146 of file CRecyclerDropTarget.cpp.

147 {
148 TRACE("(%p) object dropped on recycle bin, effect %u\n", this, *pdwEffect);
149
150 FORMATETC fmt;
151 TRACE("(%p)->(DataObject=%p)\n", this, pDataObject);
152 InitFormatEtc (fmt, cfShellIDList, TYMED_HGLOBAL);
153
154 /* Handle cfShellIDList Drop objects here, otherwise send the appropriate message to other software */
155 if (SUCCEEDED(pDataObject->QueryGetData(&fmt)))
156 {
157 DWORD fMask = 0;
158
159 if ((grfKeyState & MK_SHIFT) == MK_SHIFT)
160 fMask |= CMIC_MASK_SHIFT_DOWN;
161
162 _DoDeleteAsync(pDataObject, fMask);
163 }
164 else
165 {
166 /*
167 * TODO call SetData on the data object with format CFSTR_TARGETCLSID
168 * set to the Recycle Bin's class identifier CLSID_RecycleBin.
169 */
170 }
171 return S_OK;
172 }
static void _DoDeleteAsync(IDataObject *pda, DWORD fMask)
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
Definition: dsound.c:943
#define MK_SHIFT
Definition: winuser.h:2369

Member Data Documentation

◆ cfShellIDList

UINT CRecyclerDropTarget::cfShellIDList
private

Definition at line 33 of file CRecyclerDropTarget.cpp.

Referenced by CRecyclerDropTarget(), and Drop().

◆ fAcceptFmt

BOOL CRecyclerDropTarget::fAcceptFmt
private

Definition at line 32 of file CRecyclerDropTarget.cpp.

Referenced by CRecyclerDropTarget(), DragEnter(), and DragLeave().


The documentation for this class was generated from the following file: