ReactOS  0.4.15-dev-3173-g40ee59d
CRecycleBinItemContextMenu Class Reference
Inheritance diagram for CRecycleBinItemContextMenu:
Collaboration diagram for CRecycleBinItemContextMenu:

Public Member Functions

 CRecycleBinItemContextMenu ()
 
 ~CRecycleBinItemContextMenu ()
 
HRESULT WINAPI Initialize (LPCITEMIDLIST pidl)
 
virtual HRESULT WINAPI QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
 
virtual HRESULT WINAPI InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
 
virtual HRESULT WINAPI GetCommandString (UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
 
virtual HRESULT WINAPI HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- 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 ()
 

Private Attributes

LPITEMIDLIST apidl
 

Additional Inherited Members

- Public Types inherited from IContextMenu2
typedef IContextMenu2LPCONTEXTMENU2
 
- Public Types inherited from IContextMenu
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- 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 IContextMenu
CMIC_MASK_NOZONECHECKS typedef IContextMenuLPCONTEXTMENU
 
- Static Public Attributes inherited from IContextMenu
static CMDSTR_VIEWDETAILSW(const WCHAR []) const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 94 of file CRecycleBin.cpp.

Constructor & Destructor Documentation

◆ CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::CRecycleBinItemContextMenu ( )

Definition at line 304 of file CRecycleBin.cpp.

305 {
306  apidl = NULL;
307 }
#define NULL
Definition: types.h:112

◆ ~CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::~CRecycleBinItemContextMenu ( )

Definition at line 309 of file CRecycleBin.cpp.

310 {
311  ILFree(apidl);
312 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925

Member Function Documentation

◆ GetCommandString()

HRESULT WINAPI CRecycleBinItemContextMenu::GetCommandString ( UINT_PTR  idCommand,
UINT  uFlags,
UINT lpReserved,
LPSTR  lpszName,
UINT  uMaxNameLen 
)
virtual

Implements IContextMenu.

Definition at line 411 of file CRecycleBin.cpp.

412 {
413  TRACE("(%p)->(idcom=%lx flags=%x %p name=%p len=%x)\n", this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
414 
415  return E_FAIL;
416 }
UINT uFlags
Definition: api.c:59
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4

◆ HandleMenuMsg()

HRESULT WINAPI CRecycleBinItemContextMenu::HandleMenuMsg ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Implements IContextMenu2.

Definition at line 418 of file CRecycleBin.cpp.

419 {
420  TRACE("CRecycleBin_IContextMenu2Item_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
421 
422  return E_NOTIMPL;
423 }
WPARAM wParam
Definition: combotst.c:138
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99
LPARAM lParam
Definition: combotst.c:139

◆ Initialize()

HRESULT WINAPI CRecycleBinItemContextMenu::Initialize ( LPCITEMIDLIST  pidl)

Definition at line 314 of file CRecycleBin.cpp.

315 {
316  apidl = ILClone(pidl);
317  if (apidl == NULL)
318  return E_OUTOFMEMORY;
319  return S_OK;
320 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112

◆ InvokeCommand()

HRESULT WINAPI CRecycleBinItemContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
virtual

Implements IContextMenu.

Definition at line 360 of file CRecycleBin.cpp.

361 {
363  WCHAR szDrive[8];
364 
365  TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
366 
367  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb == MAKEINTRESOURCEA(5))
368  {
369  Context.pFileDetails = _ILGetRecycleStruct(apidl);
370  Context.bFound = FALSE;
371 
372  if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
373  {
374  ERR("GetEnvironmentVariableW failed\n");
375  return E_FAIL;
376  }
377  PathAddBackslashW(szDrive);
378 
380  if (!Context.bFound)
381  return E_FAIL;
382 
383  if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
384  {
385  /* restore file */
386  if (RestoreFile(Context.hDeletedFile))
387  return S_OK;
388  else
389  return E_FAIL;
390  }
391  else
392  {
394  return E_NOTIMPL;
395  }
396  }
397  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3))
398  {
399  FIXME("implement cut\n");
400  return E_NOTIMPL;
401  }
402  else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7))
403  {
404  FIXME("implement properties\n");
405  return E_NOTIMPL;
406  }
407 
408  return S_OK;
409 }
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HANDLE hDeletedFile)
Definition: recyclebin.c:93
#define FALSE
Definition: types.h:117
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
BOOL WINAPI RestoreFile(IN HANDLE hDeletedFile)
Definition: recyclebin.c:366
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define E_NOTIMPL
Definition: ddrawi.h:99
static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
struct tagContext Context
Definition: acpixf.h:1034
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:614

◆ QueryContextMenu()

HRESULT WINAPI CRecycleBinItemContextMenu::QueryContextMenu ( HMENU  hMenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
virtual

Implements IContextMenu.

Definition at line 322 of file CRecycleBin.cpp.

323 {
324  WCHAR szBuffer[30] = {0};
325  ULONG Count = 1;
326 
327  TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
328 
329  if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, _countof(szBuffer)))
330  {
331  szBuffer[_countof(szBuffer)-1] = L'\0';
332  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
333  Count++;
334  }
335 
336  if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, _countof(szBuffer)))
337  {
338  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
339  szBuffer[_countof(szBuffer)-1] = L'\0';
340  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
341  }
342 
343  if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, _countof(szBuffer)))
344  {
345  szBuffer[_countof(szBuffer)-1] = L'\0';
346  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
347  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
348  }
349 
350  if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, _countof(szBuffer)))
351  {
352  szBuffer[_countof(szBuffer)-1] = L'\0';
353  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
354  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
355  }
356 
357  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
358 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_CUT
Definition: shresdef.h:223
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
#define IDS_RESTORE
Definition: shresdef.h:224
#define IDS_PROPERTIES
Definition: resource.h:101
UINT uFlags
Definition: api.c:59
#define MFS_DEFAULT
Definition: winuser.h:743
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFS_ENABLED
Definition: winuser.h:745
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
int Count
Definition: noreturn.cpp:7
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MFT_SEPARATOR
Definition: winuser.h:739
static const WCHAR L[]
Definition: oid.c:1250
#define shell32_hInstance
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define IDS_DELETE
Definition: resource.h:40

Member Data Documentation

◆ apidl

LPITEMIDLIST CRecycleBinItemContextMenu::apidl
private

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