MyGUI: MyGUI_SubWidgetManager.cpp Source File

MyGUI 3.4.3

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
20namespace MyGUI
21{
22
23 MYGUI_SINGLETON_DEFINITION(SubWidgetManager);
24
25 SubWidgetManager::SubWidgetManager() :
26 mCategoryName("BasisSkin"),
27 mStateCategoryName("BasisSkin/State"),
28 mSingletonHolder(this)
29 {
30 }
31
32 void SubWidgetManager::initialise()
33 {
34 MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
35 MYGUI_LOG(Info, "* Initialise: " << getClassTypeName());
36
37 FactoryManager& factory = FactoryManager::getInstance();
38
39 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "SubSkin");
40 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "MainSkin");
41 factory.registerFactory<SubSkinStateInfo>(mStateCategoryName, "PolygonalSkin");
42 factory.registerFactory<RotatingSkinStateInfo>(mStateCategoryName, "RotatingSkin");
43 factory.registerFactory<TileRectStateInfo>(mStateCategoryName, "TileRect");
44 factory.registerFactory<EditTextStateInfo>(mStateCategoryName, "EditText");
45 factory.registerFactory<EditTextStateInfo>(mStateCategoryName, "SimpleText");
46
47 factory.registerFactory<SubSkin>(mCategoryName);
48 factory.registerFactory<MainSkin>(mCategoryName);
49 factory.registerFactory<PolygonalSkin>(mCategoryName);
50 factory.registerFactory<RotatingSkin>(mCategoryName);
51 factory.registerFactory<TileRect>(mCategoryName);
52 factory.registerFactory<EditText>(mCategoryName);
53 factory.registerFactory<SimpleText>(mCategoryName);
54
55 MYGUI_LOG(Info, getClassTypeName() << " successfully initialized");
56 mIsInitialise = true;
57 }
58
59 void SubWidgetManager::shutdown()
60 {
61 MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
62 MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName());
63
64 FactoryManager& factory = FactoryManager::getInstance();
65
66 factory.unregisterFactory(mStateCategoryName, "SubSkin");
67 factory.unregisterFactory(mStateCategoryName, "MainSkin");
68 factory.unregisterFactory(mStateCategoryName, "PolygonalSkin");
69 factory.unregisterFactory(mStateCategoryName, "RotatingSkin");
70 factory.unregisterFactory(mStateCategoryName, "TileRect");
71 factory.unregisterFactory(mStateCategoryName, "EditText");
72 factory.unregisterFactory(mStateCategoryName, "SimpleText");
73
74 factory.unregisterFactory<SubSkin>(mCategoryName);
75 factory.unregisterFactory<MainSkin>(mCategoryName);
76 factory.unregisterFactory<PolygonalSkin>(mCategoryName);
77 factory.unregisterFactory<RotatingSkin>(mCategoryName);
78 factory.unregisterFactory<TileRect>(mCategoryName);
79 factory.unregisterFactory<EditText>(mCategoryName);
80 factory.unregisterFactory<SimpleText>(mCategoryName);
81
82 MYGUI_LOG(Info, getClassTypeName() << " successfully shutdown");
83 mIsInitialise = false;
84 }
85
86 const std::string& SubWidgetManager::getCategoryName() const
87 {
88 return mCategoryName;
89 }
90
91 const std::string& SubWidgetManager::getStateCategoryName() const
92 {
93 return mStateCategoryName;
94 }
95
96} // namespace MyGUI
MyGUI_CommonStateInfo.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition MyGUI_Diagnostic.h:31
MYGUI_LOG
#define MYGUI_LOG(level, text)
Definition MyGUI_Diagnostic.h:17
MyGUI_EditText.h
MyGUI_FactoryManager.h
MyGUI_MainSkin.h
MyGUI_PolygonalSkin.h
MyGUI_Precompiled.h
MyGUI_RotatingSkin.h
MyGUI_SimpleText.h
MYGUI_SINGLETON_DEFINITION
#define MYGUI_SINGLETON_DEFINITION(ClassName)
Definition MyGUI_Singleton.h:126
MyGUI_SubSkin.h
MyGUI_SubWidgetManager.h
MyGUI_TileRect.h
MyGUI::EditText
Definition MyGUI_EditText.h:26
MyGUI::EditTextStateInfo
Definition MyGUI_CommonStateInfo.h:165
MyGUI::FactoryManager
Definition MyGUI_FactoryManager.h:19
MyGUI::FactoryManager::registerFactory
void registerFactory(std::string_view _category, std::string_view _type, Delegate::IDelegate *_delegate)
Definition MyGUI_FactoryManager.cpp:39
MyGUI::FactoryManager::getInstance
static FactoryManager & getInstance()
MyGUI::FactoryManager::unregisterFactory
void unregisterFactory(std::string_view _category, std::string_view _type)
Definition MyGUI_FactoryManager.cpp:54
MyGUI::MainSkin
Definition MyGUI_MainSkin.h:17
MyGUI::PolygonalSkin
Definition MyGUI_PolygonalSkin.h:20
MyGUI::RotatingSkin
Definition MyGUI_RotatingSkin.h:19
MyGUI::RotatingSkinStateInfo
Definition MyGUI_CommonStateInfo.h:111
MyGUI::SimpleText
Definition MyGUI_SimpleText.h:20
MyGUI::SubSkin
Definition MyGUI_SubSkin.h:24
MyGUI::SubSkinStateInfo
Definition MyGUI_CommonStateInfo.h:20
MyGUI::SubWidgetManager
Definition MyGUI_SubWidgetManager.h:17
MyGUI::SubWidgetManager::getStateCategoryName
const std::string & getStateCategoryName() const
Definition MyGUI_SubWidgetManager.cpp:91
MyGUI::SubWidgetManager::SubWidgetManager
SubWidgetManager()
Definition MyGUI_SubWidgetManager.cpp:25
MyGUI::SubWidgetManager::initialise
void initialise()
Definition MyGUI_SubWidgetManager.cpp:32
MyGUI::SubWidgetManager::getClassTypeName
static std::string_view getClassTypeName()
MyGUI::SubWidgetManager::shutdown
void shutdown()
Definition MyGUI_SubWidgetManager.cpp:59
MyGUI::SubWidgetManager::getCategoryName
const std::string & getCategoryName() const
Definition MyGUI_SubWidgetManager.cpp:86
MyGUI::TileRect
Definition MyGUI_TileRect.h:23
MyGUI::TileRectStateInfo
Definition MyGUI_CommonStateInfo.h:50
MyGUI
Definition MyGUI_ActionController.h:15