2011-05-15 15:55:49 +00:00
|
|
|
/*
|
|
|
|
* provides new shell item service
|
|
|
|
*
|
|
|
|
* Copyright 2007 Johannes Anderwald (janderwald@reactos.org)
|
|
|
|
* Copyright 2009 Andrew Hill
|
2012-01-09 23:01:01 +00:00
|
|
|
* Copyright 2012 Rafal Harabien
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SHV_ITEM_NEW_H_
|
|
|
|
#define _SHV_ITEM_NEW_H_
|
|
|
|
|
|
|
|
class CNewMenu :
|
|
|
|
public CComCoClass<CNewMenu, &CLSID_NewMenu>,
|
|
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
|
|
public IObjectWithSite,
|
|
|
|
public IContextMenu2,
|
|
|
|
public IShellExtInit
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
enum SHELLNEW_TYPE
|
|
|
|
{
|
|
|
|
SHELLNEW_TYPE_INVALID = -1,
|
|
|
|
SHELLNEW_TYPE_COMMAND = 1,
|
|
|
|
SHELLNEW_TYPE_DATA = 2,
|
|
|
|
SHELLNEW_TYPE_FILENAME = 4,
|
|
|
|
SHELLNEW_TYPE_NULLFILE = 8
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SHELLNEW_ITEM
|
|
|
|
{
|
2012-01-05 23:04:06 +00:00
|
|
|
SHELLNEW_TYPE Type;
|
|
|
|
LPWSTR pwszExt;
|
2012-01-09 23:01:01 +00:00
|
|
|
PBYTE pData;
|
|
|
|
ULONG cbData;
|
2012-01-05 23:04:06 +00:00
|
|
|
LPWSTR pwszDesc;
|
2012-01-09 23:01:01 +00:00
|
|
|
HBITMAP hBitmap;
|
2012-01-05 23:04:06 +00:00
|
|
|
SHELLNEW_ITEM *pNext;
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
2012-01-05 23:04:06 +00:00
|
|
|
LPWSTR m_wszPath;
|
2012-01-09 23:01:01 +00:00
|
|
|
SHELLNEW_ITEM *m_pItems;
|
|
|
|
SHELLNEW_ITEM *m_pLinkItem;
|
2012-01-05 23:04:06 +00:00
|
|
|
IUnknown *m_pSite;
|
|
|
|
HMENU m_hSubMenu;
|
2012-01-09 23:01:01 +00:00
|
|
|
HBITMAP m_hbmFolder, m_hbmLink;
|
2012-01-05 23:04:06 +00:00
|
|
|
|
|
|
|
SHELLNEW_ITEM *LoadItem(LPCWSTR pwszExt);
|
|
|
|
void UnloadItem(SHELLNEW_ITEM *pItem);
|
2012-01-09 23:01:01 +00:00
|
|
|
void UnloadAllItems();
|
|
|
|
BOOL LoadAllItems();
|
2011-05-15 15:55:49 +00:00
|
|
|
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
|
2012-01-09 23:01:01 +00:00
|
|
|
SHELLNEW_ITEM *FindItemFromIdOffset(UINT IdOffset);
|
|
|
|
HRESULT CreateNewFolder(IShellView *psv);
|
|
|
|
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi, IShellView *psv);
|
2012-01-05 23:04:06 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
CNewMenu();
|
|
|
|
~CNewMenu();
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
// IObjectWithSite
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
|
|
|
|
|
|
|
|
// IContextMenu
|
|
|
|
virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
|
|
|
|
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
|
2012-01-05 23:04:06 +00:00
|
|
|
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
// IContextMenu2
|
|
|
|
virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
// IShellExtInit
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
|
|
|
|
|
|
|
|
DECLARE_REGISTRY_RESOURCEID(IDR_NEWMENU)
|
|
|
|
DECLARE_NOT_AGGREGATABLE(CNewMenu)
|
|
|
|
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CNewMenu)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
|
|
|
|
END_COM_MAP()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _SHV_ITEM_NEW_H_
|