//=============================================================================
// ComputerScreenBulletins
//=============================================================================

class ScreenDCubeHooker expands ComputerUIWindow;

var MenuUIHeaderWindow          winHeader;
var MenuUIActionButtonWindow    btnSpecial;
var MenuUIActionButtonWindow    btnLogout;
var MenuUIListWindow            lstBulletins;
var MenuUINormalLargeTextWindow winBulletin;

var Localized String NoBulletinsTodayText;
var Localized String BulletinsHeaderText;

var string messagesz[3];

// ----------------------------------------------------------------------
// CreateControls()
// ----------------------------------------------------------------------

function CreateControls()
{
	Super.CreateControls();

	//btnLogout = winButtonBar.AddButton(ButtonLabelLogout, HALIGN_Right);

	CreateHeaderWindow();
	CreateBulletinsListWindow();
	CreateBulletinViewWindow();
}

// ----------------------------------------------------------------------
// CreateHeaderWindow()
// ----------------------------------------------------------------------

function CreateHeaderWindow()
{
	winHeader = MenuUIHeaderWindow(winClient.NewChild(Class'MenuUIHeaderWindow'));
	winHeader.SetPos(11, 6);
	winHeader.SetSize(300, 12);
	winHeader.SetTextAlignments(HALIGN_Left, VALIGN_Top);
	winHeader.SetText(BulletinsHeaderText);
}

// ----------------------------------------------------------------------
// CreateBulletinsListWindow()
// ----------------------------------------------------------------------

function CreateBulletinsListWindow()
{
	local MenuUIScrollAreaWindow winScroll;

	winScroll = CreateScrollAreaWindow(winClient);
	winScroll.SetPos(11, 22);
	winScroll.SetSize(373, 113);

	lstBulletins = MenuUIListWindow(winScroll.clipWindow.NewChild(Class'MenuUIListWindow'));
	lstBulletins.EnableMultiSelect(False);
	lstBulletins.EnableAutoExpandColumns(False);
	lstBulletins.EnableHotKeys(False);

	lstBulletins.SetNumColumns(1);
	lstBulletins.SetColumnWidth(0, 373);
}

// ----------------------------------------------------------------------
// CreateBulletinViewWindow()
// ----------------------------------------------------------------------

function CreateBulletinViewWindow()
{
	local MenuUIScrollAreaWindow winScroll;

	winScroll = CreateScrollAreaWindow(winClient);
	winScroll.SetPos(11, 143);
	winScroll.SetSize(373, 232);

	winBulletin = MenuUINormalLargeTextWindow(winScroll.ClipWindow.NewChild(Class'MenuUINormalLargeTextWindow'));
	winBulletin.SetTextMargins(4, 1);
	winBulletin.SetWordWrap(True);
	winBulletin.SetTextAlignments(HALIGN_Left, VALIGN_Top);
}

// ----------------------------------------------------------------------
// SetNetworkTerminal()
// ----------------------------------------------------------------------

function SetNetworkTerminal(NetworkTerminal newTerm)
{
	Super.SetNetworkTerminal(newTerm);

	if (winTerm.AreSpecialOptionsAvailable())
	{
		btnSpecial = winButtonBar.AddButton(ButtonLabelSpecial, HALIGN_Left);
		CreateLeftEdgeWindow();
	}
}

// ----------------------------------------------------------------------
// SetCompOwner()
// ----------------------------------------------------------------------

function SetCompOwner(ElectronicDevices newCompOwner)
{
	local int bulletinIndex;
	local int rowId;

	Super.SetCompOwner(newCompOwner);

	// Now populate the bulletins
	if (compOwner != None)
	{
		// Now populate our list
		for(bulletinIndex=0; bulletinIndex<=2; bulletinIndex++)
		{
			if(bulletinIndex == 0)
			{
				lstBulletins.AddRow("15:53 - Unknown individual enters premises");
			}
			if(bulletinIndex == 1)
			{
				lstBulletins.AddRow("19:21 - Male and female arrested for possession of firearm");
			}
			if(bulletinIndex == 2)
			{
				lstBulletins.AddRow("19:43 - Received reports of activity in sewers");
			}
		}


		
		// Select the first row
		rowId = lstBulletins.IndexToRowId(0);
		lstBulletins.SetRow(rowId, True);
	}
	else
	{
		// No bulletins, so just print a "No Bulletins Today!" message
		winBulletin.SetText(NoBulletinsTodayText);
		winBulletin.SetTextAlignments(HALIGN_Center, VALIGN_Center);
	}
}

// ----------------------------------------------------------------------
// ButtonActivated()
// ----------------------------------------------------------------------

function bool ButtonActivated( Window buttonPressed )
{
	local bool bHandled;

	bHandled = True;

	switch( buttonPressed )
	{
		case btnLogout:
			CloseScreen("EXIT");
			break;

		case btnSpecial:
			CloseScreen("SPECIAL");
			break;

		default:
			bHandled = False;
			break;
	}

	if (bHandled)
		return True;
	else
		return Super.ButtonActivated(buttonPressed);
}

// ----------------------------------------------------------------------
// ListSelectionChanged() 
//
// Show the appropriate bulletin
// ----------------------------------------------------------------------

event bool ListSelectionChanged(window list, int numSelections, int focusRowId)
{
	local int bulletinIndex;
	local string strboiz;

	bulletinIndex = lstBulletins.RowIdToIndex(focusRowId);
	winBulletin.SetText("");

	strboiz = messagesz[bulletinIndex];

	winBulletin.SetText(strboiz);
}

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

defaultproperties
{
    backgroundStyle=DSTY_Translucent
     messagesz(0)="15:53 - Unknown individual enters premises|n|n Surveillance will follow and individual|n will be detained if necessary."
     messagesz(1)="19:21 - Male and female arrested for possession of firearm|n|n Young caucasian male and female were arrested|n for the possession of a firearm [pistol].|n|n Female released without charge. Male detained - pending investigation. |n Weapon has been siezed."
     messagesz(2)="19:43 - Received reports of activity in sewers|n|n Reports of suspicious activity in sewers near the Black Box Tavern|n Gone to investigate - aforementioned firearm remains on me."
     NoBulletinsTodayText="Error - Report Bug"
     BulletinsHeaderText="Police Security Notes"
     Title="Notes"
     ClientWidth=395
     ClientHeight=412
     clientTextures(0)=Texture'DeusExUI.UserInterface.ComputerBulletinBackground_1'
     clientTextures(1)=Texture'DeusExUI.UserInterface.ComputerBulletinBackground_2'
     clientTextures(2)=Texture'DeusExUI.UserInterface.ComputerBulletinBackground_3'
     clientTextures(3)=Texture'DeusExUI.UserInterface.ComputerBulletinBackground_4'
     textureRows=2
     textureCols=2
     statusPosY=383
     defaultStatusLeftOffset=12
     ComputerNodeFunctionLabel=""
}
