case NM_TOOLTIPSCREATED:
break;
- // Unknown
- case -714: return S_FALSE;
+ case TBN_DRAGOUT: return S_FALSE;
default:
TRACE("WM_NOTIFY unknown code %d, %d\n", hdr->code, hdr->idFrom);
HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResult)
{
- bool isHot, isPopup;
+ bool isHot, isPopup, isActive;
TBBUTTONINFO btni;
switch (cdraw->nmcd.dwDrawStage)
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;
}
else
{
+ // Set the text color, will be used by the internal drawing code
+ cdraw->clrText = GetSysColor(isActive ? COLOR_MENUTEXT : COLOR_GRAYTEXT);
+
// Remove HOT and CHECKED flags (will restore HOT if necessary)
cdraw->nmcd.uItemState &= ~CDIS_HOT;
{
if (m_menuBand->_CallCBWithItemPidl(item, 0x10000000, 0, 0) == S_FALSE)
{
- DPA_AppendPtr(dpaSort, ILClone(item));
+ DPA_AppendPtr(dpaSort, item);
+ }
+ else
+ {
+ CoTaskMemFree(item);
}
hr = eidl->Next(1, &item, NULL);