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 // IObjectWithSite
45 
46     virtual STDMETHODIMP GetSite(
47         IN  REFIID riid,
48         OUT void   **ppvSite
49     );
50 
51     virtual STDMETHODIMP SetSite(
52         IN IUnknown *pUnkSite
53     );
54 
55 // IDeskBand
56 
57     virtual STDMETHODIMP GetWindow(
58         OUT HWND *phwnd
59     );
60 
61     virtual STDMETHODIMP ContextSensitiveHelp(
62         IN BOOL fEnterMode
63     );
64 
65     virtual STDMETHODIMP ShowDW(
66         IN BOOL bShow
67     );
68 
69     virtual STDMETHODIMP CloseDW(
70         IN DWORD dwReserved
71     );
72 
73     virtual STDMETHODIMP ResizeBorderDW(
74         LPCRECT prcBorder,
75         IUnknown *punkToolbarSite,
76         BOOL fReserved
77     );
78 
79     virtual STDMETHODIMP GetBandInfo(
80         IN DWORD dwBandID,
81         IN DWORD dwViewMode,
82         IN OUT DESKBANDINFO *pdbi
83     );
84 
85 // IPersistStream
86 
87     virtual STDMETHODIMP GetClassID(
88         OUT CLSID *pClassID
89     );
90 
91     virtual STDMETHODIMP GetSizeMax(
92         OUT ULARGE_INTEGER *pcbSize
93     );
94 
95     virtual STDMETHODIMP IsDirty();
96 
97     virtual STDMETHODIMP Load(
98         IN IStream *pStm
99     );
100 
101     virtual STDMETHODIMP Save(
102         IN IStream *pStm,
103         IN BOOL    fClearDirty
104     );
105 
106 // IWinEventHandler
107 
108     virtual STDMETHODIMP ContainsWindow(
109         IN HWND hWnd
110     );
111 
112     virtual STDMETHODIMP OnWinEvent(
113         HWND hWnd,
114         UINT uMsg,
115         WPARAM wParam,
116         LPARAM lParam,
117         LRESULT *theResult
118     );
119 
120     virtual STDMETHODIMP IsWindowOwner(
121         HWND hWnd
122     );
123 
124 // IOleCommandTarget
125 
126     virtual STDMETHODIMP Exec(
127         IN const GUID *pguidCmdGroup,
128         IN DWORD nCmdID,
129         IN DWORD nCmdexecopt,
130         IN VARIANT *pvaIn,
131         IN OUT VARIANT *pvaOut
132     );
133 
134     virtual STDMETHODIMP QueryStatus(
135         IN const GUID *pguidCmdGroup,
136         IN ULONG cCmds,
137         IN OUT OLECMD prgCmds[],
138         IN OUT OLECMDTEXT *pCmdText
139     );
140 
141 // IShellFolderBand
142     virtual STDMETHODIMP GetBandInfoSFB(
143         PBANDINFOSFB pbi
144     );
145 
146     virtual STDMETHODIMP InitializeSFB(
147         IShellFolder      *psf,
148         PCIDLIST_ABSOLUTE pidl
149     );
150 
151     virtual STDMETHODIMP SetBandInfoSFB(
152         PBANDINFOSFB pbi
153     );
154 
155 // IContextMenu
156     virtual STDMETHODIMP GetCommandString(
157         UINT_PTR idCmd,
158         UINT uFlags,
159         UINT *pwReserved,
160         LPSTR pszName,
161         UINT cchMax
162     );
163 
164     virtual STDMETHODIMP InvokeCommand(
165         LPCMINVOKECOMMANDINFO pici
166     );
167 
168     virtual STDMETHODIMP QueryContextMenu(
169         HMENU hmenu,
170         UINT indexMenu,
171         UINT idCmdFirst,
172         UINT idCmdLast,
173         UINT uFlags
174     );
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