ReactOS 0.4.15-dev-7942-gd23573b
CMenuBand.h
Go to the documentation of this file.
1/*
2* Shell Menu Band
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
24class CMenuSFToolbar;
26
27class CMenuBand :
28 public CComCoClass<CMenuBand, &CLSID_MenuBand>,
29 public CComObjectRootEx<CComMultiThreadModelNoCS>,
30 public IDeskBand,
31 public IObjectWithSite,
32 public IInputObject,
33 public IPersistStream,
34 public IOleCommandTarget,
35 public IServiceProvider,
36 public IMenuPopup,
37 public IMenuBand,
38 public IShellMenu2,
39 public IWinEventHandler,
40 public IShellMenuAcc
41{
42private:
46
47 CComPtr<IOleWindow> m_site;
48 CComPtr<IShellMenuCallback> m_psmc;
49 CComPtr<IMenuPopup> m_subMenuChild;
50 CComPtr<IMenuPopup> m_subMenuParent;
51 CComPtr<CMenuBand> m_childBand;
52 CComPtr<CMenuBand> m_parentBand;
53
60
63
68
71
74
75public:
76 CMenuBand();
77 virtual ~CMenuBand();
78
82
85 COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu)
86 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
88 COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
91 COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
94 COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
95 COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
97 COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2)
98 COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
99 COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc)
101
102 // *** IDeskBand methods ***
103 STDMETHOD(GetBandInfo)(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override;
104
105 // *** IDockingWindow methods ***
108 STDMETHOD(ResizeBorderDW)(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) override;
109
110 // *** IOleWindow methods ***
113
114 // *** IObjectWithSite methods ***
117
118 // *** IInputObject methods ***
119 STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg) override;
122
123 // *** IPersistStream methods ***
126 STDMETHOD(Save)(IStream *pStm, BOOL fClearDirty) override;
128
129 // *** IPersist methods ***
131
132 // *** IOleCommandTarget methods ***
133 STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText) override;
134 STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override;
135
136 // *** IServiceProvider methods ***
138
139 // *** IMenuPopup methods ***
141 STDMETHOD(OnSelect)(DWORD dwSelectType) override;
143
144 // *** IDeskBar methods ***
145 STDMETHOD(SetClient)(IUnknown *punkClient) override;
146 STDMETHOD(GetClient)(IUnknown **ppunkClient) override;
148
149 // *** IMenuBand methods ***
152
153 // *** IShellMenu methods ***
155 STDMETHOD(GetMenuInfo)(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags) override;
157 STDMETHOD(GetShellFolder)(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv) override;
159 STDMETHOD(GetMenu)(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags) override;
163
164 // *** IWinEventHandler methods ***
167
168 // *** IShellMenu2 methods ***
174
175 // *** IShellMenuAcc methods ***
183
186 HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT& rcExclude);
191 HRESULT _MenuItemSelect(DWORD changeType);
193 HRESULT _OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RECTL * pExclude, BOOL mouseInitiated);
204
205 HRESULT AdjustForTheme(BOOL bFlatStyle);
206
208 {
209 return m_useBigIcons;
210 }
211
212private:
215};
DWORD Id
HWND hWnd
Definition: settings.c:17
#define THIS
Definition: basetyps.h:66
#define STDMETHOD(m)
Definition: basetyps.h:62
HRESULT _CallCBWithItemPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:773
STDMETHOD() InvalidateItem(LPSMDATA psmd, DWORD dwFlags) override
Definition: CMenuBand.cpp:1160
STDMETHOD() SetMinWidth(THIS) override
Definition: CMenuBand.cpp:1202
HRESULT _IsPopup()
Definition: CMenuBand.cpp:620
STDMETHOD() UIActivateIO(BOOL fActivate, LPMSG lpMsg) override
Definition: CMenuBand.cpp:476
STDMETHOD() OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override
Definition: CMenuBand.cpp:724
STDMETHOD() IsWindowOwner(HWND hWnd) override
Definition: CMenuBand.cpp:757
STDMETHOD() OnSelect(DWORD dwSelectType) override
Definition: CMenuBand.cpp:558
HRESULT _OnPopupSubMenu(IShellMenu *childShellMenu, POINTL *pAt, RECTL *pExclude, BOOL mouseInitiated)
Definition: CMenuBand.cpp:1054
HWND m_trackedHwnd
Definition: CMenuBand.h:73
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:873
STDMETHOD() DoDefaultAction(THIS) override
Definition: CMenuBand.cpp:1250
STDMETHOD() GetSubMenu(THIS) override
Definition: CMenuBand.cpp:1190
STDMETHOD() HasFocusIO() override
Definition: CMenuBand.cpp:1262
STDMETHOD() SetClient(IUnknown *punkClient) override
Definition: CMenuBand.cpp:630
STDMETHOD() GetSizeMax(ULARGE_INTEGER *pcbSize) override
Definition: CMenuBand.cpp:1293
CMenuSFToolbar * m_SFToolbar
Definition: CMenuBand.h:45
CMenuFocusManager * m_focusManager
Definition: CMenuBand.h:43
HRESULT _TrackContextMenu(IContextMenu *popup, INT x, INT y)
Definition: CMenuBand.cpp:821
HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT &rcExclude)
Definition: CMenuBand.cpp:800
STDMETHOD() QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
Definition: CMenuBand.cpp:1305
STDMETHOD() TranslateMenuMessage(MSG *pmsg, LRESULT *plRet) override
Definition: CMenuBand.cpp:670
STDMETHOD() QueryService(REFGUID guidService, REFIID riid, void **ppvObject) override
Definition: CMenuBand.cpp:542
PVOID m_UserData
Definition: CMenuBand.h:57
UINT m_uIdAncestor
Definition: CMenuBand.h:55
BOOL UseBigIcons()
Definition: CMenuBand.h:207
CMenuToolbarBase * m_popupBar
Definition: CMenuBand.h:66
STDMETHOD() GetSite(REFIID riid, PVOID *ppvSite) override
Definition: CMenuBand.cpp:251
STDMETHOD() ShowDW(BOOL fShow) override
Definition: CMenuBand.cpp:391
STDMETHOD() TranslateAcceleratorIO(LPMSG lpMsg) override
Definition: CMenuBand.cpp:1269
HRESULT _DisableMouseTrack(BOOL bDisable)
Definition: CMenuBand.cpp:1109
CComPtr< IMenuPopup > m_subMenuChild
Definition: CMenuBand.h:49
HRESULT _KillPopupTimers()
Definition: CMenuBand.cpp:1118
STDMETHOD() GetTop(THIS) override
Definition: CMenuBand.cpp:1220
HRESULT _MenuItemSelect(DWORD changeType)
Definition: CMenuBand.cpp:953
HWND m_menuOwner
Definition: CMenuBand.h:59
HRESULT _MenuBarMouseUp(HWND hwnd, INT item, BOOL isLButton)
Definition: CMenuBand.cpp:1141
STDMETHOD() GetParentSite(THIS) override
Definition: CMenuBand.cpp:1238
CComPtr< IOleWindow > m_site
Definition: CMenuBand.h:47
BOOL m_Show
Definition: CMenuBand.h:69
HRESULT _SetParentBand(CMenuBand *parent)
Definition: CMenuBand.cpp:614
UINT m_uId
Definition: CMenuBand.h:54
STDMETHOD() SetToolbar(THIS) override
Definition: CMenuBand.cpp:1196
STDMETHOD() SetTheme(THIS) override
Definition: CMenuBand.cpp:1214
DWORD m_dwFlags
Definition: CMenuBand.h:56
STDMETHOD() ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) override
Definition: CMenuBand.cpp:1178
CComPtr< CMenuBand > m_childBand
Definition: CMenuBand.h:51
STDMETHOD() GetClassID(CLSID *pClassID) override
Definition: CMenuBand.cpp:1299
CComPtr< CMenuBand > m_parentBand
Definition: CMenuBand.h:52
HRESULT _CancelCurrentPopup()
Definition: CMenuBand.cpp:1037
STDMETHOD() SetSite(IUnknown *pUnkSite) override
Definition: CMenuBand.cpp:187
HMENU m_trackedPopup
Definition: CMenuBand.h:72
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
STDMETHOD() SetNoBorder(THIS) override
Definition: CMenuBand.cpp:1208
STDMETHOD() OnPosRectChangeDB(RECT *prc) override
Definition: CMenuBand.cpp:272
STDMETHOD() CloseDW(DWORD dwReserved) override
Definition: CMenuBand.cpp:443
CComPtr< IShellMenuCallback > m_psmc
Definition: CMenuBand.h:48
STDMETHOD() GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags) override
Definition: CMenuBand.cpp:176
HMENU m_hmenu
Definition: CMenuBand.h:58
HRESULT _KeyboardItemChange(DWORD change)
Definition: CMenuBand.cpp:910
INT m_hotItem
Definition: CMenuBand.h:65
STDMETHOD() GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override
Definition: CMenuBand.cpp:342
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:879
HWND m_topLevelWindow
Definition: CMenuBand.h:62
HRESULT _CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam, UINT id=0, LPITEMIDLIST pidl=NULL)
Definition: CMenuBand.cpp:778
STDMETHOD() ContextSensitiveHelp(BOOL fEnterMode) override
Definition: CMenuBand.cpp:1184
STDMETHOD() SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags) override
Definition: CMenuBand.cpp:683
STDMETHOD() SetSubMenu(IMenuPopup *pmp, BOOL fSet) override
Definition: CMenuBand.cpp:596
STDMETHOD() Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
Definition: CMenuBand.cpp:506
HRESULT _SetChildBand(CMenuBand *child)
Definition: CMenuBand.cpp:603
STDMETHOD() SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags) override
Definition: CMenuBand.cpp:118
HRESULT AdjustForTheme(BOOL bFlatStyle)
Definition: CMenuBand.cpp:1155
HRESULT _IsTracking()
Definition: CMenuBand.cpp:625
CComPtr< IMenuPopup > m_subMenuParent
Definition: CMenuBand.h:50
STDMETHOD() GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv) override
Definition: CMenuBand.cpp:717
STDMETHOD() GetBottom(THIS) override
Definition: CMenuBand.cpp:1226
HRESULT _MenuBarMouseDown(HWND hwnd, INT item, BOOL isLButton)
Definition: CMenuBand.cpp:1132
STDMETHOD() GetTracked(THIS) override
Definition: CMenuBand.cpp:1232
HRESULT _HasSubMenu()
Definition: CMenuBand.cpp:1150
STDMETHOD() Save(IStream *pStm, BOOL fClearDirty) override
Definition: CMenuBand.cpp:1287
STDMETHOD() GetClient(IUnknown **ppunkClient) override
Definition: CMenuBand.cpp:650
INT m_popupItem
Definition: CMenuBand.h:67
CMenuToolbarBase * m_hotBar
Definition: CMenuBand.h:64
CMenuStaticToolbar * m_staticToolbar
Definition: CMenuBand.h:44
BOOL m_shellBottom
Definition: CMenuBand.h:70
STDMETHOD() GetWindow(HWND *phwnd) override
Definition: CMenuBand.cpp:259
BOOL m_useBigIcons
Definition: CMenuBand.h:61
STDMETHOD() IsMenuMessage(MSG *pmsg) override
Definition: CMenuBand.cpp:665
HRESULT _ChangePopupItem(CMenuToolbarBase *tb, INT id)
Definition: CMenuBand.cpp:898
STDMETHOD() Load(IStream *pStm) override
Definition: CMenuBand.cpp:1281
STDMETHOD() GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags) override
Definition: CMenuBand.cpp:91
virtual ~CMenuBand()
Definition: CMenuBand.cpp:60
STDMETHOD() SetMenuToolbar(IUnknown *punk, DWORD dwFlags) override
Definition: CMenuBand.cpp:1172
STDMETHOD() IsDirty() override
Definition: CMenuBand.cpp:1275
HRESULT _BeforeCancelPopup()
Definition: CMenuBand.cpp:1100
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
@ Popup
Definition: console.h:35
@ IsEmpty
Definition: atl_ax.c:995
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
return pTarget GetState()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
int MP_POPUPFLAGS
Definition: shobjidl.idl:2535
#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
const IID IID_IObjectWithSite
static const WCHAR tb[]
Definition: suminfo.c:285
static HKEY override
Definition: compobj.c:81
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static HWND child
Definition: cursoricon.c:298
static ATOM item
Definition: dde.c:856
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
unsigned int UINT
Definition: ndis.h:50
_Out_ LPRECT prc
Definition: ntgdi.h:1658
const GUID IID_IOleWindow
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define REFIID
Definition: guiddef.h:118
#define IDR_MENUBAND
Definition: shresdef.h:901
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
Definition: scsiwmi.h:51
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
static HMENU hmenu
Definition: win.c:66
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
static void Initialize()
Definition: xlate.c:212
#define const
Definition: zconf.h:233