1 /**
2 * Copyright (c) 2015 Daniel Molkentin <danimo@owncloud.com>. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14 
15 #ifndef OCCONTEXTMENU_H
16 #define OCCONTEXTMENU_H
17 
18 #pragma once
19 #include <shlobj.h>     // For IShellExtInit and IContextMenu
20 #include <string>
21 #include "OCClientInterface.h"
22 
23 class OCContextMenu : public IShellExtInit, public IContextMenu
24 {
25 public:
26 	// IUnknown
27 	IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
28 	IFACEMETHODIMP_(ULONG) AddRef();
29 	IFACEMETHODIMP_(ULONG) Release();
30 
31 	// IShellExtInit
32 	IFACEMETHODIMP Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID);
33 
34 	// IContextMenu
35 	IFACEMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
36 	IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
37 	IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
38 
39 	OCContextMenu();
40 
41 protected:
42 	~OCContextMenu();
43 
44 private:
45 	// Reference count of component.
46 	long m_cRef;
47 
48 	// The name of the selected files (separated by '\x1e')
49 	std::wstring m_selectedFiles;
50 	OCClientInterface::ContextMenuInfo m_info;
51 };
52 
53 #endif //OCCONTEXTMENU_H
54