Пример #1
0
bool CDesignCollection::FireGetGlobalDockScreen (CSpaceObject *pObj, CString *retsScreen, int *retiPriority)

//	FireGetGlobalDockScreen
//
//	Allows types to override the dock screen for an object

	{
	int i;
	int iBestPriority = -1;
	CString sBestScreen;

	//	Loop over all types and get the highest priority screen

	for (i = 0; i < m_EventsCache[evtGetGlobalDockScreen]->GetCount(); i++)
		{
		SEventHandlerDesc Event;
		CDesignType *pType = m_EventsCache[evtGetGlobalDockScreen]->GetEntry(i, &Event);

		int iPriority;
		CString sScreen;
		if (pType->FireGetGlobalDockScreen(Event, pObj, &sScreen, &iPriority)
				&& iPriority > iBestPriority)
			{
			iBestPriority = iPriority;
			sBestScreen = sScreen;
			}
		}

	//	If none found, then we're done

	if (iBestPriority == -1)
		return false;

	//	Otherwise, return screen

	if (retsScreen)
		*retsScreen = sBestScreen;

	if (retiPriority)
		*retiPriority = iBestPriority;

	return true;
	}
Пример #2
0
bool CDesignCollection::FireGetGlobalDockScreen (CSpaceObject *pObj, CString *retsScreen, ICCItem **retpData, int *retiPriority)

//	FireGetGlobalDockScreen
//
//	Allows types to override the dock screen for an object.
//	NOTE: If we return TRUE, callers must discard *retpData.

	{
	int i;
	CCodeChain &CC = g_pUniverse->GetCC();

	int iBestPriority = -1;
	CString sBestScreen;
	ICCItem *pBestData = NULL;

	//	Loop over all types and get the highest priority screen

	for (i = 0; i < m_EventsCache[evtGetGlobalDockScreen]->GetCount(); i++)
		{
		SEventHandlerDesc Event;
		CDesignType *pType = m_EventsCache[evtGetGlobalDockScreen]->GetEntry(i, &Event);

		int iPriority;
		CString sScreen;
		ICCItem *pData;
		if (pType->FireGetGlobalDockScreen(Event, pObj, &sScreen, &pData, &iPriority))
			{
			if (iPriority > iBestPriority)
				{
				iBestPriority = iPriority;
				sBestScreen = sScreen;

				if (pBestData)
					pBestData->Discard(&CC);

				pBestData = pData;
				}
			else
				{
				if (pData)
					pData->Discard(&CC);
				}
			}
		}

	//	If none found, then we're done

	if (iBestPriority == -1)
		return false;

	//	Otherwise, return screen

	if (retsScreen)
		*retsScreen = sBestScreen;

	if (retiPriority)
		*retiPriority = iBestPriority;

	if (retpData)
		*retpData = pBestData;
	else
		{
		if (pBestData)
			pBestData->Discard(&CC);
		}

	return true;
	}