added a readme file where to find the source code for TortoiseOverlays
[TortoiseGit.git] / src / TortoiseOverlays / ShellExt.h
blobc31fbc72785130e21b9bd58be70f9d66b0e6676f
1 // TortoiseOverlays - an overlay handler for Tortoise clients
2 // Copyright (C) 2007 - TortoiseSVN
4 #pragma once
5 #include <vector>
7 #include "resource.h"
9 extern UINT g_cRefThisDll; // Reference count of this DLL.
10 extern HINSTANCE g_hmodThisDll; // Instance handle for this DLL
12 using namespace std;
14 enum FileState
16 FileStateNormal,
17 FileStateModified,
18 FileStateConflict,
19 FileStateLocked,
20 FileStateReadOnly,
21 FileStateDeleted,
22 FileStateAdded,
23 FileStateIgnored,
24 FileStateUnversioned,
25 FileStateInvalid
28 class DLLPointers
30 public:
31 DLLPointers() : hDll(NULL)
32 , pDllGetClassObject(NULL)
33 , pDllCanUnloadNow(NULL)
34 , pShellIconOverlayIdentifier(NULL)
38 HINSTANCE hDll;
39 LPFNGETCLASSOBJECT pDllGetClassObject;
40 LPFNCANUNLOADNOW pDllCanUnloadNow;
41 IShellIconOverlayIdentifier * pShellIconOverlayIdentifier;
44 // The actual OLE Shell context menu handler
45 /**
46 * The main class of our COM object / Shell Extension.
47 * It contains all Interfaces we implement for the shell to use.
49 class CShellExt : public IShellIconOverlayIdentifier
51 protected:
52 FileState m_State;
53 ULONG m_cRef;
55 vector<DLLPointers> m_dllpointers;
57 private:
58 int GetInstalledOverlays(void); ///< returns the maximum number of overlays TSVN shall use
59 void LoadRealLibrary(LPCTSTR ModuleName, LPCTSTR clsid, LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
60 void LoadHandlers(LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
61 public:
62 CShellExt(FileState state);
63 virtual ~CShellExt();
65 /** \name IUnknown
66 * IUnknown members
68 //@{
69 STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
70 STDMETHODIMP_(ULONG) AddRef();
71 STDMETHODIMP_(ULONG) Release();
72 //@}
75 /** \name IShellIconOverlayIdentifier
76 * IShellIconOverlayIdentifier methods
78 //@{
79 STDMETHODIMP GetOverlayInfo(LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
80 STDMETHODIMP GetPriority(int *pPriority);
81 STDMETHODIMP IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib);
82 //@}