ReactOS 0.4.15-dev-8219-ge8b88cf
CMenuSite.h
Go to the documentation of this file.
1/*
2 * Shell Menu Site
3 *
4 * Copyright 2014 David Quintana
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20#pragma once
21
22class CMenuSite :
23 public CComCoClass<CMenuSite, &CLSID_MenuBandSite>,
24 public CComObjectRootEx<CComMultiThreadModelNoCS>,
25 public CWindowImpl<CMenuSite, CWindow, CControlWinTraits>,
26 public IBandSite,
27 public IDeskBarClient,
28 public IOleCommandTarget,
29 public IInputObject,
30 public IInputObjectSite,
31 public IWinEventHandler,
32 public IServiceProvider
33{
34private:
35 CComPtr<IUnknown> m_DeskBarSite;
36 CComPtr<IUnknown> m_BandObject;
37 CComPtr<IDeskBand> m_DeskBand;
38 CComPtr<IWinEventHandler> m_WinEventHandler;
40
41public:
42 CMenuSite();
43 virtual ~CMenuSite() {}
44
45 DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_MENU)
46
52 COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
54 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
55 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
56 COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
57 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
58 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
60
61 // IBandSite
63 STDMETHOD(EnumBands)(UINT uBand, DWORD* pdwBandID) override;
64 STDMETHOD(QueryBand)(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) override;
66
67 // IDeskBarClient
71
72 // IOleWindow
74
75 // IOleCommandTarget
76 STDMETHOD(QueryStatus)(const GUID * pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) override;
77 STDMETHOD(Exec)(const GUID * pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
78
79 // IInputObject
80 STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg) override;
83
84 // IInputObjectSite
85 STDMETHOD(OnFocusChangeIS)(IUnknown *punkObj, BOOL fSetFocus) override;
86
87 // IWinEventHandler
90
91 // IServiceProvider
93
94 // Using custom message map instead
95 virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId = 0);
96
97 // IDeskBarClient
102 STDMETHOD(SetBandState)(DWORD dwBandID, DWORD dwMask, DWORD dwState) override;
104
105private:
106 IUnknown * ToIUnknown() { return static_cast<IDeskBarClient*>(this); }
107};
HWND hWnd
Definition: settings.c:17
#define STDMETHOD(m)
Definition: basetyps.h:62
STDMETHOD() SetDeskBarSite(IUnknown *punkSite) override
Definition: CMenuSite.cpp:210
STDMETHOD() QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
Definition: CMenuSite.cpp:204
STDMETHOD() GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv) override
Definition: CMenuSite.cpp:96
STDMETHOD() QueryService(REFGUID guidService, REFIID riid, void **ppvObject) override
Definition: CMenuSite.cpp:178
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode) override
Definition: CMenuSite.cpp:314
STDMETHOD() GetSize(DWORD dwWhich, LPRECT prc) override
Definition: CMenuSite.cpp:128
STDMETHOD() OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override
Definition: CMenuSite.cpp:170
STDMETHOD() HasFocusIO() override
Definition: CMenuSite.cpp:349
STDMETHOD() UIActivateIO(BOOL fActivate, LPMSG lpMsg) override
Definition: CMenuSite.cpp:265
STDMETHOD() SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) override
Definition: CMenuSite.cpp:334
STDMETHOD() UIActivateDBC(DWORD dwState) override
Definition: CMenuSite.cpp:257
STDMETHOD() EnumBands(UINT uBand, DWORD *pdwBandID) override
Definition: CMenuSite.cpp:86
STDMETHOD() GetBandSiteInfo(BANDSITEINFO *pbsinfo) override
Definition: CMenuSite.cpp:319
virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId=0)
Definition: CMenuSite.cpp:273
STDMETHOD() SetBandSiteInfo(const BANDSITEINFO *pbsinfo) override
Definition: CMenuSite.cpp:329
virtual ~CMenuSite()
Definition: CMenuSite.h:43
STDMETHOD() GetWindow(HWND *phwnd) override
Definition: CMenuSite.cpp:149
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
IUnknown * ToIUnknown()
Definition: CMenuSite.h:106
STDMETHOD() RemoveBand(DWORD dwBandID) override
Definition: CMenuSite.cpp:324
STDMETHOD() SetModeDBC(DWORD dwMode) override
Definition: CMenuSite.cpp:339
HWND m_hWndBand
Definition: CMenuSite.h:39
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
STDMETHOD() QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName) override
Definition: CMenuSite.cpp:107
STDMETHOD() OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus) override
Definition: CMenuSite.cpp:354
STDMETHOD() AddBand(IUnknown *punk) override
Definition: CMenuSite.cpp:36
STDMETHOD() IsWindowOwner(HWND hWnd) override
Definition: CMenuSite.cpp:159
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
STDMETHOD() Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
Definition: CMenuSite.cpp:198
STDMETHOD() TranslateAcceleratorIO(LPMSG lpMsg) override
Definition: CMenuSite.cpp:344
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
struct IOleCommandTarget::_tagOLECMDTEXT OLECMDTEXT
struct IOleCommandTarget::_tagOLECMD OLECMD
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:2004
static HKEY override
Definition: compobj.c:81
unsigned int UINT
Definition: ndis.h:50
_Out_ LPRECT prc
Definition: ntgdi.h:1658
const GUID IID_IOleWindow
#define REFIID
Definition: guiddef.h:118
#define IDR_MENUBANDSITE
Definition: shresdef.h:892
Definition: scsiwmi.h:51
uint32_t ULONG
Definition: typedefs.h:59
#define _T(x)
Definition: vfdio.h:22
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define COLOR_MENU
Definition: winuser.h:917
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define const
Definition: zconf.h:233