Game Accessibility Library logo SourceForge.net Logo
Game Accessibility Suite: CATGUI/CATGuiFactory.cpp Source File

CATGuiFactory.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 /// \file CATGuiFactory.cpp
00003 /// \brief Base Object factory for creating objects from XML
00004 /// \ingroup CATGUI
00005 /// 
00006 /// Copyright (c) 2003-2008 by Michael Ellison.
00007 /// See COPYING.txt for the \ref gaslicense License (MIT License).
00008 ///
00009 // $Author: mikeellison $
00010 // $Date: 2008-01-25 05:11:25 -0600 (Fri, 25 Jan 2008) $
00011 // $Revision:   $
00012 // $NoKeywords: $
00013 //
00014 //
00015 //---------------------------------------------------------------------------
00016 #include "CATGuiFactory.h"
00017 #include "CATResultCore.h"
00018 
00019 // Skin class
00020 #include "CATSkin.h"
00021 
00022 // Window class
00023 #include "CATWindow.h"
00024 
00025 // Controls
00026 #include "CATControl.h"
00027 #include "CATButton.h"
00028 #include "CATAppButton.h"
00029 #include "CATSwitch.h"
00030 #include "CATSlider.h"
00031 #include "CATKnob.h"
00032 #include "CATLabel.h"
00033 #include "CATPicture.h"
00034 #include "CATEditBox.h"
00035 #include "CATListBox.h"
00036 #include "CATTreeCtrl.h"
00037 #include "CATProgress.h"
00038 #include "CATMenu.h"
00039 #include "CATLayer.h"
00040 #include "CATTab.h"
00041 #include "CATRadioButton.h"
00042 #include "CATComboBox.h"
00043 #include "CATSwitchMulti.h"
00044 #include "CATPictureMulti.h"
00045 
00046 //---------------------------------------------------------------------------
00047 CATGuiFactory::CATGuiFactory(const CATString& skinRoot, const CATString& skinPath)
00048 : CATXMLFactory()
00049 {
00050     fSkinRoot = skinRoot;
00051     fSkinPath = skinPath;
00052 }
00053 
00054 //---------------------------------------------------------------------------
00055 CATGuiFactory::~CATGuiFactory()
00056 {
00057 }
00058 
00059 
00060 CATXMLObject* CATGuiFactory::CreateObject( const CATWChar* objType)
00061 {
00062     CATXMLObject* newObject = 0;
00063 
00064     if (wcscmp(objType, L"Skin"     ) == 0 )  newObject = new CATSkin    ( objType, fSkinRoot, fSkinPath);   
00065     else if (wcscmp(objType, L"Window"   ) == 0 )  newObject = new CATWindow  ( objType, fSkinRoot);   
00066     else if (wcscmp(objType, L"Button"   ) == 0 )  newObject = new CATButton  ( objType, fSkinRoot);
00067     else if (wcscmp(objType, L"Switch"   ) == 0 )  newObject = new CATSwitch  ( objType,  fSkinRoot);
00068     else if (wcscmp(objType, L"SwitchMulti") == 0 )  newObject = new CATSwitchMulti  ( objType,  fSkinRoot);
00069     else if (wcscmp(objType, L"RadioButton") == 0 )newObject = new CATRadioButton  ( objType,  fSkinRoot);
00070     else if (wcscmp(objType, L"Slider"   ) == 0 )  newObject = new CATSlider  ( objType,  fSkinRoot);
00071     else if (wcscmp(objType, L"Knob"     ) == 0 )  newObject = new CATKnob    ( objType,  fSkinRoot);
00072     else if (wcscmp(objType, L"Label"    ) == 0 )  newObject = new CATLabel   ( objType,  fSkinRoot);
00073     else if (wcscmp(objType, L"Picture"  ) == 0 )  newObject = new CATPicture ( objType,  fSkinRoot);
00074     else if (wcscmp(objType, L"PictureMulti"  ) == 0 )  newObject = new CATPictureMulti ( objType,  fSkinRoot);
00075     else if (wcscmp(objType, L"EditBox"  ) == 0 )  newObject = new CATEditBox ( objType,  fSkinRoot);
00076     else if (wcscmp(objType, L"ListBox"  ) == 0 )  newObject = new CATListBox ( objType,  fSkinRoot);
00077     else if (wcscmp(objType, L"Tree"     ) == 0 )  newObject = new CATTreeCtrl( objType,  fSkinRoot);
00078     else if (wcscmp(objType, L"Progress" ) == 0 )  newObject = new CATProgress( objType,  fSkinRoot);
00079     else if (wcscmp(objType, L"Menu"     ) == 0 )  newObject = new CATMenu    ( objType,  fSkinRoot);
00080     else if (wcscmp(objType, L"Layer"    ) == 0 )  newObject = new CATLayer   ( objType,  fSkinRoot);
00081     else if (wcscmp(objType, L"Tab"      ) == 0 )  newObject = new CATTab     ( objType,  fSkinRoot);
00082     else if (wcscmp(objType, L"ComboBox" ) == 0 )  newObject = new CATComboBox( objType,  fSkinRoot);
00083     else if (wcscmp(objType, L"AppButton") == 0 )  newObject = new CATAppButton( objType, fSkinRoot);
00084     else
00085     {
00086         CATASSERT(false,"Unknown GUI type! Check the element name.");
00087         return new CATControl(objType, fSkinRoot);
00088     }
00089 
00090     return newObject;
00091 }
00092 

Generated on Mon Feb 11 04:09:53 2008 for Game Accessibility Suite by doxygen 1.5.4