Exemple #1
0
static pascal void sMercutioCallback(short inMenuID, short inPreviousModifiers, RichItemData* inOutItemData)
	{
	if (!sCurrentMenuItemMap)
		return;

	pair<short, short> thePair(inMenuID, inOutItemData->itemID);
	ZRef<ZMenuItem> theMenuItem = (*sCurrentMenuItemMap)[thePair];
	if (!theMenuItem)
		return;

	if (inOutItemData->cbMsg == cbBasicDataOnlyMsg || inOutItemData->cbMsg == cbGetLongestItemMsg)
		{
		ZDCFont::Style theStyle = theMenuItem->GetStyle();
		if (inOutItemData->textStyle.s != theStyle)
			{
			inOutItemData->textStyle.s = theStyle;
			inOutItemData->flags |= kChangedByCallback;
			inOutItemData->flags |= ksameAlternateAsLastTime;
			}
		inOutItemData->textStyle.s = theMenuItem->GetStyle();
		if (theMenuItem->GetPixmapCombo())
			{
			inOutItemData->flags |= kHasIcon;
			inOutItemData->flags |= ksameAlternateAsLastTime;
			inOutItemData->flags |= kChangedByCallback;
			}
		}

	if (inOutItemData->cbMsg == cbIconOnlyMsg || inOutItemData->cbMsg == cbGetLongestItemMsg)
		{
		if (theMenuItem->GetPixmapCombo())
			{
			if (inOutItemData->hIcon == nil)
				{
				inOutItemData->hIcon = (Handle)ZUtil_Mac_HL::sCIconHandleFromPixmapCombo(theMenuItem->GetPixmapCombo());
				inOutItemData->iconType = 'cicn';
				inOutItemData->flags |= ksameAlternateAsLastTime;
				inOutItemData->flags |= kChangedByCallback;
				}
			}
		}
	}