1 /*
2  * PROJECT:     ReactOS shell extensions
3  * LICENSE:     GPL - See COPYING in the top level directory
4  * FILE:        dll/shellext/qcklnch/CISFBand.h
5  * PURPOSE:     Quick Launch Toolbar (Taskbar Shell Extension)
6  * PROGRAMMERS: Shriraj Sawant a.k.a SR13 <sr.official@hotmail.com>
7  */
8 
9 #pragma once
10 
11 class CISFBand :
12     public CWindow,
13     public CComCoClass<CBandSiteMenu, &CLSID_ISFBand>,
14     public CComObjectRootEx<CComMultiThreadModelNoCS>,
15     public IObjectWithSite,
16     public IDeskBand,
17     public IPersistStream,
18     public IWinEventHandler,
19     public IOleCommandTarget,
20     public IShellFolderBand,
21     public IContextMenu
22 {
23     // Band
24     DWORD m_BandID;
25     CComPtr<IUnknown> m_Site;
26 
27     // Toolbar
28     CComPtr<IShellFolder> m_pISF;
29     PIDLIST_ABSOLUTE m_pidl;
30 
31     // Menu
32     BOOL m_textFlag;
33     BOOL m_iconFlag;
34     BOOL m_QLaunch;
35 
36 public:
37 
38     CISFBand();
39     virtual ~CISFBand();
40 
41 // Personal Methods
42     HRESULT CreateSimpleToolbar(HWND hWndParent);
43 
44     STDMETHOD(ContainsWindow)(
45         IN HWND hWnd
46     );
47 
48 // IObjectWithSite
49 
50     STDMETHOD(GetSite)(
51         IN  REFIID riid,
52         OUT void   **ppvSite
53     ) override;
54 
55     STDMETHOD(SetSite)(
56         IN IUnknown *pUnkSite
57     ) override;
58 
59 // IDeskBand
60 
61     STDMETHOD(GetWindow)(
62         OUT HWND *phwnd
63     ) override;
64 
65     STDMETHOD(ContextSensitiveHelp)(
66         IN BOOL fEnterMode
67     ) override;
68 
69     STDMETHOD(ShowDW)(
70         IN BOOL bShow
71     ) override;
72 
73     STDMETHOD(CloseDW)(
74         IN DWORD dwReserved
75     ) override;
76 
77     STDMETHOD(ResizeBorderDW)(
78         LPCRECT prcBorder,
79         IUnknown *punkToolbarSite,
80         BOOL fReserved
81     ) override;
82 
83     STDMETHOD(GetBandInfo)(
84         IN DWORD dwBandID,
85         IN DWORD dwViewMode,
86         IN OUT DESKBANDINFO *pdbi
87     ) override;
88 
89 // IPersistStream
90 
91     STDMETHOD(GetClassID)(
92         OUT CLSID *pClassID
93     ) override;
94 
95     STDMETHOD(GetSizeMax)(
96         OUT ULARGE_INTEGER *pcbSize
97     ) override;
98 
99     STDMETHOD(IsDirty)() override;
100 
101     STDMETHOD(Load)(
102         IN IStream *pStm
103     ) override;
104 
105     STDMETHOD(Save)(
106         IN IStream *pStm,
107         IN BOOL    fClearDirty
108     ) override;
109 
110 // IWinEventHandler
111 
112     STDMETHOD(OnWinEvent)(
113         HWND hWnd,
114         UINT uMsg,
115         WPARAM wParam,
116         LPARAM lParam,
117         LRESULT *theResult
118     ) override;
119 
120     STDMETHOD(IsWindowOwner)(
121         HWND hWnd
122     ) override;
123 
124 // IOleCommandTarget
125 
126     STDMETHOD(Exec)(
127         IN const GUID *pguidCmdGroup,
128         IN DWORD nCmdID,
129         IN DWORD nCmdexecopt,
130         IN VARIANT *pvaIn,
131         IN OUT VARIANT *pvaOut
132     ) override;
133 
134     STDMETHOD(QueryStatus)(
135         IN const GUID *pguidCmdGroup,
136         IN ULONG cCmds,
137         IN OUT OLECMD prgCmds[],
138         IN OUT OLECMDTEXT *pCmdText
139     ) override;
140 
141 // IShellFolderBand
142     STDMETHOD(GetBandInfoSFB)(
143         PBANDINFOSFB pbi
144     ) override;
145 
146     STDMETHOD(InitializeSFB)(
147         IShellFolder      *psf,
148         PCIDLIST_ABSOLUTE pidl
149     ) override;
150 
151     STDMETHOD(SetBandInfoSFB)(
152         PBANDINFOSFB pbi
153     ) override;
154 
155 // IContextMenu
156     STDMETHOD(GetCommandString)(
157         UINT_PTR idCmd,
158         UINT uFlags,
159         UINT *pwReserved,
160         LPSTR pszName,
161         UINT cchMax
162     ) override;
163 
164     STDMETHOD(InvokeCommand)(
165         LPCMINVOKECOMMANDINFO pici
166     ) override;
167 
168     STDMETHOD(QueryContextMenu)(
169         HMENU hmenu,
170         UINT indexMenu,
171         UINT idCmdFirst,
172         UINT idCmdLast,
173         UINT uFlags
174     ) override;
175 
176 //*****************************************************************************************************
177 
178     DECLARE_REGISTRY_RESOURCEID(IDR_ISFBAND)
179     DECLARE_NOT_AGGREGATABLE(CISFBand)
180     DECLARE_PROTECT_FINAL_CONSTRUCT()
181 
182     BEGIN_COM_MAP(CISFBand)
183         COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
184         COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
185         COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
186         COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
187         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
188         COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
189         COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
190         COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
191         COM_INTERFACE_ENTRY_IID(IID_IShellFolderBand, IShellFolderBand)
192         COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
193     END_COM_MAP()
194 };
195 
196 extern "C" HRESULT WINAPI RSHELL_CISFBand_CreateInstance(REFIID riid, void** ppv);
197