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