ReactOS 0.4.15-dev-7907-g95bf896
CCopyMoveToMenu.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS shell32
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: CopyTo and MoveTo implementation
5 * COPYRIGHT: Copyright 2020-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7#pragma once
8
10 public CComObjectRootEx<CComMultiThreadModelNoCS>,
11 public IContextMenu2,
12 public IObjectWithSite,
13 public IShellExtInit
14{
15protected:
17 CComPtr<IDataObject> m_pDataObject;
18 CComPtr<IUnknown> m_pSite;
19
22
23public:
24 CComHeapPtr<ITEMIDLIST> m_pidlFolder;
27
29
30 virtual UINT GetCaptionStringID() const = 0;
31 virtual UINT GetButtonStringID() const = 0;
32 virtual UINT GetActionTitleStringID() const = 0;
33 virtual UINT GetFileOp() const = 0;
34 virtual LPCSTR GetVerb() const = 0;
35
36 // IContextMenu
37 STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
39
40 // IContextMenu2
42
43 // IShellExtInit
44 STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
45
46 // IObjectWithSite
47 STDMETHODIMP SetSite(IUnknown *pUnkSite) override;
48 STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override;
49};
50
52 : public CComCoClass<CCopyToMenu, &CLSID_CopyToMenu>
53 , public CCopyMoveToMenu
54{
55public:
56 CComHeapPtr<ITEMIDLIST> m_pidlFolder;
59
61
62 // IContextMenu
63 STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
64
67
69
71 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
72 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
73 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
76
77 UINT GetCaptionStringID() const override { return IDS_COPYITEMS; }
78 UINT GetButtonStringID() const override { return IDS_COPYBUTTON; }
79 UINT GetActionTitleStringID() const override { return IDS_COPYTOTITLE; }
80 UINT GetFileOp() const override { return FO_COPY; }
81 LPCSTR GetVerb() const override { return "copyto"; }
82};
83
85 : public CComCoClass<CMoveToMenu, &CLSID_MoveToMenu>
86 , public CCopyMoveToMenu
87{
88public:
90
91 // IContextMenu
92 STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
93
96
98
100 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
101 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
102 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
105
106 UINT GetCaptionStringID() const override { return IDS_MOVEITEMS; }
107 UINT GetButtonStringID() const override { return IDS_MOVEBUTTON; }
108 UINT GetActionTitleStringID() const override { return IDS_MOVETOTITLE; }
109 UINT GetFileOp() const override { return FO_MOVE; }
110 LPCSTR GetVerb() const override { return "moveto"; }
111};
112
114 : public CComCoClass<CCopyAsPathMenu, &CLSID_CopyAsPathMenu>
115 , public CComObjectRootEx<CComMultiThreadModelNoCS>
116 , public IDropTarget
117{
118public:
122
124 COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
126
127 // IDropTarget
128 STDMETHODIMP DragEnter(IDataObject *pdto, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
129 {
130 *pdwEffect &= DROPEFFECT_COPY;
131 return S_OK;
132 }
133 STDMETHODIMP DragOver(DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
134 {
135 *pdwEffect &= DROPEFFECT_COPY;
136 return S_OK;
137 }
139 {
140 return S_OK;
141 }
142 STDMETHODIMP Drop(IDataObject *pdto, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
143};
#define STDMETHODIMP
Definition: basetyps.h:43
STDMETHODIMP DragLeave()
STDMETHODIMP DragEnter(IDataObject *pdto, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
STDMETHODIMP Drop(IDataObject *pdto, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
STDMETHODIMP DragOver(DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect)
HRESULT DoAction(LPCMINVOKECOMMANDINFO lpici)
virtual UINT GetCaptionStringID() const =0
CComHeapPtr< ITEMIDLIST > m_pidlFolder
virtual UINT GetActionTitleStringID() const =0
HRESULT DoRealFileOp(LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidl)
virtual UINT GetButtonStringID() const =0
STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
virtual UINT GetFileOp() const =0
STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
CComPtr< IDataObject > m_pDataObject
STDMETHODIMP SetSite(IUnknown *pUnkSite) override
STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
CComPtr< IUnknown > m_pSite
virtual LPCSTR GetVerb() const =0
WNDPROC m_fnOldWndProc
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
UINT GetButtonStringID() const override
UINT GetFileOp() const override
BOOL m_bIgnoreTextBoxChange
CComHeapPtr< ITEMIDLIST > m_pidlFolder
UINT GetCaptionStringID() const override
UINT GetActionTitleStringID() const override
LPCSTR GetVerb() const override
WNDPROC m_fnOldWndProc
LPCSTR GetVerb() const override
UINT GetFileOp() const override
UINT GetCaptionStringID() const override
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
UINT GetButtonStringID() const override
UINT GetActionTitleStringID() const override
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
UINT uFlags
Definition: api.c:59
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
const IID IID_IObjectWithSite
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define REFIID
Definition: guiddef.h:118
#define FO_COPY
Definition: shellapi.h:137
#define FO_MOVE
Definition: shellapi.h:136
#define IDS_MOVEITEMS
Definition: shresdef.h:347
#define IDS_MOVEBUTTON
Definition: shresdef.h:348
#define IDS_COPYBUTTON
Definition: shresdef.h:344
#define IDR_MOVETOMENU
Definition: shresdef.h:912
#define IDS_COPYITEMS
Definition: shresdef.h:343
#define IDR_COPYASPATHMENU
Definition: shresdef.h:913
#define IDR_COPYTOMENU
Definition: shresdef.h:911
#define IDS_MOVETOTITLE
Definition: shresdef.h:346
#define IDS_COPYTOTITLE
Definition: shresdef.h:342
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
static void Initialize()
Definition: xlate.c:212
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182