ReactOS  0.4.13-dev-687-g023794c
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 
22 class CMenuToolbarBase;
23 class CMenuStaticToolbar;
24 class CMenuSFToolbar;
25 class CMenuFocusManager;
26 
27 class 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 {
42 private:
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 
75 public:
76  CMenuBand();
77  virtual ~CMenuBand();
78 
82 
84  COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
85  COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu)
86  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
88  COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
89  COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
91  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
94  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
95  COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
96  COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand)
97  COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2)
98  COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
99  COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc)
100  END_COM_MAP()
101 
102  // *** IDeskBand methods ***
103  virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
104 
105  // *** IDockingWindow methods ***
106  virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
108  virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
109 
110  // *** IOleWindow methods ***
111  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
113 
114  // *** IObjectWithSite methods ***
115  virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
116  virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
117 
118  // *** IInputObject methods ***
119  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
122 
123  // *** IPersistStream methods ***
125  virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
126  virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
128 
129  // *** IPersist methods ***
130  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
131 
132  // *** IOleCommandTarget methods ***
133  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
134  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
135 
136  // *** IServiceProvider methods ***
137  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
138 
139  // *** IMenuPopup methods ***
140  virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
141  virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
142  virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
143 
144  // *** IDeskBar methods ***
145  virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
146  virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
148 
149  // *** IMenuBand methods ***
152 
153  // *** IShellMenu methods ***
154  virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags);
155  virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags);
157  virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
159  virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
163 
164  // *** IWinEventHandler methods ***
167 
168  // *** IShellMenu2 methods ***
174 
175  // *** IShellMenuAcc methods ***
183 
186  HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT& rcExclude);
188  HRESULT _GetTopLevelWindow(HWND*topLevel);
191  HRESULT _MenuItemSelect(DWORD changeType);
193  HRESULT _OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RECTL * pExclude, BOOL mouseInitiated);
195  HRESULT _DisableMouseTrack(BOOL bDisable);
198  HRESULT _IsPopup();
204 
205  HRESULT AdjustForTheme(BOOL bFlatStyle);
206 
208  {
209  return m_useBigIcons;
210  }
211 
212 private:
215 };
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
HWND m_topLevelWindow
Definition: CMenuBand.h:62
HRESULT _BeforeCancelPopup()
Definition: CMenuBand.cpp:1101
HRESULT _CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam, UINT id=0, LPITEMIDLIST pidl=NULL)
Definition: CMenuBand.cpp:778
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize)
Definition: CMenuBand.cpp:1294
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define REFIID
Definition: guiddef.h:118
HWND m_menuOwner
Definition: CMenuBand.h:59
HMENU m_hmenu
Definition: CMenuBand.h:58
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
Definition: CMenuBand.cpp:342
virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS)
Definition: CMenuBand.cpp:1203
virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
Definition: CMenuBand.cpp:176
static HMENU hmenu
Definition: win.c:66
Definition: scsiwmi.h:51
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite)
Definition: CMenuBand.cpp:251
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
Definition: CMenuBand.cpp:542
#define THIS
Definition: basetyps.h:66
HRESULT _KeyboardItemChange(DWORD change)
Definition: CMenuBand.cpp:911
virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd)
Definition: CMenuBand.cpp:1167
REFIID riid
Definition: precomp.h:44
INT m_popupItem
Definition: CMenuBand.h:67
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:874
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm)
Definition: CMenuBand.cpp:1282
const GUID IID_IPersist
Definition: proxy.cpp:14
CMenuStaticToolbar * m_staticToolbar
Definition: CMenuBand.h:44
BOOL m_shellBottom
Definition: CMenuBand.h:70
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
Definition: CMenuBand.cpp:1263
virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS)
Definition: CMenuBand.cpp:1251
CComPtr< IOleWindow > m_site
Definition: CMenuBand.h:47
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
UINT_PTR WPARAM
Definition: windef.h:207
virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags)
Definition: CMenuBand.cpp:91
CComPtr< IShellMenuCallback > m_psmc
Definition: CMenuBand.h:48
HRESULT _CancelCurrentPopup()
Definition: CMenuBand.cpp:1038
int32_t INT
Definition: typedefs.h:56
static HWND child
Definition: cursoricon.c:298
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow)
Definition: CMenuBand.cpp:391
WPARAM wParam
Definition: combotst.c:138
DWORD Id
virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS)
Definition: CMenuBand.cpp:1257
HRESULT _KillPopupTimers()
Definition: CMenuBand.cpp:1119
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define IDR_MENUBAND
Definition: shresdef.h:805
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID m_UserData
Definition: CMenuBand.h:57
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:880
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc)
Definition: CMenuBand.cpp:272
HRESULT _MenuBarMouseUp(HWND hwnd, INT item, BOOL isLButton)
Definition: CMenuBand.cpp:1142
virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags)
Definition: CMenuBand.cpp:1161
smooth NULL
Definition: ftsmooth.c:416
virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
Definition: CMenuBand.cpp:683
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT _SetChildBand(CMenuBand *child)
Definition: CMenuBand.cpp:603
BOOL m_useBigIcons
Definition: CMenuBand.h:61
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved)
Definition: CMenuBand.cpp:443
virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg)
Definition: CMenuBand.cpp:665
UINT m_uIdAncestor
Definition: CMenuBand.h:55
HRESULT _OnPopupSubMenu(IShellMenu *childShellMenu, POINTL *pAt, RECTL *pExclude, BOOL mouseInitiated)
Definition: CMenuBand.cpp:1055
HRESULT _CallCBWithItemPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:773
virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS)
Definition: CMenuBand.cpp:1239
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
Definition: CMenuBand.cpp:724
CComPtr< CMenuBand > m_childBand
Definition: CMenuBand.h:51
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
HRESULT _ChangePopupItem(CMenuToolbarBase *tb, INT id)
Definition: CMenuBand.cpp:899
r parent
Definition: btrfs.c:2708
BOOL UseBigIcons()
Definition: CMenuBand.h:207
HRESULT _DisableMouseTrack(BOOL bDisable)
Definition: CMenuBand.cpp:1110
LONG HRESULT
Definition: typedefs.h:77
virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS)
Definition: CMenuBand.cpp:1233
virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
Definition: CMenuBand.cpp:717
HRESULT _TrackContextMenu(IContextMenu *popup, INT x, INT y)
Definition: CMenuBand.cpp:821
virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
Definition: CMenuBand.cpp:118
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd)
Definition: CMenuBand.cpp:757
BOOL m_Show
Definition: CMenuBand.h:69
HWND m_trackedHwnd
Definition: CMenuBand.h:73
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
Definition: CMenuBand.cpp:552
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
const IID IID_IObjectWithSite
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR tb[]
Definition: suminfo.c:286
CMenuToolbarBase * m_popupBar
Definition: CMenuBand.h:66
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
Definition: CMenuBand.cpp:1185
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
Definition: CMenuBand.cpp:1179
const GUID IID_IPersistStream
Definition: proxy.cpp:13
CComPtr< CMenuBand > m_parentBand
Definition: CMenuBand.h:52
virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS)
Definition: CMenuBand.cpp:1215
virtual HRESULT STDMETHODCALLTYPE GetTop(THIS)
Definition: CMenuBand.cpp:1221
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
DWORD m_dwFlags
Definition: CMenuBand.h:56
HRESULT _SetParentBand(CMenuBand *parent)
Definition: CMenuBand.cpp:614
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
INT m_hotItem
Definition: CMenuBand.h:65
UINT m_uId
Definition: CMenuBand.h:54
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient)
Definition: CMenuBand.cpp:650
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
Definition: CMenuBand.cpp:476
HRESULT _IsPopup()
Definition: CMenuBand.cpp:620
CComPtr< IMenuPopup > m_subMenuParent
Definition: CMenuBand.h:50
CComPtr< IMenuPopup > m_subMenuChild
Definition: CMenuBand.h:49
virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet)
Definition: CMenuBand.cpp:670
HRESULT AdjustForTheme(BOOL bFlatStyle)
Definition: CMenuBand.cpp:1156
virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS)
Definition: CMenuBand.cpp:1227
HRESULT _HasSubMenu()
Definition: CMenuBand.cpp:1151
virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS)
Definition: CMenuBand.cpp:1197
HMENU m_trackedPopup
Definition: CMenuBand.h:72
static ATOM item
Definition: dde.c:856
HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT &rcExclude)
Definition: CMenuBand.cpp:800
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty)
Definition: CMenuBand.cpp:1288
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet)
Definition: CMenuBand.cpp:596
HRESULT _IsTracking()
Definition: CMenuBand.cpp:625
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
Definition: CMenuBand.cpp:1306
const GUID IID_IOleWindow
unsigned int ULONG
Definition: retypes.h:1
#define const
Definition: zconf.h:230
virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor, DWORD dwFlags)
Definition: CMenuBand.cpp:71
virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS)
Definition: CMenuBand.cpp:1209
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: CMenuBand.cpp:506
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
Definition: CMenuBand.cpp:1300
virtual ~CMenuBand()
Definition: CMenuBand.cpp:60
HRESULT _MenuBarMouseDown(HWND hwnd, INT item, BOOL isLButton)
Definition: CMenuBand.cpp:1133
#define END_COM_MAP()
Definition: atlcom.h:552
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd)
Definition: CMenuBand.cpp:259
LONG_PTR LRESULT
Definition: windef.h:209
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType)
Definition: CMenuBand.cpp:558
_Out_ LPRECT prc
Definition: ntgdi.h:1658
virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags)
Definition: CMenuBand.cpp:1173
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
int MP_POPUPFLAGS
Definition: shobjidl.idl:2486
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
CMenuSFToolbar * m_SFToolbar
Definition: CMenuBand.h:45
CMenuFocusManager * m_focusManager
Definition: CMenuBand.h:43
LPARAM lParam
Definition: combotst.c:139
virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS)
Definition: CMenuBand.cpp:1191
virtual HRESULT STDMETHODCALLTYPE IsDirty()
Definition: CMenuBand.cpp:1276
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
Definition: CMenuBand.cpp:1270
CMenuToolbarBase * m_hotBar
Definition: CMenuBand.h:64
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient)
Definition: CMenuBand.cpp:630
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
Definition: CMenuBand.cpp:187
HRESULT _MenuItemSelect(DWORD changeType)
Definition: CMenuBand.cpp:954