OSDN Git Service

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