Exemplo n.º 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;
				}
			}
		}
	}
Exemplo n.º 2
0
bool TRFactory::readTagAndValueLine(const string& inString, TRDescription& outDescription)
{
    bool theSuccess = false;
    char theTag[maxLineLength];
    char theValue[maxLineLength];

    // Zero them out
    memset(theTag, ' ', maxLineLength);
    memset(theValue, ' ', maxLineLength);

    if((sscanf(inString.c_str(), "%s = %s", theTag, theValue)) == 2)
    {
        // Add it
        TRTagValuePair thePair(theTag, theValue);
        outDescription.AddPair(thePair);
        theSuccess = true;
    }

    return theSuccess;
}