ReactOS 0.4.15-dev-7704-gc07eb9f
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 virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD* pdwBandID);
64 virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName);
66
67 // IDeskBarClient
71
72 // IOleWindow
74
75 // IOleCommandTarget
76 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
77 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID * pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
78
79 // IInputObject
80 virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
83
84 // IInputObjectSite
85 virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
86
87 // IWinEventHandler
90
91 // IServiceProvider
93
94
95 // Using custom message map instead
96 virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId = 0);
97
98 // UNIMPLEMENTED
101 virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
103 virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
105
106private:
107 IUnknown * ToIUnknown() { return static_cast<IDeskBarClient*>(this); }
108};
HWND hWnd
Definition: settings.c:17
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
Definition: CMenuSite.cpp:107
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
Definition: CMenuSite.cpp:204
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus)
Definition: CMenuSite.cpp:354
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CMenuSite.cpp:178
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: CMenuSite.cpp:198
virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
Definition: CMenuSite.cpp:96
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState)
Definition: CMenuSite.cpp:257
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
Definition: CMenuSite.cpp:314
virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID)
Definition: CMenuSite.cpp:324
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
Definition: CMenuSite.cpp:265
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite)
Definition: CMenuSite.cpp:210
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
Definition: CMenuSite.cpp:170
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
Definition: CMenuSite.cpp:329
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc)
Definition: CMenuSite.cpp:128
virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId=0)
Definition: CMenuSite.cpp:273
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd)
Definition: CMenuSite.cpp:149
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd)
Definition: CMenuSite.cpp:159
virtual ~CMenuSite()
Definition: CMenuSite.h:43
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
IUnknown * ToIUnknown()
Definition: CMenuSite.h:107
virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
Definition: CMenuSite.cpp:334
HWND m_hWndBand
Definition: CMenuSite.h:39
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo)
Definition: CMenuSite.cpp:319
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
Definition: CMenuSite.cpp:349
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
Definition: CMenuSite.cpp:344
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID)
Definition: CMenuSite.cpp:86
virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk)
Definition: CMenuSite.cpp:36
virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode)
Definition: CMenuSite.cpp:339
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
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:876
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:916
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define const
Definition: zconf.h:233