ReactOS 0.4.16-dev-197-g92996da
CMenuToolbars.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
22class CMenuBand;
24
25#define WM_USER_ISTRACKEDITEM (WM_APP+41)
26#define WM_USER_CHANGETRACKEDITEM (WM_APP+42)
27
29 public CWindowImplBaseT< CToolbar<DWORD_PTR>, CControlWinTraits >
30{
31 CContainedWindow m_pager;
32private:
37
38protected:
49
52
56
58
59public:
60 CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager);
61 virtual ~CMenuToolbarBase();
62
65 HRESULT GetWindow(HWND *phwnd);
66 HRESULT ShowDW(BOOL fShow);
67 HRESULT Close();
68
70
73
74 HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu* childShellMenu, BOOL keyInitiated);
75 HRESULT PopupSubMenu(UINT itemId, UINT index, HMENU menu);
77
79
82
83 HRESULT GetSizes(SIZE* pMinSize, SIZE* pMaxSize, SIZE* pIntegralSize);
84 HRESULT SetPosSize(int x, int y, int cx, int cy);
85
86 void InvalidateDraw();
87
89
90 virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) = 0;
91
93 HRESULT PopupItem(INT iItem, BOOL keyInitiated);
95
97
98 HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton);
99 HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton);
100 HRESULT ProcessClick(INT iItem);
103
104protected:
106
107 virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) PURE;
112
113 HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last);
117
118 HWND GetToolbar() { return m_hWnd; }
119
120private:
122
124 HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult);
126
131
139};
140
142 public CMenuToolbarBase
143{
144private:
147
148public:
149 CMenuStaticToolbar(CMenuBand *menuBand);
150 virtual ~CMenuStaticToolbar();
151
153 HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
154
155 virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override;
156
157protected:
158 virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb) override;
159
160 virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override;
161 virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override;
162 virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override;
163 virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override;
164 virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override;
165};
166
168 public CMenuToolbarBase
169{
170private:
171 CComPtr<IShellFolder> m_shellFolder;
174
175public:
176 CMenuSFToolbar(CMenuBand *menuBand);
177 virtual ~CMenuSFToolbar();
178
180 HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
181
182 virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override;
183
184protected:
185 virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb) override;
186
187 virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override;
188 virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override;
189 virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override;
190 virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override;
191 virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override;
192};
#define WM_USER_CHANGETRACKEDITEM
Definition: CMenuToolbars.h:26
#define WM_USER_ISTRACKEDITEM
Definition: CMenuToolbars.h:25
HWND hWnd
Definition: settings.c:17
#define PURE
Definition: basetyps.h:64
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override
HRESULT SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override
HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)
virtual ~CMenuSFToolbar()
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) override
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override
LPCITEMIDLIST m_idList
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override
CComPtr< IShellFolder > m_shellFolder
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) override
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) override
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
virtual ~CMenuStaticToolbar()
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) override
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE) override
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) override
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
HRESULT UpdateImageLists()
HRESULT GetSizes(SIZE *pMinSize, SIZE *pMaxSize, SIZE *pIntegralSize)
LRESULT ChangeTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
DWORD_PTR m_executeData
Definition: CMenuToolbars.h:55
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
HRESULT AddPlaceholder()
LRESULT OnWinEventWrap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT KillPopupTimer()
HRESULT ProcessContextMenu(INT iItem)
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) PURE
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb) PURE
HRESULT CancelCurrentPopup()
LRESULT IsTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT KeyboardItemChange(DWORD changeType)
HRESULT IsWindowOwner(HWND hwnd)
HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
HRESULT ChangePopupItem(CMenuToolbarBase *toolbar, INT item)
HRESULT OnGetInfoTip(NMTBGETINFOTIP *tip)
HRESULT DisableMouseTrack(BOOL bDisable)
virtual ~CMenuToolbarBase()
HRESULT PrepareExecuteItem(INT iItem)
HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton)
HRESULT ShowDW(BOOL fShow)
HRESULT TrackContextMenu(IContextMenu *contextMenu, POINT pt)
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags)
HRESULT ProcessClick(INT iItem)
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) PURE
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton)
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
HRESULT SetPosSize(int x, int y, int cx, int cy)
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE)=0
HRESULT OnPopupTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT ChangeHotItem(CMenuToolbarBase *toolbar, INT item, DWORD dwFlags)
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize)
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) PURE
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) PURE
HRESULT GetWindow(HWND *phwnd)
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
HRESULT BeforeCancelPopup()
HRESULT AddSeparator(BOOL last)
HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt) PURE
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static HWND hwndParent
Definition: cryptui.c:300
#define FALSE
Definition: types.h:117
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint index
Definition: glext.h:6031
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define END_MSG_MAP()
Definition: atlwin.h:1917
static UINT UINT last
Definition: font.c:45
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static HANDLE ULONG_PTR dwData
Definition: file.c:35
static const WCHAR tb[]
Definition: suminfo.c:285
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static ATOM item
Definition: dde.c:856
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
unsigned int UINT
Definition: ndis.h:50
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define NMTBGETINFOTIP
Definition: commctrl.h:1393
_Out_opt_ int * cx
Definition: commctrl.h:585
#define NMTOOLBAR
Definition: commctrl.h:1456
#define REFIID
Definition: guiddef.h:118
#define WM_NOTIFY
Definition: richedit.h:61
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint32_t DWORD_PTR
Definition: typedefs.h:65
int32_t INT
Definition: typedefs.h:58
static HMENU hmenu
Definition: win.c:66
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_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
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_TIMER
Definition: winuser.h:1745
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185