void CDialog_PPEPrecache::FillList()
{
	ScrollBar *pScroll = m_pList_Effects->GetScrollbar();
	int scrollValue = pScroll ? pScroll->GetValue() : 0;

	m_pList_Effects->DeleteAllItems();

	GetPPCache()->ClearInvalidEntries();

	HFont fontMarlett = scheme()->GetIScheme( GetScheme() )->GetFont( "Marlett", false );

	for ( int i = 0; i < GetPPCache()->GetNumPostProcessingEffects(); i++ )
	{
		EditorPostProcessingEffect *effect = GetPPCache()->GetPostProcessingEffect( i );

		Label *pL = new Label( m_pList_Effects, "", effect->pszName );
		Button *pDel = new Button( m_pList_Effects, "", "Delete", this, VarArgs("del_effect_%i",i) );
		CheckButton *pCheck = new CheckButton( m_pList_Effects, effect->pszName, "" );

		pCheck->AddActionSignalTarget( this );
		pCheck->SetSelected( effect->bStartEnabled );

		Button *pDown = new Button( m_pList_Effects, "", "u", this, VarArgs("movedown_effect_%i",i) );
		Button *pUp = new Button( m_pList_Effects, "", "t", this, VarArgs("moveup_effect_%i",i) );

		pDown->SetFont( fontMarlett );
		pUp->SetFont( fontMarlett );

		pDel->SetContentAlignment( Label::a_center );
		pDown->SetContentAlignment( Label::a_center );
		pUp->SetContentAlignment( Label::a_center );

		m_pList_Effects->AddItem( NULL, pCheck );
		m_pList_Effects->AddItem( NULL, pDown );
		m_pList_Effects->AddItem( NULL, pUp );
		m_pList_Effects->AddItem( pL, pDel );
	}

	if ( pScroll )
		pScroll->SetValue( scrollValue );
}
//-----------------------------------------------------------------------------
// Purpose: Creates all the controls in the game options list
//-----------------------------------------------------------------------------
void CCreateMultiplayerGameGameplayPage::LoadGameOptionsList()
{
	// destroy any existing controls
	mpcontrol_t *p, *n;

	p = m_pList;
	while ( p )
	{
		n = p->next;
		//
		delete p->pControl;
		delete p->pPrompt;
		delete p;
		p = n;
	}

	m_pList = NULL;


	// Go through desciption creating controls
	CScriptObject *pObj;

	pObj = m_pDescription->pObjList;

	mpcontrol_t	*pCtrl;

	CheckButton *pBox;
	TextEntry *pEdit;
	ComboBox *pCombo;
	CScriptListItem *pListItem;

	Panel *objParent = m_pOptionsList;

	while ( pObj )
	{
		pCtrl = new mpcontrol_t( objParent, "mpcontrol_t" );
		pCtrl->type = pObj->type;

		switch ( pCtrl->type )
		{
		case O_BOOL:
			pBox = new CheckButton( pCtrl, "DescCheckButton", pObj->prompt );
			pBox->SetSelected( pObj->fdefValue != 0.0f ? true : false );
			
			pCtrl->pControl = (Panel *)pBox;
			break;
		case O_STRING:
		case O_NUMBER:
			pEdit = new TextEntry( pCtrl, "DescTextEntry");
			pEdit->InsertString(pObj->defValue);
			pCtrl->pControl = (Panel *)pEdit;
			break;
		case O_LIST:
			pCombo = new ComboBox( pCtrl, "DescComboBox", 5, false );

			pListItem = pObj->pListItems;
			while ( pListItem )
			{
				pCombo->AddItem(pListItem->szItemText, NULL);
				pListItem = pListItem->pNext;
			}

			pCombo->ActivateItemByRow((int)pObj->fdefValue);

			pCtrl->pControl = (Panel *)pCombo;
			break;
		default:
			break;
		}

		if ( pCtrl->type != O_BOOL )
		{
			pCtrl->pPrompt = new vgui::Label( pCtrl, "DescLabel", "" );
			pCtrl->pPrompt->SetContentAlignment( vgui::Label::a_west );
			pCtrl->pPrompt->SetTextInset( 5, 0 );
			pCtrl->pPrompt->SetText( pObj->prompt );
		}

		pCtrl->pScrObj = pObj;
		pCtrl->SetSize( 100, 28 );
		//pCtrl->SetBorder( scheme()->GetBorder(1, "DepressedButtonBorder") );
		m_pOptionsList->AddItem( pCtrl );

		// Link it in
		if ( !m_pList )
		{
			m_pList = pCtrl;
			pCtrl->next = NULL;
		}
		else
		{
			mpcontrol_t *p;
			p = m_pList;
			while ( p )
			{
				if ( !p->next )
				{
					p->next = pCtrl;
					pCtrl->next = NULL;
					break;
				}
				p = p->next;
			}
		}

		pObj = pObj->pNext;
	}
}