ReactOS  0.4.15-dev-3453-gff89651
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 1136 of file CMenuToolbars.cpp.

1136  :
1137  CMenuToolbarBase(menuBand, FALSE),
1138  m_hmenu(NULL),
1139  m_hwndMenu(NULL)
1140 {
1141 }
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager)
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112

◆ ~CMenuStaticToolbar()

CMenuStaticToolbar::~CMenuStaticToolbar ( )
virtual

Definition at line 1143 of file CMenuToolbars.cpp.

1144 {
1145 }

Member Function Documentation

◆ FillToolbar()

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

Implements CMenuToolbarBase.

Definition at line 1177 of file CMenuToolbars.cpp.

1178 {
1179  int i;
1180  int ic = GetMenuItemCount(m_hmenu);
1181 
1182  if (clearFirst)
1183  {
1184  ClearToolbar();
1185  }
1186 
1187  int count = 0;
1188  for (i = 0; i < ic; i++)
1189  {
1190  BOOL last = i + 1 == ic;
1191 
1193 
1194  info.cbSize = sizeof(info);
1195  info.dwTypeData = NULL;
1196  info.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_ID;
1197 
1198  if (!GetMenuItemInfoW(m_hmenu, i, TRUE, &info))
1199  {
1200  TRACE("Error obtaining info for menu item at pos=%d\n", i);
1201  continue;
1202  }
1203 
1204  count++;
1205 
1206  if (info.fType & MFT_SEPARATOR)
1207  {
1208  AddSeparator(last);
1209  }
1210  else if (!(info.fType & MFT_BITMAP))
1211  {
1212  info.cch++;
1213  info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) * sizeof(WCHAR));
1214 
1215  info.fMask = MIIM_STRING | MIIM_SUBMENU | MIIM_ID;
1217 
1218  SMINFO * sminfo = new SMINFO();
1219  sminfo->dwMask = SMIM_ICON | SMIM_FLAGS;
1220 
1221  HRESULT hr = m_menuBand->_CallCBWithItemId(info.wID, SMC_GETINFO, 0, reinterpret_cast<LPARAM>(sminfo));
1222  if (FAILED_UNEXPECTEDLY(hr))
1223  {
1224  delete sminfo;
1225  return hr;
1226  }
1227 
1228  AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast<DWORD_PTR>(sminfo), last);
1229 
1230  HeapFree(GetProcessHeap(), 0, info.dwTypeData);
1231  }
1232  }
1233 
1234  return S_OK;
1235 }
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:82
#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:52
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 1147 of file CMenuToolbars.cpp.

1151 {
1152  if (phmenu)
1153  *phmenu = m_hmenu;
1154  if (phwnd)
1155  *phwnd = m_hwndMenu;
1156  if (pdwFlags)
1157  *pdwFlags = m_dwMenuFlags;
1158 
1159  return S_OK;
1160 }
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::GetMenu().

◆ InternalContextMenu()

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

Implements CMenuToolbarBase.

Definition at line 1250 of file CMenuToolbars.cpp.

1251 {
1252  CComPtr<IContextMenu> contextMenu;
1253  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT,
1254  reinterpret_cast<WPARAM>(&IID_IContextMenu), reinterpret_cast<LPARAM>(&contextMenu));
1255  if (hr != S_OK)
1256  return hr;
1257 
1258  return TrackContextMenu(contextMenu, pt);
1259 }
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:52
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

◆ InternalExecuteItem()

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

Implements CMenuToolbarBase.

Definition at line 1261 of file CMenuToolbars.cpp.

1262 {
1263  return m_menuBand->_CallCBWithItemId(iItem, SMC_EXEC, 0, 0);
1264 }
#define SMC_EXEC
Definition: undocshell.h:644
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 1237 of file CMenuToolbars.cpp.

1238 {
1239  //SMINFO * info = reinterpret_cast<SMINFO*>(dwData);
1240  UNIMPLEMENTED;
1241  return E_NOTIMPL;
1242 }
#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 1287 of file CMenuToolbars.cpp.

1288 {
1290 }
#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:52

◆ InternalPopupItem()

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

Implements CMenuToolbarBase.

Definition at line 1266 of file CMenuToolbars.cpp.

1267 {
1268  SMINFO * nfo = reinterpret_cast<SMINFO*>(dwData);
1269  if (!nfo)
1270  return E_FAIL;
1271 
1272  if (nfo->dwFlags&SMIF_TRACKPOPUP)
1273  {
1274  return PopupSubMenu(iItem, index, m_hmenu);
1275  }
1276  else
1277  {
1278  CComPtr<IShellMenu> shellMenu;
1279  HRESULT hr = m_menuBand->_CallCBWithItemId(iItem, SMC_GETOBJECT, reinterpret_cast<WPARAM>(&IID_IShellMenu), reinterpret_cast<LPARAM>(&shellMenu));
1280  if (FAILED_UNEXPECTEDLY(hr))
1281  return hr;
1282 
1283  return PopupSubMenu(iItem, index, shellMenu, keyInitiated);
1284  }
1285 }
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:82
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 1244 of file CMenuToolbars.cpp.

1245 {
1246  delete reinterpret_cast<SMINFO*>(tb->tbButton.dwData);
1247  return S_OK;
1248 }
static const WCHAR tb[]
Definition: suminfo.c:286
#define S_OK
Definition: intsafe.h:52

◆ SetMenu()

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

Definition at line 1162 of file CMenuToolbars.cpp.

1166 {
1167  m_hmenu = hmenu;
1168  m_hwndMenu = hwnd;
1170 
1171  if (IsWindow())
1172  ClearToolbar();
1173 
1174  return S_OK;
1175 }
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:52

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: