ReactOS 0.4.16-dev-329-g9223134
CMenuStaticToolbar Class Reference

#include <CMenuToolbars.h>

Inheritance diagram for CMenuStaticToolbar:
Collaboration diagram for CMenuStaticToolbar:

Public Member Functions

 CMenuStaticToolbar (CMenuBand *menuBand)
 
virtual ~CMenuStaticToolbar ()
 
HRESULT SetMenu (HMENU hmenu, HWND hwnd, DWORD dwFlags)
 
HRESULT GetMenu (HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags)
 
virtual HRESULT FillToolbar (BOOL clearFirst=FALSE) override
 
- Public Member Functions inherited from CMenuToolbarBase
 CMenuToolbarBase (CMenuBand *menuBand, BOOL usePager)
 
virtual ~CMenuToolbarBase ()
 
HRESULT IsWindowOwner (HWND hwnd)
 
HRESULT CreateToolbar (HWND hwndParent, DWORD dwFlags)
 
HRESULT GetWindow (HWND *phwnd)
 
HRESULT ShowDW (BOOL fShow)
 
HRESULT Close ()
 
HRESULT OnWinEvent (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
 
HRESULT ChangeHotItem (CMenuToolbarBase *toolbar, INT item, DWORD dwFlags)
 
HRESULT ChangePopupItem (CMenuToolbarBase *toolbar, INT item)
 
HRESULT PopupSubMenu (UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
 
HRESULT PopupSubMenu (UINT itemId, UINT index, HMENU menu)
 
HRESULT TrackContextMenu (IContextMenu *contextMenu, POINT pt)
 
HRESULT KeyboardItemChange (DWORD changeType)
 
HRESULT PrepareExecuteItem (INT iItem)
 
HRESULT ExecuteItem ()
 
HRESULT GetSizes (SIZE *pMinSize, SIZE *pMaxSize, SIZE *pIntegralSize)
 
HRESULT SetPosSize (int x, int y, int cx, int cy)
 
void InvalidateDraw ()
 
HRESULT DisableMouseTrack (BOOL bDisable)
 
virtual HRESULT FillToolbar (BOOL clearFirst=FALSE)=0
 
HRESULT CancelCurrentPopup ()
 
HRESULT PopupItem (INT iItem, BOOL keyInitiated)
 
HRESULT GetDataFromId (INT iItem, INT *pIndex, DWORD_PTR *pData)
 
HRESULT KillPopupTimer ()
 
HRESULT MenuBarMouseDown (INT iIndex, BOOL isLButton)
 
HRESULT MenuBarMouseUp (INT iIndex, BOOL isLButton)
 
HRESULT ProcessClick (INT iItem)
 
HRESULT ProcessContextMenu (INT iItem)
 
HRESULT BeforeCancelPopup ()
 

Protected Member Functions

virtual HRESULT OnDeletingButton (const NMTOOLBAR *tb) override
 
virtual HRESULT InternalGetTooltip (INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) override
 
virtual HRESULT InternalExecuteItem (INT iItem, INT index, DWORD_PTR dwData) override
 
virtual HRESULT InternalPopupItem (INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) override
 
virtual HRESULT InternalHasSubMenu (INT iItem, INT index, DWORD_PTR dwData) override
 
virtual HRESULT InternalContextMenu (INT iItem, INT index, DWORD_PTR dwData, POINT pt) override
 
- Protected Member Functions inherited from CMenuToolbarBase
virtual HRESULT OnDeletingButton (const NMTOOLBAR *tb) PURE
 
virtual HRESULT InternalGetTooltip (INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax) PURE
 
virtual HRESULT InternalExecuteItem (INT iItem, INT index, DWORD_PTR dwData) PURE
 
virtual HRESULT InternalPopupItem (INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated) PURE
 
virtual HRESULT InternalHasSubMenu (INT iItem, INT index, DWORD_PTR dwData) PURE
 
virtual HRESULT InternalContextMenu (INT iItem, INT index, DWORD_PTR dwData, POINT pt) PURE
 
HRESULT AddButton (DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
 
HRESULT AddSeparator (BOOL last)
 
HRESULT AddPlaceholder ()
 
HRESULT ClearToolbar ()
 
HWND GetToolbar ()
 

Private Attributes

HMENU m_hmenu
 
HWND m_hwndMenu
 

Additional Inherited Members

- Protected Attributes inherited from CMenuToolbarBase
CMenuBandm_menuBand
 
DWORD m_dwMenuFlags
 
BOOL m_hasSizes
 
SIZE m_idealSize
 
SIZE m_itemSize
 
BOOL m_usePager
 
CMenuToolbarBasem_hotBar
 
INT m_hotItem
 
CMenuToolbarBasem_popupBar
 
INT m_popupItem
 
DWORD m_initFlags
 
BOOL m_isTrackingPopup
 
INT m_executeIndex
 
INT m_executeItem
 
DWORD_PTR m_executeData
 
BOOL m_cancelingPopup
 

Detailed Description

Definition at line 141 of file CMenuToolbars.h.

Constructor & Destructor Documentation

◆ CMenuStaticToolbar()

CMenuStaticToolbar::CMenuStaticToolbar ( CMenuBand menuBand)

Definition at line 1144 of file CMenuToolbars.cpp.

1144 :
1145 CMenuToolbarBase(menuBand, FALSE),
1146 m_hmenu(NULL),
1148{
1149}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117

◆ ~CMenuStaticToolbar()

CMenuStaticToolbar::~CMenuStaticToolbar ( )
virtual

Definition at line 1151 of file CMenuToolbars.cpp.

1152{
1153}

Member Function Documentation

◆ FillToolbar()

HRESULT CMenuStaticToolbar::FillToolbar ( BOOL  clearFirst = FALSE)
overridevirtual

Implements CMenuToolbarBase.

Definition at line 1185 of file CMenuToolbars.cpp.

1186{
1187 int i;
1188 int ic = GetMenuItemCount(m_hmenu);
1189
1190 if (clearFirst)
1191 {
1192 ClearToolbar();
1193 }
1194
1195 int count = 0;
1196 for (i = 0; i < ic; i++)
1197 {
1198 BOOL last = i + 1 == ic;
1199
1201
1202 info.cbSize = sizeof(info);
1203 info.dwTypeData = NULL;
1204 info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
1205
1207 {
1208 TRACE("Error obtaining info for menu item at pos=%d\n", i);
1209 continue;
1210 }
1211
1212 count++;
1213
1214 if (info.fType & MFT_SEPARATOR)
1215 {
1217 }
1218 else if (!(info.fType & MFT_BITMAP))
1219 {
1220 info.cch++;
1221 info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) * sizeof(WCHAR));
1222
1225
1226 SMINFO * sminfo = new SMINFO();
1227 sminfo->dwMask = SMIM_ICON | SMIM_FLAGS;
1228
1229 HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo));
1231 {
1232 delete sminfo;
1233 return hr;
1234 }
1235
1236 AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast<DWORD_PTR>(sminfo), last);
1237
1238 HeapFree(GetProcessHeap(), 0, info.dwTypeData);
1239 }
1240 }
1241
1242 return S_OK;
1243}
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
HRESULT AddSeparator(BOOL last)
HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
static UINT UINT last
Definition: font.c:45
HRESULT hr
Definition: shlfolder.c:183
@ SMIM_ICON
Definition: shobjidl.idl:2778
@ SMIM_FLAGS
Definition: shobjidl.idl:2777
struct tagSMINFO SMINFO
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwMask
Definition: shobjidl.idl:2759
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t DWORD_PTR
Definition: typedefs.h:65
LONG_PTR LPARAM
Definition: windef.h:208
#define MIIM_STRING
Definition: winuser.h:730
#define MIIM_ID
Definition: winuser.h:725
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define MIIM_FTYPE
Definition: winuser.h:732
#define MFT_SEPARATOR
Definition: winuser.h:747
#define MIIM_SUBMENU
Definition: winuser.h:726
#define MFT_BITMAP
Definition: winuser.h:741
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CMenuBand::SetMenu(), and CMenuBand::SetSite().

