MyGUI  3.2.1
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"
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 
27  mIsInitialise(false),
28  mCategoryName("BasisSkin"),
29  mStateCategoryName("BasisSkin/State")
30  {
31  }
32 
34  {
35  MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
36  MYGUI_LOG(Info, "* Initialise: " << getClassTypeName());
37 
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 
61  {
62  MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
63  MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName());
64 
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