mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[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:
parent
f2f2dd0552
commit
5618b33c3b
2 changed files with 14 additions and 2 deletions
|
@ -669,6 +669,14 @@ HRESULT STDMETHODCALLTYPE CMenuBand::IsMenuMessage(MSG *pmsg)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CMenuBand::TranslateMenuMessage(MSG *pmsg, LRESULT *plRet)
|
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;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ HRESULT CMenuToolbarBase::OnPagerCalcSize(LPNMPGCALCSIZE csize)
|
||||||
|
|
||||||
HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult)
|
HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult)
|
||||||
{
|
{
|
||||||
bool isHot, isPopup;
|
bool isHot, isPopup, isActive;
|
||||||
TBBUTTONINFO btni;
|
TBBUTTONINFO btni;
|
||||||
|
|
||||||
switch (cdraw->nmcd.dwDrawStage)
|
switch (cdraw->nmcd.dwDrawStage)
|
||||||
|
@ -160,9 +160,13 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
|
||||||
|
|
||||||
case CDDS_ITEMPREPAINT:
|
case CDDS_ITEMPREPAINT:
|
||||||
|
|
||||||
|
HWND tlw;
|
||||||
|
m_menuBand->_GetTopLevelWindow(&tlw);
|
||||||
|
|
||||||
// The item with an active submenu gets the CHECKED flag.
|
// The item with an active submenu gets the CHECKED flag.
|
||||||
isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
|
isHot = m_hotBar == this && (int) cdraw->nmcd.dwItemSpec == m_hotItem;
|
||||||
isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
|
isPopup = m_popupBar == this && (int) cdraw->nmcd.dwItemSpec == m_popupItem;
|
||||||
|
isActive = (GetForegroundWindow() == tlw) || (m_popupBar == this);
|
||||||
|
|
||||||
if (m_hotItem < 0 && isPopup)
|
if (m_hotItem < 0 && isPopup)
|
||||||
isHot = TRUE;
|
isHot = TRUE;
|
||||||
|
@ -207,7 +211,7 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set the text color, will be used by the internal drawing code
|
// 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)
|
// Remove HOT and CHECKED flags (will restore HOT if necessary)
|
||||||
cdraw->nmcd.uItemState &= ~CDIS_HOT;
|
cdraw->nmcd.uItemState &= ~CDIS_HOT;
|
||||||
|
|
Loading…
Reference in a new issue