ReactOS  0.4.14-dev-98-gb0d4763
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 1131 of file CMenuToolbars.cpp.

1131  :
1132  CMenuToolbarBase(menuBand, FALSE),
1133  m_hmenu(NULL),
1134  m_hwndMenu(NULL)
1135 {
1136 }
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager)
smooth NULL
Definition: ftsmooth.c:416

◆ ~CMenuStaticToolbar()

CMenuStaticToolbar::~CMenuStaticToolbar ( )
virtual

Definition at line 1138 of file CMenuToolbars.cpp.

1139 {
1140 }

Member Function Documentation

◆ FillToolbar()

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

Implements CMenuToolbarBase.

Definition at line 1171 of file CMenuToolbars.cpp.

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

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

◆ GetMenu()

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

Definition at line 1142 of file CMenuToolbars.cpp.

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

Referenced by CMenuBand::GetMenu().

◆ InternalContextMenu()

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

Implements CMenuToolbarBase.

Definition at line 1244 of file CMenuToolbars.cpp.

1245 {
1246  CComPtr<IContextMenu> contextMenu;
1247  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT,
1248  reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu));
1249  if (hr != S_OK)
1250  return hr;
1251 
1252  return TrackContextMenu(contextMenu, pt);
1253 }
HRESULT hr
Definition: shlfolder.c:183
#define pt(x, y)
Definition: drawing.c:79
LONG HRESULT
Definition: typedefs.h:77
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:59
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

◆ InternalExecuteItem()

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

Implements CMenuToolbarBase.

Definition at line 1255 of file CMenuToolbars.cpp.

1256 {
1257  return m_menuBand->_CallCBWithItemId(iItem, SMC_EXEC, 0, 0);
1258 }
#define SMC_EXEC
Definition: undocshell.h:611
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 1231 of file CMenuToolbars.cpp.

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

◆ InternalHasSubMenu()

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

Implements CMenuToolbarBase.

Definition at line 1281 of file CMenuToolbars.cpp.

1282 {
1284 }
#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:59

◆ InternalPopupItem()

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

Implements CMenuToolbarBase.

Definition at line 1260 of file CMenuToolbars.cpp.

1261 {
1262  SMINFO * nfo = reinterpret_cast<SMINFO*>(dwData);
1263  if (!nfo)
1264  return E_FAIL;
1265 
1266  if (nfo->dwFlags&SMIF_TRACKPOPUP)
1267  {
1268  return PopupSubMenu(iItem, index, m_hmenu);
1269  }
1270  else
1271  {
1272  CComPtr<IShellMenu> shellMenu;
1273  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu));
1274  if (FAILED_UNEXPECTEDLY(hr))
1275  return hr;
1276 
1277  return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1278  }
1279 }
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:77
#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 1238 of file CMenuToolbars.cpp.

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

◆ SetMenu()

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

Definition at line 1157 of file CMenuToolbars.cpp.

1161 {
1162  m_hmenu = hmenu;
1163  m_hwndMenu = hwnd;
1165 
1166  ClearToolbar();
1167 
1168  return S_OK;
1169 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HMENU hmenu
Definition: win.c:66
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:59

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: