1 /* 2 * FolderItemVerb(s) implementation 3 * 4 * Copyright 2015 Mark Jansen 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 19 */ 20 21 #ifndef _FOLDERITEMVERBS_H_ 22 #define _FOLDERITEMVERBS_H_ 23 24 class CFolderItemVerb: 25 public CComCoClass<CFolderItemVerb>, 26 public CComObjectRootEx<CComMultiThreadModelNoCS>, 27 public IDispatchImpl<FolderItemVerb, &IID_FolderItemVerb> 28 { 29 private: 30 CComPtr<IContextMenu> m_contextmenu; 31 CComBSTR m_name; 32 33 public: 34 CFolderItemVerb(); 35 ~CFolderItemVerb(); 36 37 void Init(IContextMenu* menu, BSTR name); 38 39 // *** FolderItemVerb methods *** 40 STDMETHOD(get_Application)(IDispatch **ppid) override; 41 STDMETHOD(get_Parent)(IDispatch **ppid) override; 42 STDMETHOD(get_Name)(BSTR *pbs) override; 43 STDMETHOD(DoIt)() override; 44 45 46 DECLARE_NOT_AGGREGATABLE(CFolderItemVerb) 47 DECLARE_PROTECT_FINAL_CONSTRUCT() 48 49 BEGIN_COM_MAP(CFolderItemVerb) 50 COM_INTERFACE_ENTRY_IID(IID_FolderItemVerb, FolderItemVerb) 51 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) 52 END_COM_MAP() 53 }; 54 55 56 class CFolderItemVerbs: 57 public CComCoClass<CFolderItemVerbs>, 58 public CComObjectRootEx<CComMultiThreadModelNoCS>, 59 public IDispatchImpl<FolderItemVerbs, &IID_FolderItemVerbs> 60 { 61 private: 62 CComPtr<IContextMenu> m_contextmenu; 63 HMENU m_menu; 64 int m_count; 65 66 public: 67 CFolderItemVerbs(); 68 virtual ~CFolderItemVerbs(); 69 70 HRESULT Init(LPITEMIDLIST idlist); 71 72 // *** FolderItemVerbs methods *** 73 STDMETHOD(get_Count)(LONG *plCount) override; 74 STDMETHOD(get_Application)(IDispatch **ppid) override; 75 STDMETHOD(get_Parent)(IDispatch **ppid) override; 76 STDMETHOD(Item)(VARIANT index, FolderItemVerb **ppid) override; 77 STDMETHOD(_NewEnum)(IUnknown **ppunk) override; 78 79 DECLARE_NOT_AGGREGATABLE(CFolderItemVerbs) 80 DECLARE_PROTECT_FINAL_CONSTRUCT() 81 82 BEGIN_COM_MAP(CFolderItemVerbs) 83 COM_INTERFACE_ENTRY_IID(IID_FolderItemVerbs, FolderItemVerbs) 84 COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch) 85 END_COM_MAP() 86 }; 87 88 #endif 89