MyGUI: MyGUI_SubWidgetManager.cpp Source File

MyGUI 3.2.2

MyGUI_SubWidgetManager.cpp
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #include "MyGUI_Precompiled.h"
8 #include "MyGUI_SubWidgetManager.h"
9 #include "MyGUI_FactoryManager.h"
10 #include "MyGUI_CommonStateInfo.h"
11
12 #include "MyGUI_SubSkin.h"
13 #include "MyGUI_MainSkin.h"
14 #include "MyGUI_PolygonalSkin.h"
15 #include "MyGUI_RotatingSkin.h"
16 #include "MyGUI_SimpleText.h"
17 #include "MyGUI_EditText.h"
18 #include "MyGUI_TileRect.h"
19
20 namespace MyGUI
21 {
22
23 template <> SubWidgetManager* Singleton<SubWidgetManager>::msInstance = nullptr;
24 template <> const char* Singleton<SubWidgetManager>::mClassTypeName = "SubWidgetManager";
25
26 SubWidgetManager::SubWidgetManager() :
27 mIsInitialise(false),
28 mCategoryName("BasisSkin"),
29 mStateCategoryName("BasisSkin/State")
30 {
31 }
32
33 void SubWidgetManager::initialise()
34 {
35 MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
36 MYGUI_LOG(Info, "* Initialise: " << getClassTypeName());
37
38 FactoryManager& factory = FactoryManager::getInstance();
39
40 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "SubSkin");
41 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "MainSkin");
42 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "PolygonalSkin");
43 factory.registerFactory<RotatingSkinStateInfo>(mStateCategoryName, "RotatingSkin");
44 factory.registerFactory<TileRectStateInfo>(mStateCategoryName, "TileRect");
45 factory.registerFactory<EditTextStateInfo>(mStateCategoryName, "EditText");
46 factory.registerFactory<EditTextStateInfo>(mStateCategoryName, "SimpleText");
47
48 factory.registerFactory<SubSkin>(mCategoryName);
49 factory.registerFactory<MainSkin>(mCategoryName);
50 factory.registerFactory<PolygonalSkin>(mCategoryName);
51 factory.registerFactory<RotatingSkin>(mCategoryName);
52 factory.registerFactory<TileRect>(mCategoryName);
53 factory.registerFactory<EditText>(mCategoryName);
54 factory.registerFactory<SimpleText>(mCategoryName);
55
56 MYGUI_LOG(Info, getClassTypeName() << " successfully initialized");
57 mIsInitialise = true;
58 }
59
60 void SubWidgetManager::shutdown()
61 {
62 MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
63 MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName());
64
65 FactoryManager& factory = FactoryManager::getInstance();
66
67 factory.unregisterFactory(mStateCategoryName, "SubSkin");
68 factory.unregisterFactory(mStateCategoryName, "MainSkin");
69 factory.unregisterFactory(mStateCategoryName, "PolygonalSkin");
70 factory.unregisterFactory(mStateCategoryName, "RotatingSkin");
71 factory.unregisterFactory(mStateCategoryName, "TileRect");
72 factory.unregisterFactory(mStateCategoryName, "EditText");
73 factory.unregisterFactory(mStateCategoryName, "SimpleText");
74
75 factory.unregisterFactory<SubSkin>(mCategoryName);
76 factory.unregisterFactory<MainSkin>(mCategoryName);
77 factory.unregisterFactory<PolygonalSkin>(mCategoryName);
78 factory.unregisterFactory<RotatingSkin>(mCategoryName);
79 factory.unregisterFactory<TileRect>(mCategoryName);
80 factory.unregisterFactory<EditText>(mCategoryName);
81 factory.unregisterFactory<SimpleText>(mCategoryName);
82
83 MYGUI_LOG(Info, getClassTypeName() << " successfully shutdown");
84 mIsInitialise = false;
85 }
86
87 const std::string& SubWidgetManager::getCategoryName() const
88 {
89 return mCategoryName;
90 }
91
92 const std::string& SubWidgetManager::getStateCategoryName() const
93 {
94 return mStateCategoryName;
95 }
96
97 } // namespace MyGUI
MyGUI::Singleton< FactoryManager >::getInstance
static FactoryManager & getInstance()
Definition: MyGUI_Singleton.h:38
MyGUI::FactoryManager::unregisterFactory
void unregisterFactory(const std::string &_category, const std::string &_type)
Definition: MyGUI_FactoryManager.cpp:46
MyGUI::EditTextStateInfo
Definition: MyGUI_CommonStateInfo.h:179
MyGUI::SubWidgetManager::shutdown
void shutdown()
Definition: MyGUI_SubWidgetManager.cpp:60
MyGUI::SubWidgetManager::getStateCategoryName
const std::string & getStateCategoryName() const
Definition: MyGUI_SubWidgetManager.cpp:92
MyGUI::FactoryManager
Definition: MyGUI_FactoryManager.h:18
MyGUI::Singleton< SubWidgetManager >::getClassTypeName
static const char * getClassTypeName()
Definition: MyGUI_Singleton.h:49
MyGUI::FactoryManager::registerFactory
void registerFactory(const std::string &_category, const std::string &_type, Delegate::IDelegate *_delegate)
Definition: MyGUI_FactoryManager.cpp:40
MyGUI::SubSkin
Definition: MyGUI_SubSkin.h:23
MyGUI_CommonStateInfo.h
MyGUI::PolygonalSkin
Definition: MyGUI_PolygonalSkin.h:18
MyGUI_Precompiled.h
MyGUI_SubSkin.h
MyGUI::SubWidgetManager::SubWidgetManager
SubWidgetManager()
Definition: MyGUI_SubWidgetManager.cpp:26
MyGUI_SimpleText.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition: MyGUI_Diagnostic.h:42
MyGUI::SubSkinStateInfo
Definition: MyGUI_CommonStateInfo.h:19
MyGUI::EditText
Definition: MyGUI_EditText.h:25
MYGUI_LOG
#define MYGUI_LOG(level, text)
Definition: MyGUI_Diagnostic.h:22
MyGUI::TileRect
Definition: MyGUI_TileRect.h:22
MyGUI_TileRect.h
MyGUI_MainSkin.h
MyGUI_EditText.h
MyGUI::RotatingSkin
Definition: MyGUI_RotatingSkin.h:18
MyGUI::SimpleText
Definition: MyGUI_SimpleText.h:19
MyGUI::TileRectStateInfo
Definition: MyGUI_CommonStateInfo.h:52
MyGUI::RotatingSkinStateInfo
Definition: MyGUI_CommonStateInfo.h:119
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI_PolygonalSkin.h
MyGUI::SubWidgetManager::getCategoryName
const std::string & getCategoryName() const
Definition: MyGUI_SubWidgetManager.cpp:87
MyGUI::SubWidgetManager::initialise
void initialise()
Definition: MyGUI_SubWidgetManager.cpp:33
MyGUI::MainSkin
Definition: MyGUI_MainSkin.h:16
MyGUI_SubWidgetManager.h
MyGUI_RotatingSkin.h
MyGUI_FactoryManager.h