Esempio n. 1
0
/**
 * Draw notification window
 */
void ToasterBox::Play()
{
	//create new window
	ToasterBoxWindow* tb = new ToasterBoxWindow(parent, this);
	//If it is GamePromotion make window wider and show it a bit longer
	if (notificationType == UiEvents::EventType::GamePromoted) {
		const int widthCorrection = 100;
		const int pauseCorrection = 1000; //Add one second above standard pause
		tb->SetPopupSize(popupSize.GetWidth() + widthCorrection, popupSize.GetHeight());
		tb->SetPopupPosition(popupPosition.x - widthCorrection, popupPosition.y);
		tb->SetPopupPauseTime(pauseTime + pauseCorrection);
		tb->SetPopupHeaderText("GAME PROMOTED!");
	} else {
		tb->SetPopupSize(popupSize.GetWidth(), popupSize.GetHeight());
		tb->SetPopupPosition(popupPosition.x, popupPosition.y);
		tb->SetPopupPauseTime(pauseTime);
	}
	tb->SetPopupScrollSpeed(sleepTime);
	tb->SetPopupTextColor(colFg.Red(), colFg.Green(), colFg.Blue());
	tb->SetPopupBackgroundColor(colBg.Red(), colBg.Green(), colBg.Blue());
	if (m_bitmap.IsOk()) {
		tb->SetPopupBitmap(m_bitmap);
	} else if (!bitmapFile.IsEmpty()) {
		tb->SetPopupBitmap(bitmapFile);
	} else {
		//No image for ToasterBox???
//		wxASSERT(false);
	}
	tb->SetPopupText(popupText, true);

	//clean up the list
	CleanList();

	//check to see if there is already a window displayed
	//by looking at the linked list
	if (!winList->IsEmpty()) {
		//there ARE other windows displayed already
		//reclac where it should display
		MoveAbove(tb);
	}

	//shift new window on to the list
	winList->Append(tb);

	//play new window
	if (!tb->Play()) {
		//if we didn't show the window properly, remove it from the list
		winList->DeleteNode(winList->Item(winList->GetCount() - 1));
		//delete the object too.
		delete tb;
		return;
	}
}
Esempio n. 2
0
void ToasterBox::Play()
{
	//create new window
	ToasterBoxWindow* tb = new ToasterBoxWindow(parent, this);
	tb->SetPopupSize(popupSize.GetWidth(), popupSize.GetHeight());
	tb->SetPopupPosition(popupPosition.x, popupPosition.y);
	tb->SetPopupPauseTime(pauseTime);
	tb->SetPopupScrollSpeed(sleepTime);
	tb->SetPopupTextColor(colFg.Red(), colFg.Green(), colFg.Blue());
	tb->SetPopupBackgroundColor(colBg.Red(), colBg.Green(), colBg.Blue());
	if (m_bitmap.IsOk())
		tb->SetPopupBitmap(m_bitmap);
	if (!bitmapFile.IsEmpty())
		tb->SetPopupBitmap(bitmapFile);
	tb->SetPopupText(popupText, true);

	//clean up the list
	CleanList();

	//check to see if there is already a window displayed
	//by looking at the linked list
	if (!winList->IsEmpty()) {
		//there ARE other windows displayed already
		//reclac where it should display
		MoveAbove(tb);
	}

	//shift new window on to the list
	winList->Append(tb);

	//play new window
	if (!tb->Play()) {
		//if we didn't show the window properly, remove it from the list
		winList->DeleteNode(winList->Item(winList->GetCount() - 1));
		//delete the object too.
		tb = 0;
		return;
	}
}