ReactOS 0.4.15-dev-8131-g4988de4
CRecycleBinItemContextMenu Class Reference
Inheritance diagram for CRecycleBinItemContextMenu:
Collaboration diagram for CRecycleBinItemContextMenu:

Public Member Functions

 CRecycleBinItemContextMenu ()
 
 ~CRecycleBinItemContextMenu ()
 
HRESULT WINAPI Initialize (LPCITEMIDLIST pidl)
 
STDMETHOD() QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
 
STDMETHOD() InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi) override
 
STDMETHOD() GetCommandString (UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
 
STDMETHOD() HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam) 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 HandleMenuMsg ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
- 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 IContextMenuLPCONTEXTMENU
 
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
 
- Static Public Attributes inherited from IContextMenu
static 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 133 of file CRecycleBin.cpp.

Constructor & Destructor Documentation

◆ CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::CRecycleBinItemContextMenu ( )

Definition at line 336 of file CRecycleBin.cpp.

337{
338 apidl = NULL;
339}
#define NULL
Definition: types.h:112

◆ ~CRecycleBinItemContextMenu()

CRecycleBinItemContextMenu::~CRecycleBinItemContextMenu ( )

Definition at line 341 of file CRecycleBin.cpp.

342{
343 ILFree(apidl);
344}
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940

Member Function Documentation

◆ GetCommandString()

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

Implements IContextMenu.

Definition at line 442 of file CRecycleBin.cpp.

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

◆ HandleMenuMsg()

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

Implements IContextMenu2.

Definition at line 449 of file CRecycleBin.cpp.

450{
451 TRACE("CRecycleBin_IContextMenu2Item_HandleMenuMsg (%p)->(msg=%x wp=%lx lp=%lx)\n", this, uMsg, wParam, lParam);
452
453 return E_NOTIMPL;
454}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Initialize()

HRESULT WINAPI CRecycleBinItemContextMenu::Initialize ( LPCITEMIDLIST  pidl)

Definition at line 346 of file CRecycleBin.cpp.

347{
348 apidl = ILClone(pidl);
349 if (apidl == NULL)
350 return E_OUTOFMEMORY;
351 return S_OK;
352}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

◆ InvokeCommand()

HRESULT WINAPI CRecycleBinItemContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
override

Implements IContextMenu.

Definition at line 392 of file CRecycleBin.cpp.

393{
395 WCHAR szDrive[8];
396
397 TRACE("(%p)->(invcom=%p verb=%p wnd=%p)\n", this, lpcmi, lpcmi->lpVerb, lpcmi->hwnd);
398
399 if (lpcmi->lpVerb == MAKEINTRESOURCEA(1) || lpcmi->lpVerb == MAKEINTRESOURCEA(5))
400 {
401 Context.pFileDetails = _ILGetRecycleStruct(apidl);
402 Context.bFound = FALSE;
403
404 if (!GetEnvironmentVariableW(L"SystemDrive", szDrive, _countof(szDrive) - 1))
405 {
406 ERR("GetEnvironmentVariableW failed\n");
407 return E_FAIL;
408 }
409 PathAddBackslashW(szDrive);
410
412 if (!Context.bFound)
413 return E_FAIL;
414
415 BOOL ret = TRUE;
416
417 /* restore file */
418 if (lpcmi->lpVerb == MAKEINTRESOURCEA(1))
419 ret = RestoreFile(Context.hDeletedFile);
420 /* delete file */
421 else
423
424 CloseRecycleBinHandle(Context.hDeletedFile);
425
426 return (ret ? S_OK : E_FAIL);
427 }
428 else if (lpcmi->lpVerb == MAKEINTRESOURCEA(3))
429 {
430 FIXME("implement cut\n");
431 return E_NOTIMPL;
432 }
433 else if (lpcmi->lpVerb == MAKEINTRESOURCEA(7))
434 {
435 FIXME("implement properties\n");
436 return E_NOTIMPL;
437 }
438
439 return S_OK;
440}
static PIDLRecycleStruct * _ILGetRecycleStruct(LPCITEMIDLIST pidl)
BOOL WINAPI CBSearchRecycleBin(IN PVOID Context, IN HDELFILE hDeletedFile)
#define FIXME(fmt,...)
Definition: debug.h:114
#define ERR(fmt,...)
Definition: debug.h:113
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
BOOL WINAPI RestoreFile(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:380
BOOL WINAPI EnumerateRecycleBinW(IN LPCWSTR pszRoot OPTIONAL, IN PENUMERATE_RECYCLEBIN_CALLBACK pFnCallback, IN PVOID Context OPTIONAL)
Definition: recyclebin.c:205
BOOL WINAPI CloseRecycleBinHandle(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:12
BOOL WINAPI DeleteFileHandleToRecycleBin(IN HDELFILE hDeletedFile)
Definition: recyclebin.c:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define L(x)
Definition: ntvdm.h:50
#define PathAddBackslashW
Definition: pathcch.h:301
#define _countof(array)
Definition: sndvol32.h:70
int ret
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 354 of file CRecycleBin.cpp.

355{
356 WCHAR szBuffer[30] = {0};
357 ULONG Count = 1;
358
359 TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n", this, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
360
361 if (LoadStringW(shell32_hInstance, IDS_RESTORE, szBuffer, _countof(szBuffer)))
362 {
363 szBuffer[_countof(szBuffer)-1] = L'\0';
364 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_ENABLED);
365 Count++;
366 }
367
368 if (LoadStringW(shell32_hInstance, IDS_CUT, szBuffer, _countof(szBuffer)))
369 {
370 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
371 szBuffer[_countof(szBuffer)-1] = L'\0';
372 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
373 }
374
375 if (LoadStringW(shell32_hInstance, IDS_DELETE, szBuffer, _countof(szBuffer)))
376 {
377 szBuffer[_countof(szBuffer)-1] = L'\0';
378 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
379 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_STRING, szBuffer, MFS_ENABLED);
380 }
381
382 if (LoadStringW(shell32_hInstance, IDS_PROPERTIES, szBuffer, _countof(szBuffer)))
383 {
384 szBuffer[_countof(szBuffer)-1] = L'\0';
385 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count++, MFT_SEPARATOR, NULL, MFS_ENABLED);
386 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + Count, MFT_STRING, szBuffer, MFS_DEFAULT);
387 }
388
390}
#define shell32_hInstance
#define IDS_DELETE
Definition: resource.h:40
#define IDS_PROPERTIES
Definition: resource.h:102
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
int Count
Definition: noreturn.cpp:7
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_CUT
Definition: shresdef.h:226
#define IDS_RESTORE
Definition: shresdef.h:227
uint32_t ULONG
Definition: typedefs.h:59
#define SEVERITY_SUCCESS
Definition: winerror.h:64
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MFS_DEFAULT
Definition: winuser.h:748
#define MFS_ENABLED
Definition: winuser.h:750
#define MFT_STRING
Definition: winuser.h:746

Member Data Documentation

◆ apidl

LPITEMIDLIST CRecycleBinItemContextMenu::apidl
private

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