1 /*
2  * PROJECT:     ReactOS shell extensions
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Quick Launch Toolbar (Taskbar Shell Extension)
5  * COPYRIGHT:   Copyright Shriraj Sawant a.k.a SR13 <sr.official@hotmail.com>
6  */
7 #pragma once
8 
9 extern const GUID CLSID_QuickLaunchBand;
10 
11 // Component category registration
12 HRESULT RegisterComCat();
13 HRESULT UnregisterComCat();
14 
15 // COM class for quick launch
16 class CQuickLaunchBand :
17     public CComCoClass<CQuickLaunchBand, &CLSID_QuickLaunchBand>,
18     public CComObjectRootEx<CComMultiThreadModelNoCS>,
19     public IObjectWithSite,
20     public IDeskBand,
21     public IPersistStream,
22     public IWinEventHandler,
23     public IOleCommandTarget,
24     public IContextMenu
25 {
26     HWND m_hWndBro;
27     CComPtr<IUnknown> m_punkISFB;
28 
29 public:
30     CQuickLaunchBand();
31     virtual ~CQuickLaunchBand();
32 
33     STDMETHOD(ContainsWindow)(IN HWND hWnd);
34 
35 // ATL construct
36 
37     HRESULT FinalConstruct();
38 
39 // IObjectWithSite
40 
41     STDMETHOD(GetSite)(
42         IN  REFIID riid,
43         OUT void   **ppvSite) override;
44 
45     STDMETHOD(SetSite)(IN IUnknown *pUnkSite) override;
46 
47 // IDeskBand
48 
49     STDMETHOD(GetWindow)(OUT HWND *phwnd) override;
50 
51     STDMETHOD(ContextSensitiveHelp)(IN BOOL fEnterMode) override;
52 
53     STDMETHOD(ShowDW)(IN BOOL bShow) override;
54 
55     STDMETHOD(CloseDW)(IN DWORD dwReserved) override;
56 
57     STDMETHOD(ResizeBorderDW)(
58         LPCRECT prcBorder,
59         IUnknown *punkToolbarSite,
60         BOOL fReserved) override;
61 
62     STDMETHOD(GetBandInfo)(
63         IN DWORD dwBandID,
64         IN DWORD dwViewMode,
65         IN OUT DESKBANDINFO *pdbi) override;
66 
67 // IPersistStream
68 
69     STDMETHOD(GetClassID)(OUT CLSID *pClassID) override;
70 
71     STDMETHOD(GetSizeMax)(OUT ULARGE_INTEGER *pcbSize) override;
72 
73     STDMETHOD(IsDirty)() override;
74 
75     STDMETHOD(Load)(IN IStream *pStm) override;
76 
77     STDMETHOD(Save)(
78         IN IStream *pStm,
79         IN BOOL    fClearDirty) override;
80 
81 // IWinEventHandler
82 
83     STDMETHOD(OnWinEvent)(
84         HWND hWnd,
85         UINT uMsg,
86         WPARAM wParam,
87         LPARAM lParam,
88         LRESULT *theResult) override;
89 
90     STDMETHOD(IsWindowOwner)(HWND hWnd) override;
91 
92 // IOleCommandTarget
93 
94     STDMETHOD(Exec)(
95         IN const GUID *pguidCmdGroup,
96         IN DWORD nCmdID,
97         IN DWORD nCmdexecopt,
98         IN VARIANT *pvaIn,
99         IN OUT VARIANT *pvaOut) override;
100 
101     STDMETHOD(QueryStatus)(
102         IN const GUID *pguidCmdGroup,
103         IN ULONG cCmds,
104         IN OUT OLECMD prgCmds[],
105         IN OUT OLECMDTEXT *pCmdText) override;
106 
107 // IContextMenu
108     STDMETHOD(GetCommandString)(
109         UINT_PTR idCmd,
110         UINT uFlags,
111         UINT *pwReserved,
112         LPSTR pszName,
113         UINT cchMax) override;
114 
115     STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO pici) override;
116 
117     STDMETHOD(QueryContextMenu)(
118         HMENU hmenu,
119         UINT indexMenu,
120         UINT idCmdFirst,
121         UINT idCmdLast,
122         UINT uFlags) override;
123 
124 //*****************************************************************************************************
125 
126     DECLARE_NOT_AGGREGATABLE(CQuickLaunchBand)
127     DECLARE_PROTECT_FINAL_CONSTRUCT()
128 
129     BEGIN_COM_MAP(CQuickLaunchBand)
130         COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDeskBand)
131         COM_INTERFACE_ENTRY2_IID(IID_IDockingWindow, IDockingWindow, IDeskBand)
132         COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
133         COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
134         COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
135         COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
136         COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
137         COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
138         COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
139     END_COM_MAP()
140 };
141