Esempio n. 1
0
void Screen::ShowDialog(Dialog *pDlg, bool fFade)
	{
	assert(pDlg);
	// do place console mode dialogs
	if (Application.isFullScreen || pDlg->IsViewportDialog())
		// exclusive or free dlg: center pos
		// evaluate own placement proc first
		if (!pDlg->DoPlacement(this, PreferredDlgRect))
			{
			if (pDlg->IsFreePlaceDialog())
				pDlg->SetPos((GetWidth() - pDlg->GetWidth()) / 2, (GetHeight() - pDlg->GetHeight()) / 2 + pDlg->IsBottomPlacementDialog()*GetHeight()/3);
			else if (IsExclusive())
				pDlg->SetPos((GetWidth() - pDlg->GetWidth()) / 2, (GetHeight() - pDlg->GetHeight()) / 2);
			else
				// non-exclusive mode at preferred viewport pos
				pDlg->SetPos(PreferredDlgRect.x+30, PreferredDlgRect.y+30);
			}
	// add to local component list at correct ordering
	int32_t iNewZ = pDlg->GetZOrdering(); Element *pEl; Dialog *pOtherDlg;
	for (pEl = GetFirst(); pEl; pEl = pEl->GetNext())
		if (pOtherDlg = pEl->GetDlg())
			if (pOtherDlg->GetZOrdering() > iNewZ)
				break;
	InsertElement(pDlg, pEl);
	// set as active, if not fading and on top
	if (!fFade && !pEl)
		// but not viewport dialogs!
		if (!pDlg->IsExternalDrawDialog())
			pActiveDlg = pDlg;
	// show it
	pDlg->fOK = false;
	pDlg->fShow = true;
	// mouse focus might have changed
	UpdateMouseFocus();
	}