MyGUI  3.2.0
MyGUI_SubWidgetManager.cpp
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #include "MyGUI_Precompiled.h"
00023 #include "MyGUI_SubWidgetManager.h"
00024 #include "MyGUI_FactoryManager.h"
00025 #include "MyGUI_CommonStateInfo.h"
00026 
00027 #include "MyGUI_SubSkin.h"
00028 #include "MyGUI_MainSkin.h"
00029 #include "MyGUI_PolygonalSkin.h"
00030 #include "MyGUI_RotatingSkin.h"
00031 #include "MyGUI_SimpleText.h"
00032 #include "MyGUI_EditText.h"
00033 #include "MyGUI_TileRect.h"
00034 
00035 namespace MyGUI
00036 {
00037 
00038     template <> SubWidgetManager* Singleton<SubWidgetManager>::msInstance = nullptr;
00039     template <> const char* Singleton<SubWidgetManager>::mClassTypeName("SubWidgetManager");
00040 
00041     SubWidgetManager::SubWidgetManager() :
00042         mIsInitialise(false)
00043     {
00044     }
00045 
00046     void SubWidgetManager::initialise()
00047     {
00048         MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
00049         MYGUI_LOG(Info, "* Initialise: " << getClassTypeName());
00050 
00051         FactoryManager& factory = FactoryManager::getInstance();
00052 
00053         factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "SubSkin");
00054         factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "MainSkin");
00055         factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "PolygonalSkin");
00056         factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "RotatingSkin");
00057         factory.registerFactory<TileRectStateInfo>("BasisSkin/State", "TileRect");
00058         factory.registerFactory<EditTextStateInfo>("BasisSkin/State", "EditText");
00059         factory.registerFactory<EditTextStateInfo>("BasisSkin/State", "SimpleText");
00060 
00061         factory.registerFactory<SubSkin>("BasisSkin");
00062         factory.registerFactory<MainSkin>("BasisSkin");
00063         factory.registerFactory<PolygonalSkin>("BasisSkin");
00064         factory.registerFactory<RotatingSkin>("BasisSkin");
00065         factory.registerFactory<TileRect>("BasisSkin");
00066         factory.registerFactory<EditText>("BasisSkin");
00067         factory.registerFactory<SimpleText>("BasisSkin");
00068 
00069         MYGUI_LOG(Info, getClassTypeName() << " successfully initialized");
00070         mIsInitialise = true;
00071     }
00072 
00073     void SubWidgetManager::shutdown()
00074     {
00075         MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
00076         MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName());
00077 
00078         FactoryManager& factory = FactoryManager::getInstance();
00079 
00080         factory.unregisterFactory("BasisSkin/State", "SubSkin");
00081         factory.unregisterFactory("BasisSkin/State", "MainSkin");
00082         factory.unregisterFactory("BasisSkin/State", "PolygonalSkin");
00083         factory.unregisterFactory("BasisSkin/State", "RotatingSkin");
00084         factory.unregisterFactory("BasisSkin/State", "TileRect");
00085         factory.unregisterFactory("BasisSkin/State", "EditText");
00086         factory.unregisterFactory("BasisSkin/State", "SimpleText");
00087 
00088         factory.unregisterFactory<SubSkin>("BasisSkin");
00089         factory.unregisterFactory<MainSkin>("BasisSkin");
00090         factory.unregisterFactory<PolygonalSkin>("BasisSkin");
00091         factory.unregisterFactory<RotatingSkin>("BasisSkin");
00092         factory.unregisterFactory<TileRect>("BasisSkin");
00093         factory.unregisterFactory<EditText>("BasisSkin");
00094         factory.unregisterFactory<SimpleText>("BasisSkin");
00095 
00096         MYGUI_LOG(Info, getClassTypeName() << " successfully shutdown");
00097         mIsInitialise = false;
00098     }
00099 
00100 } // namespace MyGUI