MyGUI 3.2.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

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::RotatingSkin
Definition: MyGUI_RotatingSkin.h:18
MyGUI_FactoryManager.h
MyGUI::SimpleText
Definition: MyGUI_SimpleText.h:19
MyGUI::SubSkin
Definition: MyGUI_SubSkin.h:23
MyGUI_Precompiled.h
MyGUI_SimpleText.h
MyGUI::Singleton< FactoryManager >::getInstance
static FactoryManager & getInstance()
Definition: MyGUI_Singleton.h:38
MyGUI::SubWidgetManager::shutdown
void shutdown()
Definition: MyGUI_SubWidgetManager.cpp:60
MyGUI::Singleton< SubWidgetManager >::getClassTypeName
static const char * getClassTypeName()
Definition: MyGUI_Singleton.h:49
MyGUI_MainSkin.h
MyGUI_TileRect.h
MyGUI_SubWidgetManager.h
MyGUI::SubWidgetManager::SubWidgetManager
SubWidgetManager()
Definition: MyGUI_SubWidgetManager.cpp:26
MyGUI::FactoryManager
Definition: MyGUI_FactoryManager.h:18
MYGUI_LOG
#define MYGUI_LOG(level, text)
Definition: MyGUI_Diagnostic.h:22
MyGUI::MainSkin
Definition: MyGUI_MainSkin.h:16
MyGUI_PolygonalSkin.h
MyGUI::EditTextStateInfo
Definition: MyGUI_CommonStateInfo.h:179
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::RotatingSkinStateInfo
Definition: MyGUI_CommonStateInfo.h:119
MyGUI_CommonStateInfo.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition: MyGUI_Diagnostic.h:42
MyGUI::PolygonalSkin
Definition: MyGUI_PolygonalSkin.h:18
MyGUI::TileRect
Definition: MyGUI_TileRect.h:22
MyGUI::TileRectStateInfo
Definition: MyGUI_CommonStateInfo.h:52
MyGUI::SubSkinStateInfo
Definition: MyGUI_CommonStateInfo.h:19
MyGUI::FactoryManager::unregisterFactory
void unregisterFactory(const std::string &_category, const std::string &_type)
Definition: MyGUI_FactoryManager.cpp:46
MyGUI::FactoryManager::registerFactory
void registerFactory(const std::string &_category, const std::string &_type, Delegate::IDelegate *_delegate)
Definition: MyGUI_FactoryManager.cpp:40
MyGUI::SubWidgetManager::getCategoryName
const std::string & getCategoryName() const
Definition: MyGUI_SubWidgetManager.cpp:87
MyGUI_EditText.h
MyGUI::SubWidgetManager::initialise
void initialise()
Definition: MyGUI_SubWidgetManager.cpp:33
MyGUI::SubWidgetManager::getStateCategoryName
const std::string & getStateCategoryName() const
Definition: MyGUI_SubWidgetManager.cpp:92
MyGUI_SubSkin.h
MyGUI::EditText
Definition: MyGUI_EditText.h:25
MyGUI_RotatingSkin.h