ns/releases/3.04/source/mod/AvHUIFactory.cpp
tankefugl 19b458f8bc Branched for 3.0.4 balance
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@141 67975925-1194-0748-b3d5-c16f83f1a3a1
2005-05-29 10:59:29 +00:00

48 lines
1.3 KiB
C++

#include "mod/AvHUIFactory.h"
#include "mod/AvHTeamHierarchy.h"
#include "mod/AvHActionButtons.h"
#include "mod/AvHScrollPanel.h"
#include "mod/AvHLogoutComponent.h"
#include "mod/AvHTechImpulsePanel.h"
// Knows how to build custom mod-specific components
UIComponent* AvHUIFactory::BuildComponent(const TRDescription& inTextRep, CSchemeManager* inSchemeManager)
{
UIComponent* theNewComponent = NULL;
// If base class can't create it, maybe it's a custom component
theNewComponent = UIFactory::BuildComponent(inTextRep, inSchemeManager);
if(!theNewComponent)
{
string theCompType = inTextRep.GetType();
if(theCompType == "TeamHierarchy")
{
theNewComponent = new AvHUITeamHierarchy();
}
else if(theCompType == "ActionButtons")
{
theNewComponent = new AvHUIActionButtons();
}
else if(theCompType == "ScrollPanel")
{
theNewComponent = new AvHUIScrollPanel();
}
else if(theCompType == "LogoutComponent")
{
theNewComponent = new AvHUILogoutComponent();
}
else if(theCompType == "TechImpulsePanel")
{
theNewComponent = new AvHUITechImpulsePanel();
}
// Initialize it
if(theNewComponent)
{
theNewComponent->AllocateAndSetProperties(inTextRep, inSchemeManager);
}
}
return theNewComponent;
}