ReactOS  0.4.13-dev-1089-g05f0b08
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 
22 class CMenuBand;
23 class CMenuFocusManager;
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 {
32 private:
37 
38 protected:
49 
52 
56 
58 
59 public:
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 
78  HRESULT KeyboardItemChange(DWORD changeType);
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 
88  HRESULT DisableMouseTrack(BOOL bDisable);
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 
104 protected:
105  virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb) = 0;
106 
107  virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) = 0;
108  virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData) = 0;
109  virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) = 0;
110  virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData) = 0;
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 
120 private:
122 
124  HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult);
126 
130  HRESULT OnPopupTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
131 
138  END_MSG_MAP()
139 };
140 
142  public CMenuToolbarBase
143 {
144 private:
147 
148 public:
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);
156 
157 protected:
158  virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb);
159 
160  virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax);
162  virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated);
165 };
166 
168  public CMenuToolbarBase
169 {
170 private:
171  CComPtr<IShellFolder> m_shellFolder;
174 
175 public:
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);
183 
184 protected:
185  virtual HRESULT OnDeletingButton(const NMTOOLBAR * tb);
186 
187  virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax);
189  virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated);
192 };
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager)
#define WM_USER_ISTRACKEDITEM
Definition: CMenuToolbars.h:25
HRESULT AddPlaceholder()
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE)=0
HRESULT AddSeparator(BOOL last)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT ProcessClick(INT iItem)
HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
#define REFIID
Definition: guiddef.h:118
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData)
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)=0
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt)
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData)
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData)=0
HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
static HMENU hmenu
Definition: win.c:66
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LRESULT ChangeTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
POINT last
Definition: font.c:46
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE)
HRESULT ChangeHotItem(CMenuToolbarBase *toolbar, INT item, DWORD dwFlags)
#define NMTBGETINFOTIP
Definition: commctrl.h:1365
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
CContainedWindowT< CWindow > CContainedWindow
Definition: atlwin.h:1768
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
LRESULT IsTrackedItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData)=0
static HANDLE ULONG_PTR dwData
Definition: file.c:35
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags)
UINT_PTR WPARAM
Definition: windef.h:207
HRESULT PrepareExecuteItem(INT iItem)
CMenuSFToolbar(CMenuBand *menuBand)
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
CComPtr< IShellFolder > m_shellFolder
HRESULT OnGetInfoTip(NMTBGETINFOTIP *tip)
#define WM_USER_CHANGETRACKEDITEM
Definition: CMenuToolbars.h:26
HRESULT KillPopupTimer()
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)
unsigned int BOOL
Definition: ntddk_ex.h:94
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb)
HRESULT MenuBarMouseUp(INT iIndex, BOOL isLButton)
HRESULT ProcessContextMenu(INT iItem)
HRESULT BeforeCancelPopup()
HRESULT UpdateImageLists()
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
static HWND hwndParent
Definition: cryptui.c:300
LRESULT OnWinEventWrap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
HRESULT ShowDW(BOOL fShow)
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
LONG_PTR LPARAM
Definition: windef.h:208
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)
GLuint index
Definition: glext.h:6031
HRESULT KeyboardItemChange(DWORD changeType)
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
virtual ~CMenuSFToolbar()
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)
CMenuStaticToolbar(CMenuBand *menuBand)
LONG HRESULT
Definition: typedefs.h:77
#define END_MSG_MAP()
Definition: atlwin.h:1789
HRESULT TrackContextMenu(IContextMenu *contextMenu, POINT pt)
#define WM_TIMER
Definition: winuser.h:1724
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb)=0
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define NMTOOLBAR
Definition: commctrl.h:1428
HRESULT OnPopupTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
unsigned long DWORD
Definition: ntddk_ex.h:95
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
static const WCHAR tb[]
Definition: suminfo.c:286
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags)
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
virtual ~CMenuStaticToolbar()
#define WM_COMMAND
Definition: winuser.h:1722
uint32_t DWORD_PTR
Definition: typedefs.h:63
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData)
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)
HRESULT ChangePopupItem(CMenuToolbarBase *toolbar, INT item)
HRESULT CancelCurrentPopup()
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4564
static ATOM item
Definition: dde.c:856
HRESULT SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags)
DWORD_PTR m_executeData
Definition: CMenuToolbars.h:55
HRESULT IsWindowOwner(HWND hwnd)
HRESULT MenuBarMouseDown(INT iIndex, BOOL isLButton)
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HRESULT SetPosSize(int x, int y, int cx, int cy)
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1770
LPCITEMIDLIST m_idList
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
virtual ~CMenuToolbarBase()
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1798
_Out_opt_ int * cx
Definition: commctrl.h:570
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt)=0
virtual HRESULT FillToolbar(BOOL clearFirst=FALSE)
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt)
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LONG_PTR LRESULT
Definition: windef.h:209
HRESULT DisableMouseTrack(BOOL bDisable)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)=0
#define WM_NOTIFY
Definition: richedit.h:61
HRESULT GetSizes(SIZE *pMinSize, SIZE *pMaxSize, SIZE *pIntegralSize)
HRESULT GetWindow(HWND *phwnd)
HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv)