ReactOS  0.4.15-dev-1070-ge1a01de
CRecyclerDropTarget Class Reference
Inheritance diagram for CRecyclerDropTarget:
Collaboration diagram for CRecyclerDropTarget:

Classes

struct  DeleteThreadData
 

Public Member Functions

 CRecyclerDropTarget ()
 
HRESULT WINAPI DragEnter (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
HRESULT WINAPI DragOver (DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
HRESULT WINAPI DragLeave ()
 
HRESULT WINAPI Drop (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect)
 
- 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 ()
 
- 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 104 of file CRecyclerDropTarget.cpp.

105  {
106  fAcceptFmt = FALSE;
108  }
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:477
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define FALSE
Definition: types.h:117

Member Function Documentation

◆ _DoDeleteAsync()

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

Definition at line 94 of file CRecyclerDropTarget.cpp.

95  {
96  DeleteThreadData *data = static_cast<DeleteThreadData*>(HeapAlloc(GetProcessHeap(), 0, sizeof(DeleteThreadData)));
97  data->fMask = fMask;
100  }
const GUID IID_IDataObject
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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
static DWORD WINAPI _DoDeleteThreadProc(LPVOID lpParameter)

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  return E_FAIL;
50  }
51 
52  /* Delete them */
53  SHFILEOPSTRUCTW FileOp;
54  ZeroMemory(&FileOp, sizeof(FileOp));
55  FileOp.wFunc = FO_DELETE;
56  FileOp.pFrom = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles);;
57  if ((fMask & CMIC_MASK_SHIFT_DOWN) == 0)
58  FileOp.fFlags = FOF_ALLOWUNDO;
59  TRACE("Deleting file (just the first) = %s, allowundo: %d\n", debugstr_w(FileOp.pFrom), (FileOp.fFlags == FOF_ALLOWUNDO));
60 
61  int res = SHFileOperationW(&FileOp);
62  if (res)
63  {
64  ERR("SHFileOperation failed with 0x%x\n", res);
65  hr = E_FAIL;
66  }
67 
68  ReleaseStgMedium(&medium);
69 
70  return hr;
71  }
struct _DROPFILES * LPDROPFILES
HRESULT hr
Definition: shlfolder.c:183
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:32
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define FOF_ALLOWUNDO
Definition: shellapi.h:144
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
#define ZeroMemory
Definition: winbase.h:1648
FILEOP_FLAGS fFlags
Definition: shellapi.h:357
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:1918
#define debugstr_w
Definition: kernel32.h:32
#define CF_HDROP
Definition: constants.h:410
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LPCWSTR pFrom
Definition: shellapi.h:355
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define ERR(fmt,...)
Definition: debug.h:110
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define FO_DELETE
Definition: shellapi.h:135

Referenced by _DoDeleteThreadProc().

◆ _DoDeleteThreadProc()

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

Definition at line 78 of file CRecyclerDropTarget.cpp.

79  {
80  DeleteThreadData *data = static_cast<DeleteThreadData*>(lpParameter);
82  IDataObject *pDataObject;
84  if (SUCCEEDED(hr))
85  {
86  _DoDeleteDataObject(pDataObject, data->fMask);
87  }
88  pDataObject->Release();
91  return 0;
92  }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2144
#define IID_PPV_ARG(Itype, ppType)
ULONG Release()
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
LONG HRESULT
Definition: typedefs.h:79
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID lpParameter
Definition: kernel32.h:241
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
#define HeapFree(x, y, z)
Definition: compat.h:483
#define SUCCEEDED(hr)
Definition: intsafe.h:49
static HRESULT _DoDeleteDataObject(IDataObject *pda, DWORD fMask)

Referenced by _DoDeleteAsync().

◆ DragEnter()

HRESULT WINAPI CRecyclerDropTarget::DragEnter ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inline

Implements IDropTarget.

Definition at line 110 of file CRecyclerDropTarget.cpp.

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

◆ DragLeave()

HRESULT WINAPI CRecyclerDropTarget::DragLeave ( void  )
inline

Implements IDropTarget.

Definition at line 133 of file CRecyclerDropTarget.cpp.

134  {
135  TRACE("(%p)\n", this);
136 
137  fAcceptFmt = FALSE;
138 
139  return S_OK;
140  }
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ DragOver()

HRESULT WINAPI CRecyclerDropTarget::DragOver ( DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inline

Implements IDropTarget.

Definition at line 121 of file CRecyclerDropTarget.cpp.

122  {
123  TRACE("(%p)\n", this);
124 
125  if (!pdwEffect)
126  return E_INVALIDARG;
127 
128  *pdwEffect = DROPEFFECT_MOVE;
129 
130  return S_OK;
131  }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931

◆ Drop()

HRESULT WINAPI CRecyclerDropTarget::Drop ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
inline

Implements IDropTarget.

Definition at line 142 of file CRecyclerDropTarget.cpp.

144  {
145  TRACE("(%p) object dropped on recycle bin, effect %u\n", this, *pdwEffect);
146 
147  /* TODO: pdwEffect should be read and make the drop object be permanently deleted in the move case (shift held) */
148 
149  FORMATETC fmt;
150  TRACE("(%p)->(DataObject=%p)\n", this, pDataObject);
151  InitFormatEtc (fmt, cfShellIDList, TYMED_HGLOBAL);
152 
153  /* Handle cfShellIDList Drop objects here, otherwise send the appropriate message to other software */
154  if (SUCCEEDED(pDataObject->QueryGetData(&fmt)))
155  {
156  DWORD fMask = 0;
157 
158  if ((dwKeyState & MK_SHIFT) == MK_SHIFT)
159  fMask |= CMIC_MASK_SHIFT_DOWN;
160 
161  _DoDeleteAsync(pDataObject, fMask);
162  }
163  else
164  {
165  /*
166  * TODO call SetData on the data object with format CFSTR_TARGETCLSID
167  * set to the Recycle Bin's class identifier CLSID_RecycleBin.
168  */
169  }
170  return S_OK;
171  }
#define MK_SHIFT
Definition: winuser.h:2344
#define InitFormatEtc(fe, cf, med)
Definition: editor.h:32
const char * fmt
Definition: wsprintf.c:30
static void _DoDeleteAsync(IDataObject *pda, DWORD fMask)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:51
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
Definition: dsound.c:943
#define SUCCEEDED(hr)
Definition: intsafe.h:49

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: