MyGUI  3.2.0
MyGUI_SubWidgetManager.cpp
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
23 #include "MyGUI_SubWidgetManager.h"
24 #include "MyGUI_FactoryManager.h"
25 #include "MyGUI_CommonStateInfo.h"
26 
27 #include "MyGUI_SubSkin.h"
28 #include "MyGUI_MainSkin.h"
29 #include "MyGUI_PolygonalSkin.h"
30 #include "MyGUI_RotatingSkin.h"
31 #include "MyGUI_SimpleText.h"
32 #include "MyGUI_EditText.h"
33 #include "MyGUI_TileRect.h"
34 
35 namespace MyGUI
36 {
37 
38  template <> SubWidgetManager* Singleton<SubWidgetManager>::msInstance = nullptr;
39  template <> const char* Singleton<SubWidgetManager>::mClassTypeName("SubWidgetManager");
40 
42  mIsInitialise(false)
43  {
44  }
45 
47  {
48  MYGUI_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
49  MYGUI_LOG(Info, "* Initialise: " << getClassTypeName());
50 
52 
53  factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "SubSkin");
54  factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "MainSkin");
55  factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "PolygonalSkin");
56  factory.registerFactory<SubSkinStateInfo>("BasisSkin/State", "RotatingSkin");
57  factory.registerFactory<TileRectStateInfo>("BasisSkin/State", "TileRect");
58  factory.registerFactory<EditTextStateInfo>("BasisSkin/State", "EditText");
59  factory.registerFactory<EditTextStateInfo>("BasisSkin/State", "SimpleText");
60 
61  factory.registerFactory<SubSkin>("BasisSkin");
62  factory.registerFactory<MainSkin>("BasisSkin");
63  factory.registerFactory<PolygonalSkin>("BasisSkin");
64  factory.registerFactory<RotatingSkin>("BasisSkin");
65  factory.registerFactory<TileRect>("BasisSkin");
66  factory.registerFactory<EditText>("BasisSkin");
67  factory.registerFactory<SimpleText>("BasisSkin");
68 
69  MYGUI_LOG(Info, getClassTypeName() << " successfully initialized");
70  mIsInitialise = true;
71  }
72 
74  {
75  MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " is not initialised");
76  MYGUI_LOG(Info, "* Shutdown: " << getClassTypeName());
77 
79 
80  factory.unregisterFactory("BasisSkin/State", "SubSkin");
81  factory.unregisterFactory("BasisSkin/State", "MainSkin");
82  factory.unregisterFactory("BasisSkin/State", "PolygonalSkin");
83  factory.unregisterFactory("BasisSkin/State", "RotatingSkin");
84  factory.unregisterFactory("BasisSkin/State", "TileRect");
85  factory.unregisterFactory("BasisSkin/State", "EditText");
86  factory.unregisterFactory("BasisSkin/State", "SimpleText");
87 
88  factory.unregisterFactory<SubSkin>("BasisSkin");
89  factory.unregisterFactory<MainSkin>("BasisSkin");
90  factory.unregisterFactory<PolygonalSkin>("BasisSkin");
91  factory.unregisterFactory<RotatingSkin>("BasisSkin");
92  factory.unregisterFactory<TileRect>("BasisSkin");
93  factory.unregisterFactory<EditText>("BasisSkin");
94  factory.unregisterFactory<SimpleText>("BasisSkin");
95 
96  MYGUI_LOG(Info, getClassTypeName() << " successfully shutdown");
97  mIsInitialise = false;
98  }
99 
100 } // namespace MyGUI
static FactoryManager & getInstance()
static const char * getClassTypeName()
#define MYGUI_LOG(level, text)
#define MYGUI_ASSERT(exp, dest)
void unregisterFactory(const std::string &_category, const std::string &_type)
void registerFactory(const std::string &_category, const std::string &_type, Delegate::IDelegate *_delegate)
static const char * mClassTypeName