ReactOS  0.4.13-dev-961-g238ea69
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 265 of file CMenuToolbars.cpp.

265  :
266  m_pager(this, 1),
270  m_menuBand(menuBand),
271  m_dwMenuFlags(0),
272  m_hasSizes(FALSE),
273  m_usePager(usePager),
274  m_hotBar(NULL),
275  m_hotItem(-1),
276  m_popupBar(NULL),
277  m_popupItem(-1),
280 {
281  m_idealSize.cx = 0;
282  m_idealSize.cy = 0;
283  m_itemSize.cx = 0;
284  m_itemSize.cy = 0;
286  0, 0, 0, 0, 0, 0, 0, 0, DEFAULT_CHARSET,
288  DEFAULT_QUALITY, FF_DONTCARE, L"Marlett");
289 }
#define DEFAULT_QUALITY
Definition: wingdi.h:435
#define FF_DONTCARE
Definition: wingdi.h:447
#define DEFAULT_CHARSET
Definition: wingdi.h:383
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
#define CreateFont
Definition: wingdi.h:4428
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:414
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
static const WCHAR L[]
Definition: oid.c:1250
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG cy
Definition: windef.h:320

◆ ~CMenuToolbarBase()

CMenuToolbarBase::~CMenuToolbarBase ( )
virtual

Definition at line 291 of file CMenuToolbars.cpp.

292 {
293  ClearToolbar();
294 
295  if (m_hWnd)
296  DestroyWindow();
297 
298  if (m_pager.m_hWnd)
299  m_pager.DestroyWindow();
300 
302 }
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 984 of file CMenuToolbars.cpp.

985 {
986  TBBUTTON tbb = { 0 };
987 
988  tbb.fsState = TBSTATE_ENABLED;
989 #if !USE_TBSTYLE_EX_VERTICAL
990  if (!last && (m_initFlags & SMINIT_VERTICAL))
991  tbb.fsState |= TBSTATE_WRAP;
992 #endif
993  tbb.fsStyle = BTNS_CHECKGROUP;
994 
995  if (hasSubMenu && (m_initFlags & SMINIT_VERTICAL))
996  tbb.fsStyle |= BTNS_DROPDOWN;
997 
998  if (!(m_initFlags & SMINIT_VERTICAL))
999  tbb.fsStyle |= BTNS_AUTOSIZE;
1000 
1001  tbb.iString = (INT_PTR) caption;
1002  tbb.idCommand = commandId;
1003 
1004  tbb.iBitmap = iconId;
1005  tbb.dwData = buttonData;
1006 
1007  m_hasSizes = FALSE;
1008 
1009  if (!AddButtons(1, &tbb))
1010  return HRESULT_FROM_WIN32(GetLastError());
1011  return S_OK;
1012 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
POINT last
Definition: font.c:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define BTNS_AUTOSIZE
Definition: commctrl.h:976
int32_t INT_PTR
Definition: typedefs.h:62
BYTE fsStyle
Definition: commctrl.h:924
#define BTNS_CHECKGROUP
Definition: commctrl.h:974
INT_PTR iString
Definition: commctrl.h:931
DWORD_PTR dwData
Definition: commctrl.h:930
int iBitmap
Definition: commctrl.h:921
#define BTNS_DROPDOWN
Definition: commctrl.h:975
int idCommand
Definition: commctrl.h:922
#define S_OK
Definition: intsafe.h:59
#define TBSTATE_ENABLED
Definition: commctrl.h:946
#define TBSTATE_WRAP
Definition: commctrl.h:949
BYTE fsState
Definition: commctrl.h:923

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

◆ AddPlaceholder()

HRESULT CMenuToolbarBase::AddPlaceholder ( )
protected

Definition at line 1034 of file CMenuToolbars.cpp.

1035 {
1036  TBBUTTON tbb = { 0 };
1037  WCHAR MenuString[128];
1038 
1039  LoadStringW(GetModuleHandle(L"shell32.dll"), IDS_MENU_EMPTY, MenuString, _countof(MenuString));
1040 
1041  tbb.fsState = 0;
1042  tbb.fsStyle = 0;
1043  tbb.iString = (INT_PTR) MenuString;
1044  tbb.iBitmap = -1;
1045 
1046  m_hasSizes = FALSE;
1047 
1048  if (!AddButtons(1, &tbb))
1049  return HRESULT_FROM_WIN32(GetLastError());
1050 
1051  return S_OK;
1052 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define _countof(array)
Definition: fontsub.cpp:30
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT_PTR
Definition: typedefs.h:62
BYTE fsStyle
Definition: commctrl.h:924
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
INT_PTR iString
Definition: commctrl.h:931
int iBitmap
Definition: commctrl.h:921
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_MENU_EMPTY
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define GetModuleHandle
Definition: winbase.h:3641
BYTE fsState
Definition: commctrl.h:923

Referenced by CMenuSFToolbar::FillToolbar().

◆ AddSeparator()

HRESULT CMenuToolbarBase::AddSeparator ( BOOL  last)
protected

Definition at line 1014 of file CMenuToolbars.cpp.

1015 {
1016  TBBUTTON tbb = { 0 };
1017 
1018  tbb.fsState = TBSTATE_ENABLED;
1019 #if !USE_TBSTYLE_EX_VERTICAL
1020  if (!last && (m_initFlags & SMINIT_VERTICAL))
1021  tbb.fsState |= TBSTATE_WRAP;
1022 #endif
1023  tbb.fsStyle = BTNS_SEP;
1024  tbb.iBitmap = 0;
1025 
1026  m_hasSizes = FALSE;
1027 
1028  if (!AddButtons(1, &tbb))
1029  return HRESULT_FROM_WIN32(GetLastError());
1030 
1031  return S_OK;
1032 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
POINT last
Definition: font.c:46
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BYTE fsStyle
Definition: commctrl.h:924
int iBitmap
Definition: commctrl.h:921
#define BTNS_SEP
Definition: commctrl.h:971
#define S_OK
Definition: intsafe.h:59
#define TBSTATE_ENABLED
Definition: commctrl.h:946
#define TBSTATE_WRAP
Definition: commctrl.h:949
BYTE fsState
Definition: commctrl.h:923

Referenced by CMenuStaticToolbar::FillToolbar().

◆ BeforeCancelPopup()

HRESULT CMenuToolbarBase::BeforeCancelPopup ( )

Definition at line 791 of file CMenuToolbars.cpp.

792 {
794  TRACE("BeforeCancelPopup\n");
795  return S_OK;
796 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by CMenuBand::_BeforeCancelPopup().

◆ CancelCurrentPopup()

HRESULT CMenuToolbarBase::CancelCurrentPopup ( )

Definition at line 1093 of file CMenuToolbars.cpp.

1094 {
1095  return m_menuBand->_CancelCurrentPopup();
1096 }
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 575 of file CMenuToolbars.cpp.

576 {
577  // Ignore the change if it already matches the stored info
578  if (m_hotBar == toolbar && m_hotItem == item)
579  return S_FALSE;
580 
581  // Prevent a change of hot item if the change was triggered by the mouse,
582  // and mouse tracking is disabled.
584  {
585  TRACE("Hot item change prevented by DisableMouseTrack\n");
586  return S_OK;
587  }
588 
589  // Notify the toolbar if the hot-tracking left this toolbar
590  if (m_hotBar == this && toolbar != this)
591  {
592  SetHotItem(-1);
593  }
594 
595  TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar, m_hotItem, toolbar, item);
596  m_hotBar = toolbar;
597  m_hotItem = item;
598 
599  if (m_hotBar == this)
600  {
601  if (m_isTrackingPopup && !(m_initFlags & SMINIT_VERTICAL))
602  {
603  // If the menubar has an open submenu, switch to the new item's submenu immediately
605  }
606  else if (dwFlags & HICF_MOUSE)
607  {
608  // Vertical menus show/hide the submenu after a delay,
609  // but only with the mouse.
610  if (m_initFlags & SMINIT_VERTICAL)
611  {
612  DWORD elapsed = 0;
613  SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
614  SetTimer(TIMERID_HOTTRACK, elapsed);
616  TRACE("SetTimer called with m_hotItem=%d\n", m_hotItem);
617  }
618  }
619  else
620  {
622  info.cbSize = sizeof(info);
623  info.dwMask = 0;
624 
625  int index = GetButtonInfo(item, &info);
626 
627  SetHotItem(index);
628  }
629  }
630 
631  InvalidateDraw();
632  return S_OK;
633 }
#define TRUE
Definition: types.h:120
#define SystemParametersInfo
Definition: winuser.h:5759
struct _test_info info[]
Definition: SetCursorPos.c:19
#define TIMERID_HOTTRACK
#define S_FALSE
Definition: winerror.h:2357
#define HICF_MOUSE
Definition: commctrl.h:1298
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:59
static ATOM item
Definition: dde.c:856
#define TBBUTTONINFO
Definition: commctrl.h:1226

Referenced by CMenuBand::_ChangeHotItem().

◆ ChangePopupItem()

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

Definition at line 635 of file CMenuToolbars.cpp.

636 {
637  // Ignore the change if it already matches the stored info
638  if (m_popupBar == toolbar && m_popupItem == item)
639  return S_FALSE;
640 
641  // Notify the toolbar if the popup-tracking this toolbar
642  if (m_popupBar == this && toolbar != this)
643  {
644  CheckButton(m_popupItem, FALSE);
646  }
647 
648  m_popupBar = toolbar;
649  m_popupItem = item;
650 
651  if (m_popupBar == this)
652  {
653  CheckButton(m_popupItem, TRUE);
654  }
655 
656  InvalidateDraw();
657  return S_OK;
658 }
#define TRUE
Definition: types.h:120
#define S_FALSE
Definition: winerror.h:2357
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define S_OK
Definition: intsafe.h:59
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 683 of file CMenuToolbars.cpp.

684 {
685  TBBUTTON btn;
686  BOOL wasTracking = LOWORD(lParam);
687  BOOL mouse = HIWORD(lParam);
688  INT idx = (INT)wParam;
689 
690  if (idx < 0)
691  {
694  }
695 
696  if (!GetButton(idx, &btn))
697  return E_FAIL;
698 
699  TRACE("ChangeTrackedItem %d, %d\n", idx, wasTracking);
700  m_isTrackingPopup = wasTracking;
701  return m_menuBand->_ChangeHotItem(this, btn.idCommand, mouse ? HICF_MOUSE : 0);
702 }
#define INT
Definition: polytest.cpp:20
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
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:1298
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int idCommand
Definition: commctrl.h:922
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define HIWORD(l)
Definition: typedefs.h:246
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ ClearToolbar()

HRESULT CMenuToolbarBase::ClearToolbar ( )
protected

Definition at line 1054 of file CMenuToolbars.cpp.

1055 {
1056  while (DeleteButton(0))
1057  {
1058  // empty;
1059  }
1060  m_hasSizes = FALSE;
1061  return S_OK;
1062 }
#define S_OK
Definition: intsafe.h:59

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

◆ Close()

HRESULT CMenuToolbarBase::Close ( )

Definition at line 358 of file CMenuToolbars.cpp.

359 {
360  if (m_hWnd)
361  DestroyWindow();
362 
363  if (m_pager.m_hWnd)
364  m_pager.DestroyWindow();
365 
366  return S_OK;
367 }
BOOL WINAPI DestroyWindow(_In_ HWND)
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:59

Referenced by CMenuBand::CloseDW().

◆ CreateToolbar()

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

Definition at line 369 of file CMenuToolbars.cpp.

370 {
375 
376  if (dwFlags & SMINIT_VERTICAL)
377  {
378  // Activate vertical semantics
379  tbStyles |= CCS_VERT;
380 
381 #if USE_TBSTYLE_EX_VERTICAL
382  tbExStyles |= TBSTYLE_EX_VERTICAL;
383 #endif
384  }
385 
387 
388  // Get a temporary rect to use while creating the toolbar window.
389  // Ensure that it is not a null rect.
390  RECT rc;
391  if (!::GetClientRect(hwndParent, &rc) ||
392  (rc.left == rc.right) ||
393  (rc.top == rc.bottom))
394  {
395  rc.left = 0;
396  rc.top = 0;
397  rc.right = 1;
398  rc.bottom = 1;
399  }
400 
401  SubclassWindow(CToolbar::Create(hwndParent, tbStyles, tbExStyles));
402 
403  SetWindowTheme(m_hWnd, L"", L"");
404 
405  SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
406 
408 
409  // If needed, create the pager.
410  if (m_usePager)
411  {
412  LONG pgStyles = PGS_VERT | WS_CHILD | WS_VISIBLE;
413  LONG pgExStyles = 0;
414 
415  HWND hwndPager = CreateWindowEx(
416  pgExStyles, WC_PAGESCROLLER, NULL,
417  pgStyles, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
418  hwndParent, NULL, _AtlBaseModule.GetModuleInstance(), 0);
419 
420  m_pager.SubclassWindow(hwndPager);
421 
422  ::SetParent(m_hWnd, hwndPager);
423 
424  m_pager.SendMessageW(PGM_SETCHILD, 0, reinterpret_cast<LPARAM>(m_hWnd));
425  }
426 
427  // Configure the image lists
429 
430  return S_OK;
431 }
#define TBSTYLE_EX_DOUBLEBUFFER
Definition: commctrl.h:986
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:254
#define WC_PAGESCROLLER
Definition: commctrl.h:4472
#define TBSTYLE_CUSTOMERASE
Definition: commctrl.h:966
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:968
#define SystemParametersInfo
Definition: winuser.h:5759
LONG top
Definition: windef.h:292
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define PGM_SETCHILD
Definition: commctrl.h:4488
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define CCS_VERT
Definition: commctrl.h:2221
#define CCS_NODIVIDER
Definition: commctrl.h:2220
#define TBSTYLE_REGISTERDROP
Definition: commctrl.h:967
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:5656
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define CCS_TOP
Definition: commctrl.h:2214
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2218
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:961
#define CCS_NORESIZE
Definition: commctrl.h:2217
static const WCHAR L[]
Definition: oid.c:1250
_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:59
#define PGS_VERT
Definition: commctrl.h:4474
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:294
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:965
#define TBSTYLE_FLAT
Definition: commctrl.h:964
#define TBSTYLE_EX_VERTICAL
Definition: commctrl.h:983

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:59

Referenced by CMenuBand::_DisableMouseTrack().

◆ ExecuteItem()

HRESULT CMenuToolbarBase::ExecuteItem ( )

Definition at line 879 of file CMenuToolbars.cpp.

880 {
882 }
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 1064 of file CMenuToolbars.cpp.

1065 {
1066  if (pData)
1067  *pData = NULL;
1068 
1069  if (pIndex)
1070  *pIndex = -1;
1071 
1072  if (iItem < 0)
1073  return S_OK;
1074 
1075  TBBUTTONINFO info = { 0 };
1076 
1077  info.cbSize = sizeof(TBBUTTONINFO);
1078  info.dwMask = TBIF_COMMAND | TBIF_LPARAM;
1079 
1080  int index = GetButtonInfo(iItem, &info);
1081  if (index < 0)
1082  return E_FAIL;
1083 
1084  if (pIndex)
1085  *pIndex = index;
1086 
1087  if (pData)
1088  *pData = info.lParam;
1089 
1090  return S_OK;
1091 }
#define TBIF_COMMAND
Definition: commctrl.h:1196
#define TBIF_LPARAM
Definition: commctrl.h:1195
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
#define S_OK
Definition: intsafe.h:59
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4564
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define TBBUTTONINFO
Definition: commctrl.h:1226

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

◆ GetSizes()

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

Definition at line 433 of file CMenuToolbars.cpp.

434 {
435  if (pMinSize)
436  *pMinSize = m_idealSize;
437  if (pMaxSize)
438  *pMaxSize = m_idealSize;
439  if (pIntegralSize)
440  *pIntegralSize = m_itemSize;
441 
442  if (m_hasSizes)
443  return S_OK;
444 
445  TRACE("Sizes out of date, recalculating.\n");
446 
447  if (!m_hWnd)
448  {
449  return S_OK;
450  }
451 
452  // Obtain the ideal size, to be used as min and max
453  GetMaxSize(&m_idealSize);
454  GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize);
455 
456  TRACE("Ideal Size: (%d, %d) for %d buttons\n", m_idealSize, GetButtonCount());
457 
458  // Obtain the button size, to be used as the integral size
459  DWORD size = GetButtonSize();
462  m_hasSizes = TRUE;
463 
464  if (pMinSize)
465  *pMinSize = m_idealSize;
466  if (pMaxSize)
467  *pMaxSize = m_idealSize;
468  if (pIntegralSize)
469  *pIntegralSize = m_itemSize;
470 
471  return S_OK;
472 }
#define TRUE
Definition: types.h:120
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
LONG cx
Definition: windef.h:319
#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:59
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
LONG cy
Definition: windef.h:320

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 505 of file CMenuToolbars.cpp.

506 {
507  if (!phwnd)
508  return E_FAIL;
509 
510  if (m_pager.m_hWnd)
511  *phwnd = m_pager.m_hWnd;
512  else
513  *phwnd = m_hWnd;
514 
515  return S_OK;
516 }
#define E_FAIL
Definition: ddrawi.h:102
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:59

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 304 of file CMenuToolbars.cpp.

305 {
307 }
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by ChangeHotItem(), and ChangePopupItem().

◆ IsTrackedItem()

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

Definition at line 660 of file CMenuToolbars.cpp.

661 {
662  TBBUTTON btn;
663  INT idx = (INT)wParam;
664 
665  if (m_hotBar != this)
666  return S_FALSE;
667 
668  if (idx < 0)
669  return S_FALSE;
670 
671  if (!GetButton(idx, &btn))
672  return E_FAIL;
673 
674  if (m_hotItem == btn.idCommand)
675  return S_OK;
676 
677  if (m_popupItem == btn.idCommand)
678  return S_OK;
679 
680  return S_FALSE;
681 }
#define INT
Definition: polytest.cpp:20
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:56
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:922
#define S_OK
Definition: intsafe.h:59

◆ IsWindowOwner()

HRESULT CMenuToolbarBase::IsWindowOwner ( HWND  hwnd)

Definition at line 498 of file CMenuToolbars.cpp.

499 {
500  if (m_hWnd && m_hWnd == hwnd) return S_OK;
501  if (m_pager.m_hWnd && m_pager.m_hWnd == hwnd) return S_OK;
502  return S_FALSE;
503 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define S_FALSE
Definition: winerror.h:2357
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
#define S_OK
Definition: intsafe.h:59

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

◆ KeyboardItemChange()

HRESULT CMenuToolbarBase::KeyboardItemChange ( DWORD  changeType)

Definition at line 884 of file CMenuToolbars.cpp.

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

◆ KillPopupTimer()

HRESULT CMenuToolbarBase::KillPopupTimer ( )

Definition at line 564 of file CMenuToolbars.cpp.

565 {
566  if (m_timerEnabled)
567  {
570  return S_OK;
571  }
572  return S_FALSE;
573 }
#define TIMERID_HOTTRACK
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define S_OK
Definition: intsafe.h:59

Referenced by CMenuBand::_KillPopupTimers().

◆ MenuBarMouseDown()

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

Definition at line 837 of file CMenuToolbars.cpp.

838 {
839  TBBUTTON btn;
840 
841  GetButton(iIndex, &btn);
842 
843  if ((m_initFlags & SMINIT_VERTICAL)
844  || m_popupBar
845  || m_cancelingPopup)
846  {
848  return S_OK;
849  }
850 
851  return ProcessClick(btn.idCommand);
852 }
HRESULT ProcessClick(INT iItem)
int idCommand
Definition: commctrl.h:922
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
#define S_OK
Definition: intsafe.h:59

Referenced by CMenuBand::_MenuBarMouseDown().

◆ MenuBarMouseUp()

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

Definition at line 854 of file CMenuToolbars.cpp.

855 {
856  TBBUTTON btn;
857 
859 
860  if (!(m_initFlags & SMINIT_VERTICAL))
861  return S_OK;
862 
863  GetButton(iIndex, &btn);
864 
865  if (isLButton)
866  return ProcessClick(btn.idCommand);
867  else
868  return ProcessContextMenu(btn.idCommand);
869 }
HRESULT ProcessClick(INT iItem)
HRESULT ProcessContextMenu(INT iItem)
int idCommand
Definition: commctrl.h:922
#define S_OK
Definition: intsafe.h:59

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  return S_OK;
263 }
#define TRUE
Definition: types.h:120
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
#define DrawTextEx
Definition: winuser.h:5673
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
const WCHAR * text
Definition: package.c:1827
HRESULT _GetTopLevelWindow(HWND *topLevel)
Definition: CMenuBand.cpp:874
#define TBCDRF_NOOFFSET
Definition: commctrl.h:1007
#define TBIF_STYLE
Definition: commctrl.h:1194
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:270
#define DT_RIGHT
Definition: winuser.h:538
LONG right
Definition: windef.h:293
#define TBCDRF_NOEDGES
Definition: commctrl.h:1005
DWORD WINAPI GetSysColor(_In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define TRANSPARENT
Definition: wingdi.h:949
COLORREF clrText
Definition: commctrl.h:993
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_MENU
Definition: winuser.h:907
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:260
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
NMCUSTOMDRAW nmcd
Definition: commctrl.h:989
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:285
#define CDIS_HOT
Definition: commctrl.h:282
#define COLOR_MENUTEXT
Definition: winuser.h:910
CMenuToolbarBase * m_hotBar
Definition: CMenuToolbars.h:45
#define CDIS_CHECKED
Definition: commctrl.h:279
#define TBCDRF_NOMARK
Definition: commctrl.h:1008
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define COLOR_GRAYTEXT
Definition: winuser.h:922
static const WCHAR L[]
Definition: oid.c:1250
#define BTNS_DROPDOWN
Definition: commctrl.h:975
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:888
#define DT_SINGLELINE
Definition: winuser.h:540
#define S_OK
Definition: intsafe.h:59
DWORD_PTR dwItemSpec
Definition: commctrl.h:292
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1012
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:271
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define TBBUTTONINFO
Definition: commctrl.h:1226
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 518 of file CMenuToolbars.cpp.

519 {
520  INT index;
522 
523  INT iItem = tip->iItem;
524 
525  GetDataFromId(iItem, &index, &dwData);
526 
527  return InternalGetTooltip(iItem, index, dwData, tip->pszText, tip->cchTextMax);
528 }
HRESULT GetDataFromId(INT iItem, INT *pIndex, DWORD_PTR *pData)
static HANDLE ULONG_PTR dwData
Definition: file.c:35
int32_t INT
Definition: typedefs.h:56
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
uint32_t DWORD_PTR
Definition: typedefs.h:63
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:4555
smooth NULL
Definition: ftsmooth.c:416
#define PGF_CALCWIDTH
Definition: commctrl.h:4554
LONG cx
Definition: windef.h:319
DWORD dwFlag
Definition: commctrl.h:4559
#define S_OK
Definition: intsafe.h:59
LONG cy
Definition: windef.h:320
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 530 of file CMenuToolbars.cpp.

531 {
532  if (wParam != TIMERID_HOTTRACK)
533  {
534  bHandled = FALSE;
535  return 0;
536  }
537 
539 
540  if (!m_timerEnabled)
541  return 0;
542 
544 
545  if (m_hotItem < 0)
546  return 0;
547 
548  // Returns S_FALSE if the current item did not show a submenu
550  if (hr != S_FALSE)
551  return 0;
552 
553  // If we didn't switch submenus, cancel the current popup regardless
554  if (m_popupBar)
555  {
557  if (FAILED_UNEXPECTEDLY(hr))
558  return 0;
559  }
560 
561  return 0;
562 }
HRESULT hr
Definition: shlfolder.c:183
WPARAM wParam
Definition: combotst.c:138
#define TIMERID_HOTTRACK
#define S_FALSE
Definition: winerror.h:2357
HRESULT PopupItem(INT iItem, BOOL keyInitiated)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
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:1392
HRESULT OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT *theResult)
HRESULT hr
Definition: shlfolder.c:183
UINT uMsg
Definition: menu.cpp:213
#define TBN_BEGINDRAG
Definition: commctrl.h:1279
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define SystemParametersInfo
Definition: winuser.h:5759
#define TBN_DRAGOUT
Definition: commctrl.h:1309
WPARAM wParam
Definition: combotst.c:138
#define TBN_HOTITEMCHANGE
Definition: commctrl.h:1308
HRESULT OnGetInfoTip(NMTBGETINFOTIP *tip)
#define PGN_CALCSIZE
Definition: commctrl.h:4552
#define TBN_DROPDOWN
Definition: commctrl.h:1288
#define TTN_GETDISPINFO
Definition: commctrl.h:1850
#define S_FALSE
Definition: winerror.h:2357
#define RBN_CHILDSIZE
Definition: commctrl.h:1608
#define WM_WININICHANGE
Definition: winuser.h:1612
#define TBN_ENDDRAG
Definition: commctrl.h:1280
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
virtual HRESULT OnDeletingButton(const NMTOOLBAR *tb)=0
HRESULT OnPagerCalcSize(LPNMPGCALCSIZE csize)
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_COMMAND
Definition: winuser.h:1722
#define NM_CLICK
Definition: commctrl.h:130
#define TBN_GETINFOTIP
Definition: commctrl.h:1364
#define S_OK
Definition: intsafe.h:59
#define NM_LDOWN
Definition: commctrl.h:145
LONG_PTR LRESULT
Definition: windef.h:209
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
GLuint64EXT * result
Definition: glext.h:11304
LPARAM lParam
Definition: combotst.c:139
#define TBN_DELETINGBUTTON
Definition: commctrl.h:1310
#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 1098 of file CMenuToolbars.cpp.

1099 {
1100  INT index;
1101  DWORD_PTR dwData;
1102 
1103  if (iItem < 0)
1104  return S_OK;
1105 
1106  if (m_popupBar == this && m_popupItem == iItem)
1107  return S_OK;
1108 
1109  GetDataFromId(iItem, &index, &dwData);
1110 
1112  if (hr != S_OK)
1113  return hr;
1114 
1115  if (m_popupBar)
1116  {
1118  if (FAILED_UNEXPECTEDLY(hr))
1119  return hr;
1120  }
1121 
1122  if (!(m_initFlags & SMINIT_VERTICAL))
1123  {
1124  TRACE("PopupItem non-vertical %d %d\n", index, iItem);
1125  m_menuBand->_ChangeHotItem(this, iItem, 0);
1126  }
1127 
1128  return InternalPopupItem(iItem, index, dwData, keyInitiated);
1129 }
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:56
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:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
#define index(s, c)
Definition: various.h:29
CMenuToolbarBase * m_popupBar
Definition: CMenuToolbars.h:47
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define S_OK
Definition: intsafe.h:59
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 704 of file CMenuToolbars.cpp.

705 {
706  // Calculate the submenu position and exclude area
707  RECT rc = { 0 };
708 
709  if (!GetItemRect(index, &rc))
710  return E_FAIL;
711 
712  POINT a = { rc.left, rc.top };
713  POINT b = { rc.right, rc.bottom };
714 
715  ClientToScreen(&a);
716  ClientToScreen(&b);
717 
718  POINTL pt = { a.x, b.y };
719  RECTL rcl = { a.x, a.y, b.x, b.y };
720 
721  if (m_initFlags & SMINIT_VERTICAL)
722  {
723  // FIXME: Hardcoding this here feels hacky.
724  if (IsAppThemed())
725  {
726  pt.x = b.x - 1;
727  pt.y = a.y - 1;
728  }
729  else
730  {
731  pt.x = b.x - 3;
732  pt.y = a.y - 3;
733  }
734  }
735 
736  // Display the submenu
738 
739  m_menuBand->_ChangePopupItem(this, iItem);
740  m_menuBand->_OnPopupSubMenu(childShellMenu, &pt, &rcl, keyInitiated);
741 
742  return S_OK;
743 }
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#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:59
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:294
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 745 of file CMenuToolbars.cpp.

746 {
747  // Calculate the submenu position and exclude area
748  RECT rc = { 0 };
749 
750  if (!GetItemRect(index, &rc))
751  return E_FAIL;
752 
753  POINT a = { rc.left, rc.top };
754  POINT b = { rc.right, rc.bottom };
755 
756  ClientToScreen(&a);
757  ClientToScreen(&b);
758 
759  POINT pt = { a.x, b.y };
760  RECT rcl = { a.x, a.y, b.x, b.y };
761 
762  if (m_initFlags & SMINIT_VERTICAL)
763  {
764  pt.x = b.x;
765  pt.y = a.y;
766  }
767 
768  HMENU popup = GetSubMenu(menu, index);
769 
770  // Display the submenu
772  m_menuBand->_ChangePopupItem(this, iItem);
773  m_menuBand->_TrackSubMenu(popup, pt.x, pt.y, rcl);
776 
777  return S_OK;
778 }
#define TRUE
Definition: types.h:120
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:292
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
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:59
HRESULT _TrackSubMenu(HMENU popup, INT x, INT y, RECT &rcExclude)
Definition: CMenuBand.cpp:800
CMenuBand * m_menuBand
Definition: CMenuToolbars.h:39
LONG bottom
Definition: windef.h:294
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 871 of file CMenuToolbars.cpp.

872 {
873  this->m_menuBand->_KillPopupTimers();
874 
875  m_executeItem = iItem;
876  return GetDataFromId(iItem, &m_executeIndex, &m_executeData);
877 }
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 798 of file CMenuToolbars.cpp.

799 {
801  {
802  TRACE("Item click prevented by DisableMouseTrack\n");
803  return S_OK;
804  }
805 
806  // If a button is clicked while a submenu was open, cancel the submenu.
807  if (!(m_initFlags & SMINIT_VERTICAL) && m_isTrackingPopup)
808  {
809  TRACE("OnCommand cancelled because it was tracking submenu.\n");
810  return S_FALSE;
811  }
812 
813  if (PopupItem(iItem, FALSE) == S_OK)
814  {
815  TRACE("PopupItem returned S_OK\n");
816  return S_FALSE;
817  }
818 
819  TRACE("Executing...\n");
820 
821  return m_menuBand->_MenuItemSelect(MPOS_EXECUTE);
822 }
#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:59
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 824 of file CMenuToolbars.cpp.

825 {
826  INT index;
827  DWORD_PTR data;
828 
829  GetDataFromId(iItem, &index, &data);
830 
831  DWORD pos = GetMessagePos();
833 
834  return InternalContextMenu(iItem, index, data, pt);
835 }
#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:1350
int32_t INT
Definition: typedefs.h:56
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:63
#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 474 of file CMenuToolbars.cpp.

475 {
476  // Update the toolbar or pager to fit the requested rect
477  // If we have a pager, set the toolbar height to the ideal height of the toolbar
478  if (m_pager.m_hWnd)
479  {
480  SetWindowPos(NULL, x, y, cx, m_idealSize.cy, 0);
481  m_pager.SetWindowPos(NULL, x, y, cx, cy, 0);
482  }
483  else
484  {
485  SetWindowPos(NULL, x, y, cx, cy, 0);
486  }
487 
488  // In a vertical menu, resize the buttons to fit the width
489  if (m_initFlags & SMINIT_VERTICAL)
490  {
491  DWORD btnSize = GetButtonSize();
492  SetButtonSize(cx, GET_Y_LPARAM(btnSize));
493  }
494 
495  return S_OK;
496 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
smooth NULL
Definition: ftsmooth.c:416
CContainedWindow m_pager
Definition: CMenuToolbars.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
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:570
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG cy
Definition: windef.h:320

Referenced by CMenuBand::OnPosRectChangeDB().

◆ ShowDW()

HRESULT CMenuToolbarBase::ShowDW ( BOOL  fShow)

Definition at line 309 of file CMenuToolbars.cpp.

310 {
311  ShowWindow(fShow ? SW_SHOW : SW_HIDE);
312 
313  // Ensure that the right image list is assigned to the toolbar
315 
316  // For custom-drawing
317  SystemParametersInfo(SPI_GETFLATMENU, 0, &m_useFlatMenus, 0);
318 
319  return S_OK;
320 }
#define SW_HIDE
Definition: winuser.h:762
#define SystemParametersInfo
Definition: winuser.h:5759
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HRESULT UpdateImageLists()
#define SW_SHOW
Definition: winuser.h:769
#define S_OK
Definition: intsafe.h:59

Referenced by CMenuBand::ShowDW().

◆ TrackContextMenu()

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

Definition at line 780 of file CMenuToolbars.cpp.

781 {
782  // Cancel submenus
784  if (m_popupBar)
786 
787  // Display the context menu
788  return m_menuBand->_TrackContextMenu(contextMenu, pt.x, pt.y);
789 }
#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 322 of file CMenuToolbars.cpp.

323 {
324  if ((m_initFlags & (SMINIT_TOPLEVEL | SMINIT_VERTICAL)) == SMINIT_TOPLEVEL) // not vertical.
325  {
326  // No image list, prevents the buttons from having a margin at the left side
328  return S_OK;
329  }
330 
331  // Assign the correct imagelist and padding based on the current icon size
332 
333  int shiml;
334  if (m_menuBand->UseBigIcons())
335  {
336  shiml = SHIL_LARGE;
337  SetPadding(4, 0);
338  }
339  else
340  {
341  shiml = SHIL_SMALL;
342  SetPadding(4, 4);
343  }
344 
345  IImageList * piml;
346  HRESULT hr = SHGetImageList(shiml, IID_PPV_ARG(IImageList, &piml));
347  if (FAILED_UNEXPECTEDLY(hr))
348  {
350  }
351  else
352  {
353  SetImageList((HIMAGELIST)piml);
354  }
355  return S_OK;
356 }
#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:2007
smooth NULL
Definition: ftsmooth.c:416
BOOL UseBigIcons()
Definition: CMenuBand.h:207
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
static VOID SetImageList(HWND hwnd)
Definition: mplay32.c:238
#define S_OK
Definition: intsafe.h:59
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: