ReactOS  0.4.14-dev-1256-g2125fec
CMenuDeskBar.h
Go to the documentation of this file.
1 /*
2 * Shell Menu Desk Bar
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 typedef CWinTraits<
26 
27 class CMenuDeskBar :
28  public CComCoClass<CMenuDeskBar, &CLSID_MenuDeskBar>,
29  public CComObjectRootEx<CComMultiThreadModelNoCS>,
30  public CWindowImpl<CMenuDeskBar, CWindow, CMenuWinTraits>,
31  public IOleCommandTarget,
32  public IServiceProvider,
33  public IInputObjectSite,
34  public IInputObject,
35  public IMenuPopup,
36  public IObjectWithSite,
37  public IBanneredBar,
38  public IInitializeObject
39 {
40 private:
41  CComPtr<IUnknown> m_Site;
42  CComPtr<IUnknown> m_Client;
43  CComPtr<IMenuPopup> m_SubMenuParent;
44  CComPtr<IMenuPopup> m_SubMenuChild;
45 
47 
50 
53 
55 
56  virtual void OnFinalMessage(HWND hWnd);
57 public:
58  CMenuDeskBar();
59  virtual ~CMenuDeskBar();
60 
64 
66 
78  END_MSG_MAP()
79 
81  COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
82  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
83  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
84  COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
85  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
86  COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
89  COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar)
90  COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject)
91  END_COM_MAP()
92 
93  // *** IMenuPopup methods ***
94  virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
95  virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
97 
98  // *** IOleWindow methods ***
99  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
101 
102  // *** IObjectWithSite methods ***
103  virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
104  virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
105 
106  // *** IBanneredBar methods ***
108  virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD* piIcon);
110  virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP* phBitmap);
111 
112  // *** IInitializeObject methods ***
114 
115  // *** IOleCommandTarget methods ***
116  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
117  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
118 
119  // *** IServiceProvider methods ***
120  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
121 
122  // *** IInputObjectSite methods ***
123  virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus);
124 
125  // *** IInputObject methods ***
126  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg);
129 
130  // *** IDeskBar methods ***
131  virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
132  virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
134 
135 private:
136  // message handlers
137  LRESULT _OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
138  LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
139  LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
140  LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
141  LRESULT _OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
145  LRESULT _OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
146  LRESULT _OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
147 
148  HRESULT _AdjustForTheme(BOOL bFlatStyle);
150  HRESULT _CloseBar();
151 };
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
CComPtr< IMenuPopup > m_SubMenuChild
Definition: CMenuDeskBar.h:44
LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
CWinTraits< WS_POPUP|WS_DLGFRAME|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, WS_EX_LEFT|WS_EX_LTRREADING|WS_EX_RIGHTSCROLLBAR|WS_EX_PALETTEWINDOW > CMenuWinTraits
Definition: CMenuDeskBar.h:25
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL _IsSubMenuParent(HWND hwnd)
#define REFIID
Definition: guiddef.h:118
virtual HRESULT STDMETHODCALLTYPE Initialize(THIS)
Definition: scsiwmi.h:51
#define CS_DROPSHADOW
Definition: winuser.h:655
#define THIS
Definition: basetyps.h:66
#define WS_EX_LTRREADING
Definition: winuser.h:393
REFIID riid
Definition: precomp.h:44
#define WS_EX_PALETTEWINDOW
Definition: winuser.h:399
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:1876
HWND hWnd
Definition: settings.c:17
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
#define WS_DLGFRAME
Definition: pedump.c:626
virtual HRESULT STDMETHODCALLTYPE GetBitmap(HBITMAP *phBitmap)
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient)
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT _OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual void OnFinalMessage(HWND hWnd)
LRESULT _OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
HRESULT _CloseBar()
WPARAM wParam
Definition: combotst.c:138
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
virtual ~CMenuDeskBar()
LRESULT _OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define WM_NCPAINT
Definition: winuser.h:1669
#define COLOR_3DFACE
Definition: winuser.h:919
virtual HRESULT STDMETHODCALLTYPE SetIconSize(DWORD iIcon)
virtual HRESULT STDMETHODCALLTYPE GetIconSize(DWORD *piIcon)
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
LRESULT _OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define IDR_MENUDESKBAR
Definition: shresdef.h:822
#define WM_WININICHANGE
Definition: winuser.h:1612
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT _AdjustForTheme(BOOL bFlatStyle)
#define WM_MOUSEACTIVATE
Definition: winuser.h:1619
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite)
#define WS_EX_LEFT
Definition: winuser.h:391
LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient)
#define _T(x)
Definition: vfdio.h:22
CComPtr< IMenuPopup > m_SubMenuParent
Definition: CMenuDeskBar.h:43
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType)
#define WM_SIZE
Definition: winuser.h:1593
LONG HRESULT
Definition: typedefs.h:78
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
#define END_MSG_MAP()
Definition: atlwin.h:1789
#define WM_CLOSE
Definition: winuser.h:1603
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
const IID IID_IObjectWithSite
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_PAINT
Definition: winuser.h:1602
#define CS_SAVEBITS
Definition: winuser.h:652
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc)
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
LRESULT _OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual HRESULT STDMETHODCALLTYPE SetBitmap(HBITMAP hBitmap)
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
HWND m_ClientWindow
Definition: CMenuDeskBar.h:46
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet)
virtual HRESULT STDMETHODCALLTYPE HasFocusIO(THIS)
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define WM_ACTIVATE
Definition: winuser.h:1594
LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
DWORD m_ShowFlags
Definition: CMenuDeskBar.h:52
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd)
LRESULT _OnWinIniChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg)
BOOL m_didAddRef
Definition: CMenuDeskBar.h:54
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1770
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1798
#define WM_CREATE
Definition: winuser.h:1590
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(LPUNKNOWN lpUnknown, BOOL bFocus)
const GUID IID_IOleWindow
unsigned int ULONG
Definition: retypes.h:1
#define const
Definition: zconf.h:230
static HBITMAP
Definition: button.c:44
LRESULT _OnAppActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define END_COM_MAP()
Definition: atlcom.h:552
DWORD m_IconSize
Definition: CMenuDeskBar.h:48
LONG_PTR LRESULT
Definition: windef.h:209
_Out_ LPRECT prc
Definition: ntgdi.h:1658
int MP_POPUPFLAGS
Definition: shobjidl.idl:2491
static HBITMAP hBitmap
Definition: timezone.c:35
LPARAM lParam
Definition: combotst.c:139
CComPtr< IUnknown > m_Site
Definition: CMenuDeskBar.h:41
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42
#define WM_NOTIFY
Definition: richedit.h:61