ReactOS 0.4.16-dev-1041-g8b6907f
CFindFolderContextMenu Class Reference
Inheritance diagram for CFindFolderContextMenu:
Collaboration diagram for CFindFolderContextMenu:

Static Public Member Functions

static HRESULT Create (IShellFolderView *pShellFolderView, IContextMenu *pInnerContextMenu, IContextMenu **pContextMenu)
 
- 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)
 

Private Member Functions

STDMETHODIMP QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
 
STDMETHODIMP InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi)
 
STDMETHODIMP GetCommandString (UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
 

Private Attributes

CComPtr< IContextMenum_pInner
 
CComPtr< IShellFolderView > m_shellFolderView
 
UINT m_MyFirstId = 0
 

Static Private Attributes

static const UINT ADDITIONAL_MENU_ITEMS = 2
 

Additional Inherited Members

- 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
 
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 ()
 
- 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 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 901 of file CFindFolder.cpp.

Member Function Documentation

◆ Create()

static HRESULT CFindFolderContextMenu::Create ( IShellFolderView *  pShellFolderView,
IContextMenu pInnerContextMenu,
IContextMenu **  pContextMenu 
)
inlinestatic

Definition at line 966 of file CFindFolder.cpp.

967 {
970 if (FAILED_UNEXPECTEDLY(hResult))
971 return hResult;
972 pObj->m_shellFolderView = pShellFolderView;
973 pObj->m_pInner = pInnerContextMenu;
974 return pObj->QueryInterface(IID_PPV_ARG(IContextMenu, pContextMenu));
975 }
static HRESULT WINAPI CreateInstance(CComObject< Base > **pp)
Definition: atlcom.h:171
STDMETHOD() QueryInterface(REFIID iid, void **ppvObject)
Definition: atlcom.h:166
#define FAILED_UNEXPECTEDLY(hr)
Definition: debug.h:83
#define IID_PPV_ARG(Itype, ppType)

Referenced by CFindFolder::GetUIObjectOf().

◆ GetCommandString()

STDMETHODIMP CFindFolderContextMenu::GetCommandString ( UINT_PTR  idCommand,
UINT  uFlags,
UINT lpReserved,
LPSTR  lpszName,
UINT  uMaxNameLen 
)
inlineprivate

Implements IContextMenu.

Definition at line 960 of file CFindFolder.cpp.

961 {
962 return m_pInner->GetCommandString(idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
963 }
static DWORD const LPVOID const lpReserved
CComPtr< IContextMenu > m_pInner
UINT uFlags
Definition: api.c:59

◆ InvokeCommand()

STDMETHODIMP CFindFolderContextMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
inlineprivate

Implements IContextMenu.

Definition at line 928 of file CFindFolder.cpp.

929 {
930 if (!IS_INTRESOURCE(lpcmi->lpVerb))
931 {
932 return m_pInner->InvokeCommand(lpcmi);
933 }
934
935 UINT idCmd = LOWORD(lpcmi->lpVerb);
936 if (m_MyFirstId && idCmd >= m_MyFirstId && idCmd < m_MyFirstId + ADDITIONAL_MENU_ITEMS)
937 {
938 PCUITEMID_CHILD *apidl;
939 UINT cidl;
940 HRESULT hResult = m_shellFolderView->GetSelectedObjects(&apidl, &cidl);
941 if (FAILED_UNEXPECTEDLY(hResult))
942 return hResult;
943
944 for (UINT i = 0; i < cidl; i++)
945 {
947 if (!folderPidl)
948 return E_OUTOFMEMORY;
950 SHOpenFolderAndSelectItems(folderPidl, 1, &child, 0);
951 }
952 LocalFree(apidl); // Yes, LocalFree
953 return S_OK;
954 }
955
956 // FIXME: We can't block FCIDM_SHVIEW_REFRESH here, add items on SFVM_LISTREFRESHED instead
957 return m_pInner->InvokeCommand(lpcmi);
958 }
static LPCWSTR _ILGetPath(LPCITEMIDLIST pidl)
static LPCITEMIDLIST _ILGetFSPidl(LPCITEMIDLIST pidl)
static const UINT ADDITIONAL_MENU_ITEMS
CComPtr< IShellFolderView > m_shellFolderView
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define S_OK
Definition: intsafe.h:52
static HWND child
Definition: cursoricon.c:298
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1101
EXTERN_C HRESULT WINAPI SHOpenFolderAndSelectItems(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD dwFlags)
Definition: shlfolder.cpp:540
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define IS_INTRESOURCE(i)
Definition: winuser.h:580

◆ QueryContextMenu()

STDMETHODIMP CFindFolderContextMenu::QueryContextMenu ( HMENU  hMenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
inlineprivate

Implements IContextMenu.

Definition at line 911 of file CFindFolder.cpp.

912 {
913 m_MyFirstId = 0;
914 if (idCmdLast - idCmdFirst > ADDITIONAL_MENU_ITEMS)
915 {
916 // We use the last available id. For DefView, this places us at
917 // DVIDM_CONTEXTMENU_LAST which should not collide with anything.
918 // This is just a temporary fix until we are moved to shell32 and
919 // can use DFM_MERGECONTEXTMENU.
920 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdLast--, MFT_STRING,
922 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdLast--, MFT_SEPARATOR, NULL, 0);
923 m_MyFirstId = idCmdLast + 1;
924 }
925 return m_pInner->QueryContextMenu(hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
926 }
static void WINAPI _InsertMenuItemW(HMENU hMenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
Definition: CFindFolder.cpp:40
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define IDS_SEARCH_OPEN_FOLDER
Definition: resource.h:181
#define MFT_SEPARATOR
Definition: winuser.h:755
#define MFS_ENABLED
Definition: winuser.h:761
#define MFT_STRING
Definition: winuser.h:757
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Member Data Documentation

◆ ADDITIONAL_MENU_ITEMS

const UINT CFindFolderContextMenu::ADDITIONAL_MENU_ITEMS = 2
staticprivate

Definition at line 908 of file CFindFolder.cpp.

Referenced by InvokeCommand(), and QueryContextMenu().

◆ m_MyFirstId

UINT CFindFolderContextMenu::m_MyFirstId = 0
private

Definition at line 907 of file CFindFolder.cpp.

Referenced by InvokeCommand(), and QueryContextMenu().

◆ m_pInner

CComPtr<IContextMenu> CFindFolderContextMenu::m_pInner
private

Definition at line 905 of file CFindFolder.cpp.

Referenced by GetCommandString(), InvokeCommand(), and QueryContextMenu().

◆ m_shellFolderView

CComPtr<IShellFolderView> CFindFolderContextMenu::m_shellFolderView
private

Definition at line 906 of file CFindFolder.cpp.

Referenced by InvokeCommand().


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