ReactOS  0.4.15-dev-2528-g5506091
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)
 
- 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)
 
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)
 
virtual HRESULT InternalGetTooltip (INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)
 
virtual HRESULT InternalExecuteItem (INT iItem, INT index, DWORD_PTR dwData)
 
virtual HRESULT InternalPopupItem (INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)
 
virtual HRESULT InternalHasSubMenu (INT iItem, INT index, DWORD_PTR dwData)
 
virtual HRESULT InternalContextMenu (INT iItem, INT index, DWORD_PTR dwData, POINT pt)
 
- Protected Member Functions inherited from CMenuToolbarBase
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 1132 of file CMenuToolbars.cpp.

1132  :
1133  CMenuToolbarBase(menuBand, FALSE),
1134  m_hmenu(NULL),
1135  m_hwndMenu(NULL)
1136 {
1137 }
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager)
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

◆ ~CMenuStaticToolbar()

CMenuStaticToolbar::~CMenuStaticToolbar ( )
virtual

Definition at line 1139 of file CMenuToolbars.cpp.

1140 {
1141 }

Member Function Documentation

◆ FillToolbar()

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

Implements CMenuToolbarBase.

Definition at line 1173 of file CMenuToolbars.cpp.

1174 {
1175  int i;
1176  int ic = GetMenuItemCount(m_hmenu);
1177 
1178  if (clearFirst)
1179  {
1180  ClearToolbar();
1181  }
1182 
1183  int count = 0;
1184  for (i = 0; i < ic; i++)
1185  {
1186  BOOL last = i + 1 == ic;
1187 
1189 
1190  info.cbSize = sizeof(info);
1191  info.dwTypeData = NULL;
1192  info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
1193 
1194  if (!GetMenuItemInfoW(m_hmenu, i, TRUE, &info))
1195  {
1196  TRACE("Error obtaining info for menu item at pos=%d\n", i);
1197  continue;
1198  }
1199 
1200  count++;
1201 
1202  if (info.fType & MFT_SEPARATOR)
1203  {
1204  AddSeparator(last);
1205  }
1206  else if (!(info.fType & MFT_BITMAP))
1207  {
1208  info.cch++;
1209  info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) * sizeof(WCHAR));
1210 
1211  info.fMask = MIIM_STRING | MIIM_SUBMENU | MIIM_ID;
1213 
1214  SMINFO * sminfo = new SMINFO();
1215  sminfo->dwMask = SMIM_ICON | SMIM_FLAGS;
1216 
1217  HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo));
1218  if (FAILED_UNEXPECTEDLY(hr))
1219  {
1220  delete sminfo;
1221  return hr;
1222  }
1223 
1224  AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast<DWORD_PTR>(sminfo), last);
1225 
1226  HeapFree(GetProcessHeap(), 0, info.dwTypeData);
1227  }
1228  }
1229 
1230  return S_OK;
1231 }
HRESULT AddSeparator(BOOL last)
HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last)
#define MIIM_FTYPE
Definition: winuser.h:724
HRESULT hr
Definition: shlfolder.c:183
POINT last
Definition: font.c:46
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define MFT_BITMAP
Definition: winuser.h:733
#define MIIM_SUBMENU
Definition: winuser.h:718
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define MIIM_ID
Definition: winuser.h:717
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MFT_SEPARATOR
Definition: winuser.h:739
struct _test_info info[]
Definition: SetCursorPos.c:19
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
#define MIIM_STRING
Definition: winuser.h:722
#define S_OK
Definition: intsafe.h:51
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 NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
SMDM_TOOLBAR struct tagSMINFO SMINFO
#define HeapFree(x, y, z)
Definition: compat.h:594

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

◆ GetMenu()

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

Definition at line 1143 of file CMenuToolbars.cpp.

1147 {
1148  if (phmenu)
1149  *phmenu = m_hmenu;
1150  if (phwnd)
1151  *phwnd = m_hwndMenu;
1152  if (pdwFlags)
1153  *pdwFlags = m_dwMenuFlags;
1154 
1155  return S_OK;
1156 }
#define S_OK
Definition: intsafe.h:51

