NCContextMenu.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef NCCONTEXTMENU_H
  15. #define NCCONTEXTMENU_H
  16. #pragma once
  17. #include <shlobj.h> // For IShellExtInit and IContextMenu
  18. #include <string>
  19. #include "NCClientInterface.h"
  20. class NCContextMenu : public IShellExtInit, public IContextMenu
  21. {
  22. public:
  23. // IUnknown
  24. IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
  25. IFACEMETHODIMP_(ULONG) AddRef();
  26. IFACEMETHODIMP_(ULONG) Release();
  27. // IShellExtInit
  28. IFACEMETHODIMP Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID);
  29. // IContextMenu
  30. IFACEMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
  31. IFACEMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici);
  32. IFACEMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax);
  33. NCContextMenu();
  34. protected:
  35. ~NCContextMenu();
  36. private:
  37. // Reference count of component.
  38. long m_cRef;
  39. // The name of the selected files (separated by '\x1e')
  40. std::wstring m_selectedFiles;
  41. NCClientInterface::ContextMenuInfo m_info;
  42. };
  43. #endif //NCCONTEXTMENU_H