summaryrefslogtreecommitdiff
path: root/vgui2/dme_controls/FactoryOverloads.cpp
blob: 5bc785c76c19ca49e9d48670246c6f0734cdba27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//

#include "KeyValues.h"
#include "dme_controls/ElementPropertiesTree.h"
#include "datamodel/dmelement.h"

#include "vgui_controls/TextEntry.h"
#include "vgui_controls/ComboBox.h"
#include "vgui_controls/Button.h"
#include "vgui_controls/PanelListPanel.h"

#include "FactoryOverloads.h"

void CFactoryOverloads::AddOverload( 
	char const *attributeName, 
	IAttributeWidgetFactory *newFactory,
	IAttributeElementChoiceList *newChoiceList )
{
	Assert( attributeName );
	Assert( newFactory || newChoiceList );

	if ( !newFactory )
	{
		return;
	}

	Entry_t e;
	e.factory = newFactory;
	e.choices = newChoiceList;

	m_Overloads.Insert( attributeName, e );
}

int CFactoryOverloads::Count()
{
	return m_Overloads.Count();
}

char const *CFactoryOverloads::Name( int index )
{
	return m_Overloads.GetElementName( index );
}

IAttributeWidgetFactory *CFactoryOverloads::Factory( int index )
{
	return m_Overloads[ index ].factory;
}

IAttributeElementChoiceList *CFactoryOverloads::ChoiceList( int index )
{
	return m_Overloads[ index ].choices;
}