◆ GetMenu()

HRESULT CMenuStaticToolbar::GetMenu ( HMENU phmenu,
HWND phwnd,
DWORD pdwFlags 
)

Definition at line 1155 of file CMenuToolbars.cpp.

1159{
1160 if (phmenu)
1161 *phmenu = m_hmenu;
1162 if (phwnd)
1163 *phwnd = m_hwndMenu;
1164 if (pdwFlags)
1165 *pdwFlags = m_dwMenuFlags;
1166
1167 return S_OK;
1168}

Referenced by CMenuBand::GetMenu().

◆ InternalContextMenu()

HRESULT CMenuStaticToolbar::InternalContextMenu ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
POINT  pt 
)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1258 of file CMenuToolbars.cpp.

1259{
1260 CComPtr<IContextMenu> contextMenu;
1261 HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT,
1262 reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu));
1263 if (hr != S_OK)
1264 return hr;
1265
1266 return TrackContextMenu(contextMenu, pt);
1267}
HRESULT TrackContextMenu(IContextMenu *contextMenu, POINT pt)
#define pt(x, y)
Definition: drawing.c:79
UINT_PTR WPARAM
Definition: windef.h:207

◆ InternalExecuteItem()

HRESULT CMenuStaticToolbar::InternalExecuteItem ( INT  iItem,
INT  index,
DWORD_PTR  dwData 
)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1269 of file CMenuToolbars.cpp.

