mirror of
https://github.com/unknownworlds/NS.git
synced 2024-12-11 21:31:41 +00:00
860617f419
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@376 67975925-1194-0748-b3d5-c16f83f1a3a1
103 lines
2.3 KiB
C++
103 lines
2.3 KiB
C++
|
|
#include "ui/UIFactory.h"
|
|
#include "ui/UIComponents.h"
|
|
#include "ui/UIPieMenu.h"
|
|
|
|
UIComponent* UIFactory::BuildComponent(const TRDescription& inTextRep, CSchemeManager* inSchemeManager)
|
|
{
|
|
UIComponent* theNewComp = NULL;
|
|
string theCompType = inTextRep.GetType();
|
|
|
|
// Switch on the type to see what kind of component to create
|
|
if(theCompType == "Label")
|
|
{
|
|
theNewComp = new UILabel();
|
|
}
|
|
if(theCompType == "FadingImageLabel")
|
|
{
|
|
theNewComp = new UIFadingImageLabel();
|
|
}
|
|
if(theCompType == "MarqueeComponent")
|
|
{
|
|
theNewComp = new UIMarqueeComponent();
|
|
}
|
|
else if(theCompType == "ImageLabel")
|
|
{
|
|
theNewComp = new UIImageLabel();
|
|
}
|
|
else if(theCompType == "ProgressBar")
|
|
{
|
|
theNewComp = new UIProgressBar();
|
|
}
|
|
else if(theCompType == "TreeFolder")
|
|
{
|
|
theNewComp = new UITreeFolder();
|
|
}
|
|
else if(theCompType == "ConfigWizard")
|
|
{
|
|
theNewComp = new UIConfigWizard();
|
|
}
|
|
else if(theCompType == "Menu")
|
|
{
|
|
theNewComp = new UIMenu();
|
|
}
|
|
else if(theCompType == "PopupMenu")
|
|
{
|
|
theNewComp = new UIPopupMenu();
|
|
}
|
|
else if(theCompType == "ImagePanel")
|
|
{
|
|
theNewComp = new UIImagePanel();
|
|
}
|
|
else if(theCompType == "Button")
|
|
{
|
|
theNewComp = new UIButton();
|
|
}
|
|
else if(theCompType == "PieMenu")
|
|
{
|
|
theNewComp = new UIPieMenu();
|
|
}
|
|
else if(theCompType == "ColoredPanel")
|
|
{
|
|
theNewComp = new UIColoredPanel();
|
|
}
|
|
else if(theCompType == "InvisiblePanel")
|
|
{
|
|
theNewComp = new UIInvisiblePanel();
|
|
}
|
|
else if(theCompType == "Slider")
|
|
{
|
|
theNewComp = new UISlider();
|
|
}
|
|
else if(theCompType == "Slider2")
|
|
{
|
|
theNewComp = new UISlider2();
|
|
}
|
|
else if(theCompType == "SliderPlus")
|
|
{
|
|
theNewComp = new UISliderPlus();
|
|
}
|
|
else if(theCompType == "StaticLabel")
|
|
{
|
|
theNewComp = new UIStaticLabel();
|
|
}
|
|
else if(theCompType == "SpritePanel")
|
|
{
|
|
theNewComp = new UISpritePanel();
|
|
}
|
|
else if(theCompType == "DummyPanel")
|
|
{
|
|
theNewComp = new UIDummyPanel();
|
|
}
|
|
|
|
// TODO: More cases here
|
|
|
|
// If we recognized the type, initialize it and return it
|
|
if(theNewComp)
|
|
{
|
|
theNewComp->AllocateAndSetProperties(inTextRep, inSchemeManager);
|
|
}
|
|
|
|
return theNewComp;
|
|
}
|
|
|