1 /////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or (at
6 // your option) any later version.
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 /////////////////////////////////////////////////////////////////////////////
17 // Look at http://www.codeproject.com/shell/ for excellent guide
18 // to Windows Shell programming by Michael Dunn.
20 * @file WinMergeShell.h
22 * @brief Declaration file for ShellExtension class
24 // ID line follows -- this is updated by SVN
27 #ifndef __WINMERGESHELL_H_
28 #define __WINMERGESHELL_H_
32 #include <atlconv.h> // for ATL string conversion macros
33 #include "resource.h" // main symbols
34 #include "UnicodeString.h"
37 * @brief Class for handling shell extension tasks
39 class ATL_NO_VTABLE CWinMergeShell :
40 public CComObjectRootEx<CComSingleThreadModel>,
41 public CComCoClass<CWinMergeShell, &CLSID_WinMergeShell>,
42 public IDispatchImpl<IWinMergeShell, &IID_IWinMergeShell, &LIBID_SHELLEXTENSIONLib>,
49 DECLARE_REGISTRY_RESOURCEID(IDR_WINMERGESHELL)
51 DECLARE_PROTECT_FINAL_CONSTRUCT()
53 BEGIN_COM_MAP(CWinMergeShell)
54 COM_INTERFACE_ENTRY(IWinMergeShell)
55 COM_INTERFACE_ENTRY(IDispatch)
56 COM_INTERFACE_ENTRY(IShellExtInit)
57 COM_INTERFACE_ENTRY(IContextMenu)
62 String m_strPaths[2]; /**< Paths for selected items */
63 String m_strPreviousPath; /**< Previously selected path */
64 CBitmap m_MergeBmp; /**< Icon */
65 UINT m_nSelectedItems; /**< Amount of selected items */
66 DWORD m_dwContextMenuEnabled; /**< Is context menu enabled and in which mode? */
67 DWORD m_dwMenuState; /**< Shown menuitems */
69 BOOL GetWinMergeDir(String &strDir);
70 BOOL CheckExecutable(String path);
71 int DrawSimpleMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd);
72 int DrawAdvancedMenu(HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd);
73 String GetHelpText(UINT_PTR idCmd);
74 String FormatCmdLine(const String &winmergePath,
75 const String &path1, const String &path2, BOOL bAlterSubFolders);
79 STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
82 STDMETHOD(GetCommandString)(UINT_PTR, UINT, UINT*, LPSTR, UINT);
83 STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
84 STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
87 #endif //__WINMERGESHELL_H_