1270{
1271 return m_menuBand->_CallCBWithItemId(iItem, SMC_EXEC, 0, 0);
1272}
#define SMC_EXEC
Definition: undocshell.h:755

◆ InternalGetTooltip()

HRESULT CMenuStaticToolbar::InternalGetTooltip ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
LPWSTR  pszText,
INT  cchTextMax 
)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1245 of file CMenuToolbars.cpp.

1246{
1247 //SMINFO * info = reinterpret_cast<SMINFO*>(dwData);
1249 return E_NOTIMPL;
1250}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InternalHasSubMenu()

HRESULT CMenuStaticToolbar::InternalHasSubMenu ( INT  iItem,
INT  index,
DWORD_PTR  dwData 
)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1295 of file CMenuToolbars.cpp.

1296{
1297 return ::GetSubMenu(m_hmenu, index) ? S_OK : S_FALSE;
1298}
GLuint index
Definition: glext.h:6031
#define S_FALSE
Definition: winerror.h:2357

◆ InternalPopupItem()

HRESULT CMenuStaticToolbar::InternalPopupItem ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
BOOL  keyInitiated 
)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1274 of file CMenuToolbars.cpp.

1275{
1276 SMINFO * nfo = reinterpret_cast<SMINFO*>(dwData);
1277 if (!nfo)
1278 return E_FAIL;
1279
1280 if (nfo->dwFlags&SMIF_TRACKPOPUP)
1281 {
1282 return PopupSubMenu(iItem, index, m_hmenu);
1283 }
1284 else
1285 {
1286 CComPtr<IShellMenu> shellMenu;
1287 HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu));
1289 return hr;
1290
1291 return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1292 }
1293}
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
#define E_FAIL
Definition: ddrawi.h:102
static HANDLE ULONG_PTR dwData
Definition: file.c:35
@ SMIF_TRACKPOPUP
Definition: shobjidl.idl:2797
DWORD dwFlags
Definition: shobjidl.idl:2761

◆ OnDeletingButton()

HRESULT CMenuStaticToolbar::OnDeletingButton ( const NMTOOLBAR tb)
overrideprotectedvirtual

Reimplemented from CMenuToolbarBase.

Definition at line 1252 of file CMenuToolbars.cpp.

1253{
1254 delete reinterpret_cast<SMINFO*>(tb->tbButton.dwData);
1255 return S_OK;
1256}
static const WCHAR tb[]
Definition: suminfo.c:285

◆ SetMenu()

HRESULT CMenuStaticToolbar::SetMenu ( HMENU  hmenu,
HWND  hwnd,
DWORD  dwFlags 
)

Definition at line 1170 of file CMenuToolbars.cpp.

1174{
1175 m_hmenu = hmenu;
1176 m_hwndMenu = hwnd;
1178
1179 if (IsWindow())
1180 ClearToolbar();
1181
1182 return S_OK;
1183}
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
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by CMenuBand::SetMenu().

Member Data Documentation

◆ m_hmenu

HMENU CMenuStaticToolbar::m_hmenu
private

Definition at line 145 of file CMenuToolbars.h.

Referenced by FillToolbar(), GetMenu(), InternalHasSubMenu(), InternalPopupItem(), and SetMenu().

◆ m_hwndMenu

HWND CMenuStaticToolbar::m_hwndMenu
private

Definition at line 146 of file CMenuToolbars.h.

Referenced by GetMenu(), and SetMenu().


The documentation for this class was generated from the following files: