[SHELL32] CMenuBand: Redraw the toolbars if this is the menu bar of a window and its active state changed. Use COLOR_GRAYTEXT for the text of the inactive menu bar items. CORE-14197

This commit is contained in:
Giannis Adamopoulos 2018-01-13 14:57:24 +02:00
parent f2f2dd0552
commit 5618b33c3b
2 changed files with 14 additions and 2 deletions

View file

@ -669,6 +669,14 @@ HRESULT STDMETHODCALLTYPE CMenuBand::IsMenuMessage(MSG *pmsg)
HRESULT STDMETHODCALLTYPE CMenuBand::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet)
{
if (pmsg->message == WM_ACTIVATE && _IsPopup() == S_FALSE)
{
if (m_staticToolbar)
m_staticToolbar->Invalidate();
if (m_SFToolbar)
m_SFToolbar->Invalidate();
}
return S_FALSE;
}

View file

@ -149,7 +149,7 @@ HRESULT CMenuToolbarBase::OnPagerCalcSize(LPNMPGCALCSIZE csize)
HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult)
{
bool isHot, isPopup;
bool isHot, isPopup, isActive;
TBBUTTONINFO btni;
switch (cdraw->nmcd.dwDrawStage)
@ -160,9 +160,13 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
case CDDS_ITEMPREPAINT:
HWND tlw;
m_menuBand->_GetTopLevelWindow(&tlw);
// The item with an active submenu gets the CHECKED flag.
isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
isActive = (GetForegroundWindow() == tlw) || (m_popupBar == this);
if (m_hotItem < 0 && isPopup)
isHot = TRUE;
@ -207,7 +211,7 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
else
{
// Set the text color, will be used by the internal drawing code
cdraw->clrText = GetSysColor(COLOR_MENUTEXT);
cdraw->clrText = GetSysColor(isActive ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
// Remove HOT and CHECKED flags (will restore HOT if necessary)
cdraw->nmcd.uItemState &= ~CDIS_HOT;