ReactOS  0.4.15-dev-4872-g8a3db97
CMenuToolbarBase Class Referenceabstract

#include <CMenuToolbars.h>

Inheritance diagram for CMenuToolbarBase:
Collaboration diagram for CMenuToolbarBase:

Public Member Functions

 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)=0
 
virtual HRESULT InternalGetTooltip (INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)=0
 
virtual HRESULT InternalExecuteItem (INT iItem, INT index, DWORD_PTR dwData)=0
 
virtual HRESULT InternalPopupItem (INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)=0
 
virtual HRESULT InternalHasSubMenu (INT iItem, INT index, DWORD_PTR dwData)=0
 
virtual HRESULT InternalContextMenu (INT iItem, INT index, DWORD_PTR dwData, POINT pt)=0
 
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 ()
 

Protected Attributes

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
 

Private Member Functions

HRESULT UpdateImageLists ()
 
HRESULT OnPagerCalcSize (LPNMPGCALCSIZE csize)
 
HRESULT OnCustomDraw (LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
 
HRESULT OnGetInfoTip (NMTBGETINFOTIP *tip)
 
LRESULT IsTrackedItem (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT ChangeTrackedItem (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnWinEventWrap (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
HRESULT OnPopupTimer (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Attributes

CContainedWindow m_pager
 
HFONT m_marlett
 
BOOL m_useFlatMenus
 
BOOL m_disableMouseTrack
 
BOOL m_timerEnabled
 

Detailed Description

Definition at line 28 of file CMenuToolbars.h.

Constructor & Destructor Documentation

◆ CMenuToolbarBase()

CMenuToolbarBase::CMenuToolbarBase ( CMenuBand menuBand,
BOOL  usePager 
)

Definition at line 269 of file CMenuToolbars.cpp.

269  :
270  m_pager(WC_PAGESCROLLER, this),
274  m_menuBand(menuBand),
275  m_dwMenuFlags(0),
276  m_hasSizes(FALSE),
277  m_usePager(usePager),
278  m_hotBar(NULL),
279  m_hotItem(-1),
280  m_popupBar(NULL),
281  m_popupItem(-1),
284 {
285  m_idealSize.cx = 0;
286  m_idealSize.cy = 0;
287  m_itemSize.cx = 0;
288  m_itemSize.cy = 0;
290  0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
292  DEFAULT_QUALITY, FF_DONTCARE, L"Marlett");
293 }
#define WC_PAGESCROLLER
Definition: commctrl.h:4500
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FF_DONTCARE
Definition: wingdi.h:448
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define CreateFont
Definition: wingdi.h:4443
LONG cx
Definition: windef.h:334
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG cy
Definition: windef.h:335

◆ ~CMenuToolbarBase()

CMenuToolbarBase::~CMenuToolbarBase ( )
virtual

Definition at line 295 of file CMenuToolbars.cpp.

296 {
297  ClearToolbar();
298 
299  if (m_hWnd)
300  DestroyWindow();
301 
302  if (m_pager.m_hWnd)
303  m_pager.DestroyWindow();
304 
306 }
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DestroyWindow(_In_ HWND)
CContainedWindow m_pager
Definition: CMenuToolbars.h:31

Member Function Documentation

◆ AddButton()

HRESULT CMenuToolbarBase::AddButton ( DWORD  commandId,
LPCWSTR  caption,
BOOL  hasSubMenu,
INT  iconId,
DWORD_PTR  buttonData,
BOOL  last 
)
protected

Definition at line 991 of file CMenuToolbars.cpp.

992 {
993  TBBUTTON tbb = { 0 };
994 
995  tbb.fsState = TBSTATE_ENABLED;
996 #if !USE_TBSTYLE_EX_VERTICAL
997  if (!last && (m_initFlags & SMINIT_VERTICAL))
998  tbb.fsState |= TBSTATE_WRAP;
999 #endif
1000  tbb.fsStyle = BTNS_CHECKGROUP;
1001 
1002  if (hasSubMenu && (m_initFlags & SMINIT_VERTICAL))
1003  tbb.fsStyle |= BTNS_DROPDOWN;
1004 
1005  if (!(m_initFlags & SMINIT_VERTICAL))
1006  tbb.fsStyle |= BTNS_AUTOSIZE;
1007 
1008  tbb.iString = (INT_PTR) caption;
1009  tbb.idCommand = commandId;
1010 
1011  tbb.iBitmap = iconId;
1012  tbb.dwData = buttonData;
1013 
1014  m_hasSizes = FALSE;
1015 
1016  if (!AddButtons(1, &tbb))
1017  return HRESULT_FROM_WIN32(GetLastError());
1018  return S_OK;
1019 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
POINT last
Definition: font.c:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define BTNS_AUTOSIZE
Definition: commctrl.h:1004
int32_t INT_PTR
Definition: typedefs.h:64
BYTE fsStyle
Definition: commctrl.h:952
#define BTNS_CHECKGROUP
Definition: commctrl.h:1002
#define FALSE
Definition: types.h:117
INT_PTR iString
Definition: commctrl.h:959
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
#define BTNS_DROPDOWN
Definition: commctrl.h:1003
int idCommand
Definition: commctrl.h:950
#define S_OK
Definition: intsafe.h:52
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTATE_WRAP
Definition: commctrl.h:977
BYTE fsState
Definition: commctrl.h:951

Referenced by CMenuStaticToolbar::FillToolbar(), and CMenuSFToolbar::FillToolbar().

◆ AddPlaceholder()

HRESULT CMenuToolbarBase::AddPlaceholder ( )
protected

Definition at line 1041 of file CMenuToolbars.cpp.

1042 {
1043  TBBUTTON tbb = { 0 };
1044  WCHAR MenuString[128];
1045 
1046  LoadStringW(GetModuleHandle(L"shell32.dll"), IDS_MENU_EMPTY, MenuString, _countof(MenuString));
1047 
1048  tbb.fsState = 0;
1049  tbb.fsStyle = 0;
1050  tbb.iString = (INT_PTR) MenuString;
1051  tbb.iBitmap = -1;
1052 
1053  m_hasSizes = FALSE;
1054 
1055  if (!AddButtons(1, &tbb))
1056  return HRESULT_FROM_WIN32(GetLastError());
1057 
1058  return S_OK;
1059 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
int32_t INT_PTR
Definition: typedefs.h:64
BYTE fsStyle
Definition: commctrl.h:952
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
INT_PTR iString
Definition: commctrl.h:959
int iBitmap
Definition: commctrl.h:949
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_MENU_EMPTY
#define S_OK
Definition: intsafe.h:52
#define GetModuleHandle
Definition: winbase.h:3688
BYTE fsState
Definition: commctrl.h:951

Referenced by CMenuSFToolbar::FillToolbar().

◆ AddSeparator()

HRESULT CMenuToolbarBase::AddSeparator ( BOOL  last)
protected

Definition at line 1021 of file CMenuToolbars.cpp.

1022 {
1023  TBBUTTON tbb = { 0 };
1024 
1025  tbb.fsState = TBSTATE_ENABLED;
1026 #if !USE_TBSTYLE_EX_VERTICAL
1027  if (!last && (m_initFlags & SMINIT_VERTICAL))
1028  tbb.fsState |= TBSTATE_WRAP;
1029 #endif
1030  tbb.fsStyle = BTNS_SEP;
1031  tbb.iBitmap = 0;
1032 
1033  m_hasSizes = FALSE;
1034 
1035  if (!AddButtons(1, &tbb))
1036  return HRESULT_FROM_WIN32(GetLastError());
1037 
1038  return S_OK;
1039 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
POINT last
Definition: font.c:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BYTE fsStyle
Definition: commctrl.h:952
#define FALSE
Definition: types.h:117
int iBitmap
Definition: commctrl.h:949
#define BTNS_SEP
Definition: commctrl.h:999
#define S_OK
Definition: intsafe.h:52
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTATE_WRAP
Definition: commctrl.h:977
BYTE fsState
Definition: commctrl.h:951

Referenced by CMenuStaticToolbar::FillToolbar().

◆ BeforeCancelPopup()

HRESULT CMenuToolbarBase::BeforeCancelPopup ( )

Definition at line 798 of file CMenuToolbars.cpp.

799 {
801  TRACE("BeforeCancelPopup\n");
802  return S_OK;
803 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::_BeforeCancelPopup().

◆ CancelCurrentPopup()

HRESULT CMenuToolbarBase::CancelCurrentPopup ( )

Definition at line 1100 of file CMenuToolbars.cpp.

1101 {
1102  return m_menuBand->_CancelCurrentPopup();
1103 }
HRESULT _CancelCurrentPopup()
Definition: CMenuBand.cpp:1038
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

Referenced by OnPopupTimer(), and PopupItem().

◆ ChangeHotItem()

HRESULT CMenuToolbarBase::ChangeHotItem ( CMenuToolbarBase toolbar,
INT  item,
DWORD  dwFlags 
)

Definition at line 582 of file CMenuToolbars.cpp.

583 {
584  // Ignore the change if it already matches the stored info
585  if (m_hotBar == toolbar && m_hotItem == item)
586  return S_FALSE;
587 
588  // Prevent a change of hot item if the change was triggered by the mouse,
589  // and mouse tracking is disabled.
591  {
592  TRACE("Hot item change prevented by DisableMouseTrack\n");
593  return S_OK;
594  }
595 
596  // Notify the toolbar if the hot-tracking left this toolbar
597  if (m_hotBar == this && toolbar != this)
598  {
599  SetHotItem(-1);
600  }
601 
602  TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, toolbar, item);
603  m_hotBar = toolbar;
604  m_hotItem = item;
605 
606  if (m_hotBar == this)
607  {
608  if (m_isTrackingPopup && !(m_initFlags & SMINIT_VERTICAL))
609  {
610  // If the menubar has an open submenu, switch to the new item's submenu immediately
612  }
613  else if (dwFlags & HICF_MOUSE)
614  {
615  // Vertical menus show/hide the submenu after a delay,
616  // but only with the mouse.
617  if (m_initFlags & SMINIT_VERTICAL)
618  {
619  DWORD elapsed = 0;
620  SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
621  SetTimer(TIMERID_HOTTRACK, elapsed);
623  TRACE("SetTimer called with m_hotItem=%d\n", m_hotItem);
624  }
625  }
626  else
627  {
629  info.cbSize = sizeof(info);
630  info.dwMask = 0;
631 
632  int index = GetButtonInfo(item, &info);
633 
634  SetHotItem(index);
635  }
636  }
637 
638  InvalidateDraw();
639  return S_OK;
640 }
#define TRUE
Definition: types.h:120
#define SystemParametersInfo
Definition: winuser.h:5838
#define TIMERID_HOTTRACK
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define S_FALSE
Definition: winerror.h:2357
#define HICF_MOUSE
Definition: commctrl.h:1326
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
GLuint index
Definition: glext.h:6031
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:52
static ATOM item
Definition: dde.c:856
#define TBBUTTONINFO
Definition: commctrl.h:1254

Referenced by CMenuBand::_ChangeHotItem().

◆ ChangePopupItem()

HRESULT CMenuToolbarBase::ChangePopupItem ( CMenuToolbarBase toolbar,
INT  item 
)

Definition at line 642 of file CMenuToolbars.cpp.

643 {
644  // Ignore the change if it already matches the stored info
645  if (m_popupBar == toolbar && m_popupItem == item)
646  return S_FALSE;
647 
648  // Notify the toolbar if the popup-tracking this toolbar
649  if (m_popupBar == this && toolbar != this)
650  {
651  CheckButton(m_popupItem, FALSE);
653  }
654 
655  m_popupBar = toolbar;
656  m_popupItem = item;
657 
658  if (m_popupBar == this)
659  {
660  CheckButton(m_popupItem, TRUE);
661  }
662 
663  InvalidateDraw();
664  return S_OK;
665 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define S_OK
Definition: intsafe.h:52
static ATOM item
Definition: dde.c:856

Referenced by CMenuBand::_ChangePopupItem().

◆ ChangeTrackedItem()

LRESULT CMenuToolbarBase::ChangeTrackedItem ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 690 of file CMenuToolbars.cpp.

691 {
692  TBBUTTON btn;
693  BOOL wasTracking = LOWORD(lParam);
694  BOOL mouse = HIWORD(lParam);
695  INT idx = (INT)wParam;
696 
697  if (idx < 0)
698  {
701  }
702 
703  if (!GetButton(idx, &btn))
704  return E_FAIL;
705 
706  TRACE("ChangeTrackedItem %d, %d\n", idx, wasTracking);
707  m_isTrackingPopup = wasTracking;
708  return m_menuBand->_ChangeHotItem(this, btn.idCommand, mouse ? HICF_MOUSE : 0);
709 }
#define INT
Definition: polytest.cpp:20
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:880
unsigned int idx
Definition: utils.c:41
#define HICF_MOUSE
Definition: commctrl.h:1326
#define TRACE(s)
Definition: solgame.cpp:4
int idCommand
Definition: commctrl.h:950
#define NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define HIWORD(l)
Definition: typedefs.h:247
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ ClearToolbar()

HRESULT CMenuToolbarBase::ClearToolbar ( )
protected

Definition at line 1061 of file CMenuToolbars.cpp.

1062 {
1063  while (DeleteButton(0))
1064  {
1065  // empty;
1066  }
1067  m_hasSizes = FALSE;
1068  return S_OK;
1069 }
#define FALSE
Definition: types.h:117
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuStaticToolbar::FillToolbar(), CMenuStaticToolbar::SetMenu(), CMenuSFToolbar::SetShellFolder(), and ~CMenuToolbarBase().

◆ Close()

HRESULT CMenuToolbarBase::Close ( )

Definition at line 362 of file CMenuToolbars.cpp.

363 {
364  if (m_hWnd)
365  DestroyWindow();
366 
367  if (m_pager.m_hWnd)
368  m_pager.DestroyWindow();
369 
370  return S_OK;
371 }
BOOL WINAPI DestroyWindow(_In_ HWND)
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::CloseDW().

◆ CreateToolbar()

HRESULT CMenuToolbarBase::CreateToolbar ( HWND  hwndParent,
DWORD  dwFlags 
)

Definition at line 373 of file CMenuToolbars.cpp.

374 {
379 
380  if (dwFlags & SMINIT_VERTICAL)
381  {
382  // Activate vertical semantics
383  tbStyles |= CCS_VERT;
384 
385 #if USE_TBSTYLE_EX_VERTICAL
386  tbExStyles |= TBSTYLE_EX_VERTICAL;
387 #endif
388  }
389 
391 
392  // Get a temporary rect to use while creating the toolbar window.
393  // Ensure that it is not a null rect.
394  RECT rc;
395  if (!::GetClientRect(hwndParent, &rc) ||
396  (rc.left == rc.right) ||
397  (rc.top == rc.bottom))
398  {
399  rc.left = 0;
400  rc.top = 0;
401  rc.right = 1;
402  rc.bottom = 1;
403  }
404 
405  // HACK & FIXME: CORE-17505
406  HWND toolbar = CToolbar::Create(hwndParent, tbStyles, tbExStyles);
407  m_hWnd = NULL;
408  SubclassWindow(toolbar);
409 
410  SetWindowTheme(m_hWnd, L"", L"");
411 
412  SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
413 
415 
416  // If needed, create the pager.
417  if (m_usePager)
418  {
419  LONG pgStyles = PGS_VERT | WS_CHILD | WS_VISIBLE;
420  LONG pgExStyles = 0;
421 
422  HWND hwndPager = CreateWindowEx(
423  pgExStyles, WC_PAGESCROLLER, NULL,
424  pgStyles, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
425  hwndParent, NULL, _AtlBaseModule.GetModuleInstance(), 0);
426 
427  m_pager.SubclassWindow(hwndPager);
428 
429  ::SetParent(m_hWnd, hwndPager);
430 
431  m_pager.SendMessageW(PGM_SETCHILD, 0, reinterpret_cast<LPARAM>(m_hWnd));
432  }
433 
434  // Configure the image lists
436 
437  return S_OK;
438 }
#define TBSTYLE_EX_DOUBLEBUFFER
Definition: commctrl.h:1014
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
#define WC_PAGESCROLLER
Definition: commctrl.h:4500
#define TBSTYLE_CUSTOMERASE
Definition: commctrl.h:994
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define SystemParametersInfo
Definition: winuser.h:5838
LONG top
Definition: windef.h:307
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:308
#define PGM_SETCHILD
Definition: commctrl.h:4516
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define CCS_VERT
Definition: commctrl.h:2249
#define CCS_NODIVIDER
Definition: commctrl.h:2248
#define L(x)
Definition: ntvdm.h:50
#define TBSTYLE_REGISTERDROP
Definition: commctrl.h:995
long LONG
Definition: pedump.c:60
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:517
HRESULT UpdateImageLists()
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
#define CreateWindowEx
Definition: winuser.h:5735
static HWND hwndParent
Definition: cryptui.c:300
#define CCS_TOP
Definition: commctrl.h:2242
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2246
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define CCS_NORESIZE
Definition: commctrl.h:2245
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT AdjustForTheme(BOOL bFlatStyle)
Definition: CMenuBand.cpp:1156
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define PGS_VERT
Definition: commctrl.h:4502
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:309
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:993
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define TBSTYLE_EX_VERTICAL
Definition: commctrl.h:1011

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

◆ DisableMouseTrack()

HRESULT CMenuToolbarBase::DisableMouseTrack ( BOOL  bDisable)

Definition at line 128 of file CMenuToolbars.cpp.

129 {
130  if (m_disableMouseTrack != bDisable)
131  {
132  m_disableMouseTrack = bDisable;
133  TRACE("DisableMouseTrack %d\n", bDisable);
134  }
135  return S_OK;
136 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::_DisableMouseTrack().

◆ ExecuteItem()

HRESULT CMenuToolbarBase::ExecuteItem ( )

Definition at line 886 of file CMenuToolbars.cpp.

887 {
889 }
virtual HRESULT InternalExecuteItem(INT iItem, INT index, DWORD_PTR dwData)=0
DWORD_PTR m_executeData
Definition: CMenuToolbars.h:55

◆ FillToolbar()

virtual HRESULT CMenuToolbarBase::FillToolbar ( BOOL  clearFirst = FALSE)
pure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

◆ GetDataFromId()

HRESULT CMenuToolbarBase::GetDataFromId ( INT  iItem,
INT pIndex,
DWORD_PTR pData 
)

Definition at line 1071 of file CMenuToolbars.cpp.

1072 {
1073  if (pData)
1074  *pData = NULL;
1075 
1076  if (pIndex)
1077  *pIndex = -1;
1078 
1079  if (iItem < 0)
1080  return S_OK;
1081 
1082  TBBUTTONINFO info = { 0 };
1083 
1084  info.cbSize = sizeof(TBBUTTONINFO);
1085  info.dwMask = TBIF_COMMAND | TBIF_LPARAM;
1086 
1087  int index = GetButtonInfo(iItem, &info);
1088  if (index < 0)
1089  return E_FAIL;
1090 
1091  if (pIndex)
1092  *pIndex = index;
1093 
1094  if (pData)
1095  *pData = info.lParam;
1096 
1097  return S_OK;
1098 }
#define TBIF_COMMAND
Definition: commctrl.h:1224
#define TBIF_LPARAM
Definition: commctrl.h:1223
#define E_FAIL
Definition: ddrawi.h:102
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
#define S_OK
Definition: intsafe.h:52
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4564
#define NULL
Definition: types.h:112
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define TBBUTTONINFO
Definition: commctrl.h:1254

Referenced by OnGetInfoTip(), PopupItem(), PrepareExecuteItem(), and ProcessContextMenu().

◆ GetSizes()

HRESULT CMenuToolbarBase::GetSizes ( SIZE pMinSize,
SIZE pMaxSize,
SIZE pIntegralSize 
)

Definition at line 440 of file CMenuToolbars.cpp.

441 {
442  if (pMinSize)
443  *pMinSize = m_idealSize;
444  if (pMaxSize)
445  *pMaxSize = m_idealSize;
446  if (pIntegralSize)
447  *pIntegralSize = m_itemSize;
448 
449  if (m_hasSizes)
450  return S_OK;
451 
452  TRACE("Sizes out of date, recalculating.\n");
453 
454  if (!m_hWnd)
455  {
456  return S_OK;
457  }
458 
459  // Obtain the ideal size, to be used as min and max
460  GetMaxSize(&m_idealSize);
461  GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize);
462 
463  TRACE("Ideal Size: (%d, %d) for %d buttons\n", m_idealSize, GetButtonCount());
464 
465  // Obtain the button size, to be used as the integral size
466  DWORD size = GetButtonSize();
469  m_hasSizes = TRUE;
470 
471  if (pMinSize)
472  *pMinSize = m_idealSize;
473  if (pMaxSize)
474  *pMaxSize = m_idealSize;
475  if (pIntegralSize)
476  *pIntegralSize = m_itemSize;
477 
478  return S_OK;
479 }
#define TRUE
Definition: types.h:120
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
LONG cx
Definition: windef.h:334
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
LONG cy
Definition: windef.h:335

Referenced by CMenuBand::GetBandInfo(), OnPagerCalcSize(), and CMenuBand::OnPosRectChangeDB().

◆ GetToolbar()

HWND CMenuToolbarBase::GetToolbar ( )
inlineprotected

Definition at line 118 of file CMenuToolbars.h.

118 { return m_hWnd; }

Referenced by CMenuSFToolbar::FillToolbar(), and CMenuSFToolbar::InternalContextMenu().

◆ GetWindow()

HRESULT CMenuToolbarBase::GetWindow ( HWND phwnd)

Definition at line 512 of file CMenuToolbars.cpp.

513 {
514  if (!phwnd)
515  return E_FAIL;
516 
517  if (m_pager.m_hWnd)
518  *phwnd = m_pager.m_hWnd;
519  else
520  *phwnd = m_hWnd;
521 
522  return S_OK;
523 }
#define E_FAIL
Definition: ddrawi.h:102
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::GetWindow().

◆ InternalContextMenu()

virtual HRESULT CMenuToolbarBase::InternalContextMenu ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
POINT  pt 
)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by ProcessContextMenu().

◆ InternalExecuteItem()

virtual HRESULT CMenuToolbarBase::InternalExecuteItem ( INT  iItem,
INT  index,
DWORD_PTR  dwData 
)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by ExecuteItem().

◆ InternalGetTooltip()

virtual HRESULT CMenuToolbarBase::InternalGetTooltip ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
LPWSTR  pszText,
INT  cchTextMax 
)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by OnGetInfoTip().

◆ InternalHasSubMenu()

virtual HRESULT CMenuToolbarBase::InternalHasSubMenu ( INT  iItem,
INT  index,
DWORD_PTR  dwData 
)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by PopupItem().

◆ InternalPopupItem()

virtual HRESULT CMenuToolbarBase::InternalPopupItem ( INT  iItem,
INT  index,
DWORD_PTR  dwData,
BOOL  keyInitiated 
)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by PopupItem().

◆ InvalidateDraw()

void CMenuToolbarBase::InvalidateDraw ( )

Definition at line 308 of file CMenuToolbars.cpp.

309 {
311 }
#define FALSE
Definition: types.h:117
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define NULL
Definition: types.h:112

Referenced by ChangeHotItem(), and ChangePopupItem().

◆ IsTrackedItem()

LRESULT CMenuToolbarBase::IsTrackedItem ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 667 of file CMenuToolbars.cpp.

668 {
669  TBBUTTON btn;
670  INT idx = (INT)wParam;
671 
672  if (m_hotBar != this)
673  return S_FALSE;
674 
675  if (idx < 0)
676  return S_FALSE;
677 
678  if (!GetButton(idx, &btn))
679  return E_FAIL;
680 
681  if (m_hotItem == btn.idCommand)
682  return S_OK;
683 
684  if (m_popupItem == btn.idCommand)
685  return S_OK;
686 
687  return S_FALSE;
688 }
#define INT
Definition: polytest.cpp:20
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
unsigned int idx
Definition: utils.c:41
#define S_FALSE
Definition: winerror.h:2357
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
int idCommand
Definition: commctrl.h:950
#define S_OK
Definition: intsafe.h:52

◆ IsWindowOwner()

HRESULT CMenuToolbarBase::IsWindowOwner ( HWND  hwnd)

Definition at line 505 of file CMenuToolbars.cpp.

506 {
507  if (m_hWnd && m_hWnd == hwnd) return S_OK;
508  if (m_pager.m_hWnd && m_pager.m_hWnd == hwnd) return S_OK;
509  return S_FALSE;
510 }
#define S_FALSE
Definition: winerror.h:2357
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:52
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by CMenuBand::_MenuBarMouseDown(), CMenuBand::_MenuBarMouseUp(), CMenuBand::IsWindowOwner(), and CMenuBand::OnWinEvent().

◆ KeyboardItemChange()

HRESULT CMenuToolbarBase::KeyboardItemChange ( DWORD  changeType)

Definition at line 891 of file CMenuToolbars.cpp.

892 {
893  int prev = m_hotItem;
894  int index = -1;
895 
896  if (dwSelectType != 0xFFFFFFFF)
897  {
898  int count = GetButtonCount();
899 
900  if (dwSelectType == VK_HOME)
901  {
902  index = 0;
903  dwSelectType = VK_DOWN;
904  }
905  else if (dwSelectType == VK_END)
906  {
907  index = count - 1;
908  dwSelectType = VK_UP;
909  }
910  else
911  {
912  if (m_hotItem >= 0)
913  {
914  TBBUTTONINFO info = { 0 };
915  info.cbSize = sizeof(TBBUTTONINFO);
916  info.dwMask = 0;
917  index = GetButtonInfo(m_hotItem, &info);
918  }
919 
920  if (index < 0)
921  {
922  if (dwSelectType == VK_UP)
923  {
924  index = count - 1;
925  }
926  else if (dwSelectType == VK_DOWN)
927  {
928  index = 0;
929  }
930  }
931  else
932  {
933  if (dwSelectType == VK_UP)
934  {
935  index--;
936  }
937  else if (dwSelectType == VK_DOWN)
938  {
939  index++;
940  }
941  }
942  }
943 
944  TBBUTTON btn = { 0 };
945  while (index >= 0 && index < count)
946  {
947  DWORD res = GetButton(index, &btn);
948  if (!res)
949  return E_FAIL;
950 
951  if (btn.dwData)
952  {
953  if (prev != btn.idCommand)
954  {
955  TRACE("Setting Hot item to %d\n", index);
956  if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
957  {
958  HWND tlw;
960  ::SendMessageW(tlw, WM_CANCELMODE, 0, 0);
962  }
963  else
964  m_menuBand->_ChangeHotItem(this, btn.idCommand, 0);
965  }
966  return S_OK;
967  }
968 
969  if (dwSelectType == VK_UP)
970  {
971  index--;
972  }
973  else if (dwSelectType == VK_DOWN)
974  {
975  index++;
976  }
977  }
978 
979  return S_FALSE;
980  }
981 
982  if (prev != -1)
983  {
984  TRACE("Setting Hot item to null\n");
985  m_menuBand->_ChangeHotItem(NULL, -1, 0);
986  }
987 
988  return S_FALSE;
989 }
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:874
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
#define VK_DOWN
Definition: winuser.h:2207
#define E_FAIL
Definition: ddrawi.h:102
#define WM_USER_CHANGETRACKEDITEM
Definition: CMenuToolbars.h:26
#define VK_HOME
Definition: winuser.h:2203
#define VK_UP
Definition: winuser.h:2205
#define FALSE
Definition: types.h:117
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:880
#define S_FALSE
Definition: winerror.h:2357
GLuint index
Definition: glext.h:6031
DWORD_PTR dwData
Definition: commctrl.h:958
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int idCommand
Definition: commctrl.h:950
#define WM_CANCELMODE
Definition: winuser.h:1622
#define S_OK
Definition: intsafe.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint res
Definition: glext.h:9613
#define VK_END
Definition: winuser.h:2202
#define TBBUTTONINFO
Definition: commctrl.h:1254

◆ KillPopupTimer()

HRESULT CMenuToolbarBase::KillPopupTimer ( )

Definition at line 571 of file CMenuToolbars.cpp.

572 {
573  if (m_timerEnabled)
574  {
577  return S_OK;
578  }
579  return S_FALSE;
580 }
#define TIMERID_HOTTRACK
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::_KillPopupTimers().

◆ MenuBarMouseDown()

HRESULT CMenuToolbarBase::MenuBarMouseDown ( INT  iIndex,
BOOL  isLButton 
)

Definition at line 844 of file CMenuToolbars.cpp.

845 {
846  TBBUTTON btn;
847 
848  GetButton(iIndex, &btn);
849 
850  if ((m_initFlags & SMINIT_VERTICAL)
851  || m_popupBar
852  || m_cancelingPopup)
853  {
855  return S_OK;
856  }
857 
858  return ProcessClick(btn.idCommand);
859 }
HRESULT ProcessClick(INT iItem)
#define FALSE
Definition: types.h:117
int idCommand
Definition: commctrl.h:950
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::_MenuBarMouseDown().

◆ MenuBarMouseUp()

HRESULT CMenuToolbarBase::MenuBarMouseUp ( INT  iIndex,
BOOL  isLButton 
)

Definition at line 861 of file CMenuToolbars.cpp.

862 {
863  TBBUTTON btn;
864 
866 
867  if (!(m_initFlags & SMINIT_VERTICAL))
868  return S_OK;
869 
870  GetButton(iIndex, &btn);
871 
872  if (isLButton)
873  return ProcessClick(btn.idCommand);
874  else
875  return ProcessContextMenu(btn.idCommand);
876 }
HRESULT ProcessClick(INT iItem)
#define FALSE
Definition: types.h:117
HRESULT ProcessContextMenu(INT iItem)
int idCommand
Definition: commctrl.h:950
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::_MenuBarMouseUp().

◆ OnCustomDraw()

HRESULT CMenuToolbarBase::OnCustomDraw ( LPNMTBCUSTOMDRAW  cdraw,
LRESULT theResult 
)
private

Definition at line 153 of file CMenuToolbars.cpp.

154 {
155  bool isHot, isPopup, isActive;
156  TBBUTTONINFO btni;
157 
158  switch (cdraw->nmcd.dwDrawStage)
159  {
160  case CDDS_PREPAINT:
161  *theResult = CDRF_NOTIFYITEMDRAW;
162  return S_OK;
163 
164  case CDDS_ITEMPREPAINT:
165 
166  HWND tlw;
168 
169  // The item with an active submenu gets the CHECKED flag.
170  isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
171  isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
172  isActive = (GetForegroundWindow() == tlw) || (m_popupBar == this);
173 
174  if (m_hotItem < 0 && isPopup)
175  isHot = TRUE;
176 
177  if ((m_useFlatMenus && isHot) || (m_initFlags & SMINIT_VERTICAL))
178  {
179  COLORREF clrText;
180  HBRUSH bgBrush;
181  RECT rc = cdraw->nmcd.rc;
182  HDC hdc = cdraw->nmcd.hdc;
183 
184  // Remove HOT and CHECKED flags (will restore HOT if necessary)
185  cdraw->nmcd.uItemState &= ~(CDIS_HOT | CDIS_CHECKED);
186 
187  // Decide on the colors
188  if (isHot)
189  {
190  cdraw->nmcd.uItemState |= CDIS_HOT;
191 
192  clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
193  bgBrush = GetSysColorBrush(m_useFlatMenus ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT);
194  }
195  else
196  {
197  clrText = GetSysColor(COLOR_MENUTEXT);
198  bgBrush = GetSysColorBrush(COLOR_MENU);
199  }
200 
201  // Paint the background color with the selected color
202  FillRect(hdc, &rc, bgBrush);
203 
204  // Set the text color in advance, this color will be assigned when the ITEMPOSTPAINT triggers
205  SetTextColor(hdc, clrText);
206 
207  // Set the text color, will be used by the internal drawing code
208  cdraw->clrText = clrText;
209  cdraw->iListGap += 4;
210 
211  // Tell the default drawing code we don't want any fanciness, not even a background.
212  *theResult = CDRF_NOTIFYPOSTPAINT | TBCDRF_NOBACKGROUND | TBCDRF_NOEDGES | TBCDRF_NOOFFSET | TBCDRF_NOMARK | 0x00800000; // FIXME: the last bit is Vista+, useful for debugging only
213  }
214  else
215  {
216  // Set the text color, will be used by the internal drawing code
217  cdraw->clrText = GetSysColor(isActive ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
218 
219  // Remove HOT and CHECKED flags (will restore HOT if necessary)
220  cdraw->nmcd.uItemState &= ~CDIS_HOT;
221 
222  // Decide on the colors
223  if (isHot)
224  {
225  cdraw->nmcd.uItemState |= CDIS_HOT;
226  }
227 
228  *theResult = 0;
229  }
230 
231  return S_OK;
232 
233  case CDDS_ITEMPOSTPAINT:
234 
235  // Fetch the button style
236  btni.cbSize = sizeof(btni);
237  btni.dwMask = TBIF_STYLE;
238  GetButtonInfo(cdraw->nmcd.dwItemSpec, &btni);
239 
240  // Check if we need to draw a submenu arrow
241  if (btni.fsStyle & BTNS_DROPDOWN)
242  {
243  // TODO: Support RTL text modes by drawing a leftwards arrow aligned to the left of the control
244 
245  // "8" is the rightwards dropdown arrow in the Marlett font
246  WCHAR text [] = L"8";
247 
248  // Configure the font to draw with Marlett, keeping the current background color as-is
249  SelectObject(cdraw->nmcd.hdc, m_marlett);
250  SetBkMode(cdraw->nmcd.hdc, TRANSPARENT);
251 
252  // Tweak the alignment by 1 pixel so the menu draws like the Windows start menu.
253  RECT rc = cdraw->nmcd.rc;
254  rc.right += 1;
255 
256  // The arrow is drawn at the right of the item's rect, aligned vertically.
258  }
259  *theResult = TRUE;
260  return S_OK;
261 
262  default:
263  *theResult = 0L;
264  break;
265  }
266  return S_OK;
267 }
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define DrawTextEx
Definition: winuser.h:5752
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define TRUE
Definition: types.h:120
const WCHAR * text
Definition: package.c:1743
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:874
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1035
#define TBIF_STYLE
Definition: commctrl.h:1222
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define DT_RIGHT
Definition: winuser.h:538
LONG right
Definition: windef.h:308
#define TBCDRF_NOEDGES
Definition: commctrl.h:1033
DWORD WINAPI GetSysColor(_In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define L(x)
Definition: ntvdm.h:50
#define TRANSPARENT
Definition: wingdi.h:950
COLORREF clrText
Definition: commctrl.h:1021
#define COLOR_MENU
Definition: winuser.h:911
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
NMCUSTOMDRAW nmcd
Definition: commctrl.h:1017
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:300
#define CDIS_HOT
Definition: commctrl.h:297
#define COLOR_MENUTEXT
Definition: winuser.h:914
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
#define CDIS_CHECKED
Definition: commctrl.h:294
#define TBCDRF_NOMARK
Definition: commctrl.h:1036
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define COLOR_GRAYTEXT
Definition: winuser.h:926
#define BTNS_DROPDOWN
Definition: commctrl.h:1003
HDC hdc
Definition: main.c:9
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define DT_NOCLIP
Definition: winuser.h:536
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:911
#define DT_SINGLELINE
Definition: winuser.h:540
#define S_OK
Definition: intsafe.h:52
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1040
#define NULL
Definition: types.h:112
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define TBBUTTONINFO
Definition: commctrl.h:1254
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by OnWinEvent().

◆ OnDeletingButton()

virtual HRESULT CMenuToolbarBase::OnDeletingButton ( const NMTOOLBAR tb)
protectedpure virtual

Implemented in CMenuSFToolbar, and CMenuStaticToolbar.

Referenced by OnWinEvent().

◆ OnGetInfoTip()

HRESULT CMenuToolbarBase::OnGetInfoTip ( NMTBGETINFOTIP tip)
private

Definition at line 525 of file CMenuToolbars.cpp.

526 {
527  INT index;
529 
530  INT iItem = tip->iItem;
531 
532  GetDataFromId(iItem, &index, &dwData);
533 
534  return InternalGetTooltip(iItem, index, dwData, tip->pszText, tip->cchTextMax);
535 }
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
static HANDLE ULONG_PTR dwData
Definition: file.c:35
int32_t INT
Definition: typedefs.h:58
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
uint32_t DWORD_PTR
Definition: typedefs.h:65
virtual HRESULT InternalGetTooltip(INT iItem, INT index, DWORD_PTR dwData, LPWSTR pszText, INT cchTextMax)=0

Referenced by OnWinEvent().

◆ OnPagerCalcSize()

HRESULT CMenuToolbarBase::OnPagerCalcSize ( LPNMPGCALCSIZE  csize)
private

Definition at line 138 of file CMenuToolbars.cpp.

139 {
140  SIZE tbs;
141  GetSizes(NULL, &tbs, NULL);
142  if (csize->dwFlag == PGF_CALCHEIGHT)
143  {
144  csize->iHeight = tbs.cy;
145  }
146  else if (csize->dwFlag == PGF_CALCWIDTH)
147  {
148  csize->iWidth = tbs.cx;
149  }
150  return S_OK;
151 }
#define PGF_CALCHEIGHT
Definition: commctrl.h:4583
#define PGF_CALCWIDTH
Definition: commctrl.h:4582
LONG cx
Definition: windef.h:334
DWORD dwFlag
Definition: commctrl.h:4587
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
LONG cy
Definition: windef.h:335
HRESULT GetSizes(SIZE *pMinSize, SIZE *pMaxSize, SIZE *pIntegralSize)

Referenced by OnWinEvent().

◆ OnPopupTimer()

HRESULT CMenuToolbarBase::OnPopupTimer ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 537 of file CMenuToolbars.cpp.

538 {
539  if (wParam != TIMERID_HOTTRACK)
540  {
541  bHandled = FALSE;
542  return 0;
543  }
544 
546 
547  if (!m_timerEnabled)
548  return 0;
549 
551 
552  if (m_hotItem < 0)
553  return 0;
554 
555  // Returns S_FALSE if the current item did not show a submenu
557  if (hr != S_FALSE)
558  return 0;
559 
560  // If we didn't switch submenus, cancel the current popup regardless
561  if (m_popupBar)
562  {
564  if (FAILED_UNEXPECTEDLY(hr))
565  return 0;
566  }
567 
568  return 0;
569 }
HRESULT hr
Definition: shlfolder.c:183
WPARAM wParam
Definition: combotst.c:138
#define TIMERID_HOTTRACK
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
HRESULT CancelCurrentPopup()

◆ OnWinEvent()

HRESULT CMenuToolbarBase::OnWinEvent ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult 
)

Definition at line 46 of file CMenuToolbars.cpp.

47 {
48  NMHDR * hdr;
49  HRESULT hr;
51 
52  if (theResult)
53  *theResult = 0;
54  switch (uMsg)
55  {
56  case WM_COMMAND:
57  //return OnCommand(wParam, lParam, theResult);
58  return S_OK;
59 
60  case WM_NOTIFY:
61  hdr = reinterpret_cast<LPNMHDR>(lParam);
62  switch (hdr->code)
63  {
64  case TBN_DELETINGBUTTON:
65  return OnDeletingButton(reinterpret_cast<LPNMTOOLBAR>(hdr));
66 
67  case PGN_CALCSIZE:
68  return OnPagerCalcSize(reinterpret_cast<LPNMPGCALCSIZE>(hdr));
69 
70  case TBN_DROPDOWN:
71  return ProcessClick(reinterpret_cast<LPNMTOOLBAR>(hdr)->iItem);
72 
73  case TBN_HOTITEMCHANGE:
74  //return OnHotItemChange(reinterpret_cast<LPNMTBHOTITEM>(hdr), theResult);
75  return S_OK;
76 
77  case NM_CUSTOMDRAW:
78  hr = OnCustomDraw(reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr), &result);
79  if (theResult)
80  *theResult = result;
81  return hr;
82 
83  case TBN_GETINFOTIP:
84  return OnGetInfoTip(reinterpret_cast<LPNMTBGETINFOTIP>(hdr));
85 
86  // Silence unhandled items so that they don't print as unknown
87  case RBN_CHILDSIZE:
88  return S_OK;
89 
90  case TTN_GETDISPINFO:
91  return S_OK;
92 
93  case NM_RELEASEDCAPTURE:
94  break;
95 
96  case NM_CLICK:
97  case NM_RDOWN:
98  case NM_LDOWN:
99  break;
100 
101  case TBN_GETDISPINFO:
102  break;
103 
104  case TBN_BEGINDRAG:
105  case TBN_ENDDRAG:
106  break;
107 
108  case NM_TOOLTIPSCREATED:
109  break;
110 
111  case TBN_DRAGOUT: return S_FALSE;
112 
113  default:
114  TRACE("WM_NOTIFY unknown code %d, %d\n", hdr->code, hdr->idFrom);
115  return S_OK;
116  }
117  return S_FALSE;
118  case WM_WININICHANGE:
119  if (wParam == SPI_SETFLATMENU)
120  {
121  SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
122  }
123  }
124 
125  return S_FALSE;
126 }
HRESULT ProcessClick(INT iItem)
char hdr[14]
Definition: iptest.cpp:33
#define TBN_GETDISPINFO
Definition: commctrl.h:1420
HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
UINT uMsg
Definition: menu.cpp:213
#define TBN_BEGINDRAG
Definition: commctrl.h:1307
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define SystemParametersInfo
Definition: winuser.h:5838
#define TBN_DRAGOUT
Definition: commctrl.h:1337
WPARAM wParam
Definition: combotst.c:138
#define TBN_HOTITEMCHANGE
Definition: commctrl.h:1336
HRESULT OnGetInfoTip(NMTBGETINFOTIP *tip)
#define PGN_CALCSIZE
Definition: commctrl.h:4580
#define TBN_DROPDOWN
Definition: commctrl.h:1316
#define TTN_GETDISPINFO
Definition: commctrl.h:1878
#define S_FALSE
Definition: winerror.h:2357
#define RBN_CHILDSIZE
Definition: commctrl.h:1636
#define WM_WININICHANGE
Definition: winuser.h:1617
#define TBN_ENDDRAG
Definition: commctrl.h:1308
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb)=0
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize)
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_COMMAND
Definition: winuser.h:1727
#define NM_CLICK
Definition: commctrl.h:130
#define TBN_GETINFOTIP
Definition: commctrl.h:1392
#define S_OK
Definition: intsafe.h:52
#define NM_LDOWN
Definition: commctrl.h:145
LONG_PTR LRESULT
Definition: windef.h:209
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
LPARAM lParam
Definition: combotst.c:139
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1338
#define NM_RDOWN
Definition: commctrl.h:146
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by CMenuBand::OnWinEvent(), and OnWinEventWrap().

◆ OnWinEventWrap()

LRESULT CMenuToolbarBase::OnWinEventWrap ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 39 of file CMenuToolbars.cpp.

40 {
41  LRESULT lr;
42  bHandled = OnWinEvent(m_hWnd, uMsg, wParam, lParam, &lr) != S_FALSE;
43  return lr;
44 }
UINT uMsg
Definition: menu.cpp:213
WPARAM wParam
Definition: combotst.c:138
#define S_FALSE
Definition: winerror.h:2357
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ PopupItem()

HRESULT CMenuToolbarBase::PopupItem ( INT  iItem,
BOOL  keyInitiated 
)

Definition at line 1105 of file CMenuToolbars.cpp.

1106 {
1107  INT index;
1108  DWORD_PTR dwData;
1109 
1110  if (iItem < 0)
1111  return S_OK;
1112 
1113  if (m_popupBar == this && m_popupItem == iItem)
1114  return S_OK;
1115 
1116  GetDataFromId(iItem, &index, &dwData);
1117 
1119  if (hr != S_OK)
1120  return hr;
1121 
1122  if (m_popupBar)
1123  {
1125  if (FAILED_UNEXPECTEDLY(hr))
1126  return hr;
1127  }
1128 
1129  if (!(m_initFlags & SMINIT_VERTICAL))
1130  {
1131  TRACE("PopupItem non-vertical %d %d\n", index, iItem);
1132  m_menuBand->_ChangeHotItem(this, iItem, 0);
1133  }
1134 
1135  return InternalPopupItem(iItem, index, dwData, keyInitiated);
1136 }
virtual HRESULT InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData, BOOL keyInitiated)=0
virtual HRESULT InternalHasSubMenu(INT iItem, INT index, DWORD_PTR dwData)=0
HRESULT hr
Definition: shlfolder.c:183
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
static HANDLE ULONG_PTR dwData
Definition: file.c:35
int32_t INT
Definition: typedefs.h:58
HRESULT _ChangeHotItem(CMenuToolbarBase *tb, INT id, DWORD dwFlags)
Definition: CMenuBand.cpp:880
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define index(s, c)
Definition: various.h:29
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define S_OK
Definition: intsafe.h:52
HRESULT CancelCurrentPopup()
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

Referenced by CMenuBand::_MenuItemSelect(), ChangeHotItem(), OnPopupTimer(), and ProcessClick().

◆ PopupSubMenu() [1/2]

HRESULT CMenuToolbarBase::PopupSubMenu ( UINT  itemId,
UINT  index,
IShellMenu childShellMenu,
BOOL  keyInitiated 
)

Definition at line 711 of file CMenuToolbars.cpp.

712 {
713  // Calculate the submenu position and exclude area
714  RECT rc = { 0 };
715 
716  if (!GetItemRect(index, &rc))
717  return E_FAIL;
718 
719  POINT a = { rc.left, rc.top };
720  POINT b = { rc.right, rc.bottom };
721 
722  ClientToScreen(&a);
723  ClientToScreen(&b);
724 
725  POINTL pt = { a.x, b.y };
726  RECTL rcl = { a.x, a.y, b.x, b.y };
727 
728  if (m_initFlags & SMINIT_VERTICAL)
729  {
730  // FIXME: Hardcoding this here feels hacky.
731  if (IsAppThemed())
732  {
733  pt.x = b.x - 1;
734  pt.y = a.y - 1;
735  }
736  else
737  {
738  pt.x = b.x - 3;
739  pt.y = a.y - 3;
740  }
741  }
742 
743  // Display the submenu
745 
746  m_menuBand->_ChangePopupItem(this, iItem);
747  m_menuBand->_OnPopupSubMenu(childShellMenu, &pt, &rcl, keyInitiated);
748 
749  return S_OK;
750 }
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
GLuint index
Definition: glext.h:6031
HRESULT _OnPopupSubMenu(IShellMenu *childShellMenu, POINTL *pAt, RECTL *pExclude, BOOL mouseInitiated)
Definition: CMenuBand.cpp:1055
HRESULT _ChangePopupItem(CMenuToolbarBase *tb, INT id)
Definition: CMenuBand.cpp:899
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define S_OK
Definition: intsafe.h:52
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:309
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by CMenuStaticToolbar::InternalPopupItem(), and CMenuSFToolbar::InternalPopupItem().

◆ PopupSubMenu() [2/2]

HRESULT CMenuToolbarBase::PopupSubMenu ( UINT  itemId,
UINT  index,
HMENU  menu 
)

Definition at line 752 of file CMenuToolbars.cpp.

753 {
754  // Calculate the submenu position and exclude area
755  RECT rc = { 0 };
756 
757  if (!GetItemRect(index, &rc))
758  return E_FAIL;
759 
760  POINT a = { rc.left, rc.top };
761  POINT b = { rc.right, rc.bottom };
762 
763  ClientToScreen(&a);
764  ClientToScreen(&b);
765 
766  POINT pt = { a.x, b.y };
767  RECT rcl = { a.x, a.y, b.x, b.y };
768 
769  if (m_initFlags & SMINIT_VERTICAL)
770  {
771  pt.x = b.x;
772  pt.y = a.y;
773  }
774 
775  HMENU popup = GetSubMenu(menu, index);
776 
777  // Display the submenu
779  m_menuBand->_ChangePopupItem(this, iItem);
780  m_menuBand->_TrackSubMenu(popup, pt.x, pt.y, rcl);
783 
784  return S_OK;
785 }
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031
HRESULT _ChangePopupItem(CMenuToolbarBase *tb, INT id)
Definition: CMenuBand.cpp:899
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define S_OK
Definition: intsafe.h:52
HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT &rcExclude)
Definition: CMenuBand.cpp:800
#define NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:309
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

◆ PrepareExecuteItem()

HRESULT CMenuToolbarBase::PrepareExecuteItem ( INT  iItem)

Definition at line 878 of file CMenuToolbars.cpp.

879 {
880  this->m_menuBand->_KillPopupTimers();
881 
882  m_executeItem = iItem;
883  return GetDataFromId(iItem, &m_executeIndex, &m_executeData);
884 }
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
HRESULT _KillPopupTimers()
Definition: CMenuBand.cpp:1119
DWORD_PTR m_executeData
Definition: CMenuToolbars.h:55
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

◆ ProcessClick()

HRESULT CMenuToolbarBase::ProcessClick ( INT  iItem)

Definition at line 805 of file CMenuToolbars.cpp.

806 {
808  {
809  TRACE("Item click prevented by DisableMouseTrack\n");
810  return S_OK;
811  }
812 
813  // If a button is clicked while a submenu was open, cancel the submenu.
814  if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
815  {
816  TRACE("OnCommand cancelled because it was tracking submenu.\n");
817  return S_FALSE;
818  }
819 
820  if (PopupItem(iItem, FALSE) == S_OK)
821  {
822  TRACE("PopupItem returned S_OK\n");
823  return S_FALSE;
824  }
825 
826  TRACE("Executing...\n");
827 
828  return m_menuBand->_MenuItemSelect(MPOS_EXECUTE);
829 }
#define FALSE
Definition: types.h:117
#define S_FALSE
Definition: winerror.h:2357
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
HRESULT _MenuItemSelect(DWORD changeType)
Definition: CMenuBand.cpp:954

Referenced by MenuBarMouseDown(), MenuBarMouseUp(), and OnWinEvent().

◆ ProcessContextMenu()

HRESULT CMenuToolbarBase::ProcessContextMenu ( INT  iItem)

Definition at line 831 of file CMenuToolbars.cpp.

832 {
833  INT index;
834  DWORD_PTR data;
835 
836  GetDataFromId(iItem, &index, &data);
837 
838  DWORD pos = GetMessagePos();
840 
841  return InternalContextMenu(iItem, index, data, pt);
842 }
#define pt(x, y)
Definition: drawing.c:79
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
int32_t INT
Definition: typedefs.h:58
GLuint index
Definition: glext.h:6031
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define index(s, c)
Definition: various.h:29
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
virtual HRESULT InternalContextMenu(INT iItem, INT index, DWORD_PTR dwData, POINT pt)=0

Referenced by MenuBarMouseUp().

◆ SetPosSize()

HRESULT CMenuToolbarBase::SetPosSize ( int  x,
int  y,
int  cx,
int  cy 
)

Definition at line 481 of file CMenuToolbars.cpp.

482 {
483  // Update the toolbar or pager to fit the requested rect
484  // If we have a pager, set the toolbar height to the ideal height of the toolbar
485  if (m_pager.m_hWnd)
486  {
487  SetWindowPos(NULL, x, y, cx, m_idealSize.cy, 0);
488  m_pager.SetWindowPos(NULL, x, y, cx, cy, 0);
489  }
490  else
491  {
492  SetWindowPos(NULL, x, y, cx, cy, 0);
493  }
494 
495  // In a vertical menu, resize the buttons to fit the width
496  if (m_initFlags & SMINIT_VERTICAL)
497  {
498  DWORD btnSize = GetButtonSize();
499  SetButtonSize(cx, GET_Y_LPARAM(btnSize));
500  }
501 
502  return S_OK;
503 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
_Out_opt_ int * cx
Definition: commctrl.h:585
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG cy
Definition: windef.h:335

Referenced by CMenuBand::OnPosRectChangeDB().

◆ ShowDW()

HRESULT CMenuToolbarBase::ShowDW ( BOOL  fShow)

Definition at line 313 of file CMenuToolbars.cpp.

314 {
315  ShowWindow(fShow ? SW_SHOW : SW_HIDE);
316 
317  // Ensure that the right image list is assigned to the toolbar
319 
320  // For custom-drawing
321  SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
322 
323  return S_OK;
324 }
#define SW_HIDE
Definition: winuser.h:762
#define SystemParametersInfo
Definition: winuser.h:5838
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HRESULT UpdateImageLists()
#define SW_SHOW
Definition: winuser.h:769
#define S_OK
Definition: intsafe.h:52

Referenced by CMenuBand::ShowDW().

◆ TrackContextMenu()

HRESULT CMenuToolbarBase::TrackContextMenu ( IContextMenu contextMenu,
POINT  pt 
)

Definition at line 787 of file CMenuToolbars.cpp.

788 {
789  // Cancel submenus
791  if (m_popupBar)
793 
794  // Display the context menu
795  return m_menuBand->_TrackContextMenu(contextMenu, pt.x, pt.y);
796 }
#define pt(x, y)
Definition: drawing.c:79
HRESULT _CancelCurrentPopup()
Definition: CMenuBand.cpp:1038
HRESULT _KillPopupTimers()
Definition: CMenuBand.cpp:1119
HRESULT _TrackContextMenu(IContextMenu *popup, INT x, INT y)
Definition: CMenuBand.cpp:821
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39

Referenced by CMenuStaticToolbar::InternalContextMenu(), and CMenuSFToolbar::InternalContextMenu().

◆ UpdateImageLists()

HRESULT CMenuToolbarBase::UpdateImageLists ( )
private

Definition at line 326 of file CMenuToolbars.cpp.

327 {
328  if ((m_initFlags & (SMINIT_TOPLEVEL | SMINIT_VERTICAL)) == SMINIT_TOPLEVEL) // not vertical.
329  {
330  // No image list, prevents the buttons from having a margin at the left side
332  return S_OK;
333  }
334 
335  // Assign the correct imagelist and padding based on the current icon size
336 
337  int shiml;
338  if (m_menuBand->UseBigIcons())
339  {
340  shiml = SHIL_LARGE;
341  SetPadding(4, 0);
342  }
343  else
344  {
345  shiml = SHIL_SMALL;
346  SetPadding(4, 4);
347  }
348 
349  IImageList * piml;
350  HRESULT hr = SHGetImageList(shiml, IID_PPV_ARG(IImageList, &piml));
351  if (FAILED_UNEXPECTEDLY(hr))
352  {
354  }
355  else
356  {
357  SetImageList((HIMAGELIST)piml);
358  }
359  return S_OK;
360 }
#define SHIL_LARGE
Definition: shellapi.h:182
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2406
BOOL UseBigIcons()
Definition: CMenuBand.h:207
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define SHIL_SMALL
Definition: shellapi.h:183

Referenced by CreateToolbar(), and ShowDW().

Member Data Documentation

◆ m_cancelingPopup

BOOL CMenuToolbarBase::m_cancelingPopup
protected

Definition at line 57 of file CMenuToolbars.h.

Referenced by BeforeCancelPopup(), MenuBarMouseDown(), and MenuBarMouseUp().

◆ m_disableMouseTrack

BOOL CMenuToolbarBase::m_disableMouseTrack
private

Definition at line 35 of file CMenuToolbars.h.

Referenced by ChangeHotItem(), DisableMouseTrack(), and ProcessClick().

◆ m_dwMenuFlags

DWORD CMenuToolbarBase::m_dwMenuFlags
protected

◆ m_executeData

DWORD_PTR CMenuToolbarBase::m_executeData
protected

Definition at line 55 of file CMenuToolbars.h.

Referenced by ExecuteItem(), and PrepareExecuteItem().

◆ m_executeIndex

INT CMenuToolbarBase::m_executeIndex
protected

Definition at line 53 of file CMenuToolbars.h.

Referenced by PrepareExecuteItem().

◆ m_executeItem

INT CMenuToolbarBase::m_executeItem
protected

Definition at line 54 of file CMenuToolbars.h.

Referenced by ExecuteItem(), and PrepareExecuteItem().

◆ m_hasSizes

BOOL CMenuToolbarBase::m_hasSizes
protected

Definition at line 41 of file CMenuToolbars.h.

Referenced by AddButton(), AddPlaceholder(), AddSeparator(), ClearToolbar(), and GetSizes().

◆ m_hotBar

CMenuToolbarBase* CMenuToolbarBase::m_hotBar
protected

Definition at line 45 of file CMenuToolbars.h.

Referenced by ChangeHotItem(), IsTrackedItem(), and OnCustomDraw().

◆ m_hotItem

INT CMenuToolbarBase::m_hotItem
protected

◆ m_idealSize

SIZE CMenuToolbarBase::m_idealSize
protected

Definition at line 42 of file CMenuToolbars.h.

Referenced by CMenuToolbarBase(), GetSizes(), and SetPosSize().

◆ m_initFlags

◆ m_isTrackingPopup

BOOL CMenuToolbarBase::m_isTrackingPopup
protected

◆ m_itemSize

SIZE CMenuToolbarBase::m_itemSize
protected

Definition at line 43 of file CMenuToolbars.h.

Referenced by CMenuToolbarBase(), and GetSizes().

◆ m_marlett

HFONT CMenuToolbarBase::m_marlett
private

Definition at line 33 of file CMenuToolbars.h.

Referenced by CMenuToolbarBase(), OnCustomDraw(), and ~CMenuToolbarBase().

◆ m_menuBand

◆ m_pager

CContainedWindow CMenuToolbarBase::m_pager
private

◆ m_popupBar

CMenuToolbarBase* CMenuToolbarBase::m_popupBar
protected

◆ m_popupItem

INT CMenuToolbarBase::m_popupItem
protected

Definition at line 48 of file CMenuToolbars.h.

Referenced by ChangePopupItem(), IsTrackedItem(), OnCustomDraw(), and PopupItem().

◆ m_timerEnabled

BOOL CMenuToolbarBase::m_timerEnabled
private

Definition at line 36 of file CMenuToolbars.h.

Referenced by ChangeHotItem(), KillPopupTimer(), and OnPopupTimer().

◆ m_useFlatMenus

BOOL CMenuToolbarBase::m_useFlatMenus
private

Definition at line 34 of file CMenuToolbars.h.

Referenced by CreateToolbar(), OnCustomDraw(), OnWinEvent(), and ShowDW().

◆ m_usePager

BOOL CMenuToolbarBase::m_usePager
protected

Definition at line 44 of file CMenuToolbars.h.

Referenced by CreateToolbar().


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