Referenced by CMenuBand::GetMenu().

◆ InternalContextMenu()

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

Implements CMenuToolbarBase.

Definition at line 1246 of file CMenuToolbars.cpp.

1247 {
1248  CComPtr<IContextMenu> contextMenu;
1249  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT,
1250  reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu));
1251  if (hr != S_OK)
1252  return hr;
1253 
1254  return TrackContextMenu(contextMenu, pt);
1255 }
HRESULT hr
Definition: shlfolder.c:183
#define pt(x, y)
Definition: drawing.c:79
LONG HRESULT
Definition: typedefs.h:79
HRESULT TrackContextMenu(IContextMenu *contextMenu, POINT pt)
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
#define S_OK
Definition: intsafe.h:51
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

◆ InternalExecuteItem()

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

Implements CMenuToolbarBase.

Definition at line 1257 of file CMenuToolbars.cpp.

1258 {
1259  return m_menuBand->_CallCBWithItemId(iItem, SMC_EXEC, 0, 0);
1260 }
#define SMC_EXEC
Definition: undocshell.h:641
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

◆ InternalGetTooltip()

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

Implements CMenuToolbarBase.

Definition at line 1233 of file CMenuToolbars.cpp.

1234 {
1235  //SMINFO * info = reinterpret_cast<SMINFO*>(dwData);
1236  UNIMPLEMENTED;
1237  return E_NOTIMPL;
1238 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED
Definition: debug.h:115

◆ InternalHasSubMenu()

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

Implements CMenuToolbarBase.

Definition at line 1283 of file CMenuToolbars.cpp.

1284 {
1286 }
#define S_FALSE
Definition: winerror.h:2357
GLuint index
Definition: glext.h:6031
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define S_OK
Definition: intsafe.h:51

◆ InternalPopupItem()

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

Implements CMenuToolbarBase.

Definition at line 1262 of file CMenuToolbars.cpp.

1263 {
1264  SMINFO * nfo = reinterpret_cast<SMINFO*>(dwData);
1265  if (!nfo)
1266  return E_FAIL;
1267 
1268  if (nfo->dwFlags&SMIF_TRACKPOPUP)
1269  {
1270  return PopupSubMenu(iItem, index, m_hmenu);
1271  }
1272  else
1273  {
1274  CComPtr<IShellMenu> shellMenu;
1275  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu));
1276  if (FAILED_UNEXPECTEDLY(hr))
1277  return hr;
1278 
1279  return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1280  }
1281 }
HRESULT hr
Definition: shlfolder.c:183
static HANDLE ULONG_PTR dwData
Definition: file.c:35
#define E_FAIL
Definition: ddrawi.h:102
GLuint index
Definition: glext.h:6031
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CMenuBand.cpp:768
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu *childShellMenu, BOOL keyInitiated)
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
SMDM_TOOLBAR struct tagSMINFO SMINFO

◆ OnDeletingButton()

HRESULT CMenuStaticToolbar::OnDeletingButton ( const NMTOOLBAR tb)
protectedvirtual

Implements CMenuToolbarBase.

Definition at line 1240 of file CMenuToolbars.cpp.

1241 {
1242  delete reinterpret_cast<SMINFO*>(tb->tbButton.dwData);
1243  return S_OK;
1244 }
static const WCHAR tb[]
Definition: suminfo.c:286
#define S_OK
Definition: intsafe.h:51

◆ SetMenu()

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

Definition at line 1158 of file CMenuToolbars.cpp.

1162 {
1163  m_hmenu = hmenu;
1164  m_hwndMenu = hwnd;
1166 
1167  if (IsWindow())
1168  ClearToolbar();
1169 
1170  return S_OK;
1171 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HMENU hmenu
Definition: win.c:66
BOOL WINAPI IsWindow(_In_opt_ HWND)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51

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: