MyGUI  3.0.1
MyGUI_WidgetManager.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_WIDGET_MANAGER_H__
24 #define __MYGUI_WIDGET_MANAGER_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_Instance.h"
28 #include "MyGUI_IWidgetCreator.h"
29 #include "MyGUI_IUnlinkWidget.h"
31 #include "MyGUI_Widget.h"
32 #include <set>
33 
34 namespace MyGUI
35 {
36 
37  //OBSOLETE
39 
41  {
43 
44  public:
45  //OBSOLETE
46  typedef std::map<std::string, ParseDelegate> MapDelegate;
47  //OBSOLETE
48  typedef std::set<IWidgetFactory*> SetWidgetFactory;
49 
50  public:
51  void initialise();
52  void shutdown();
53 
54  Widget* createWidget(WidgetStyle _style, const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, Widget* _parent, ICroppedRectangle * _cropeedParent, IWidgetCreator * _creator, const std::string& _name);
55 
57  void destroyWidget(Widget* _widget);
59  void destroyWidgets(const VectorWidgetPtr &_widgets);
61  void destroyWidgets(EnumeratorWidgetPtr _widgets);
62 
64  void registerUnlinker(IUnlinkWidget * _unlink);
66  void unregisterUnlinker(IUnlinkWidget * _unlink);
68  void unlinkFromUnlinkers(Widget* _widget);
69 
70  // добавляет виджет в список для анлинка
71  void addWidgetToUnlink(Widget* _widget);
72 
73  // проверяет, и если надо обнуляет виджет из списка анликнутых
74  void removeWidgetFromUnlink(Widget*& _widget);
75 
76  bool isFactoryExist(const std::string& _type);
77 
78  /*obsolete:*/
79 #ifndef MYGUI_DONT_USE_OBSOLETE
80 
81  MYGUI_OBSOLETE("use : void WidgetManager::destroyWidgets(VectorWidgetPtr &_widgets)")
82  void destroyWidgetsVector(VectorWidgetPtr &_widgets) { destroyWidgets(_widgets); }
83  MYGUI_OBSOLETE("")
84  Widget* findWidgetT(const std::string& _name, bool _throw = true);
85  MYGUI_OBSOLETE("")
86  Widget* findWidgetT(const std::string& _name, const std::string& _prefix, bool _throw = true);
87  MYGUI_OBSOLETE("")
88  void registerFactory(IWidgetFactory * _factory);
89  MYGUI_OBSOLETE("")
90  void unregisterFactory(IWidgetFactory * _factory);
91  MYGUI_OBSOLETE("use : void Widget::setProperty(const std::string &_key, const std::string &_value)")
92  void parse(Widget* _widget, const std::string &_key, const std::string &_value);
93  MYGUI_OBSOLETE("")
94  ParseDelegate& registerDelegate(const std::string& _key);
95  MYGUI_OBSOLETE("")
96  void unregisterDelegate(const std::string& _key);
97 
98  template <typename T>
99  MYGUI_OBSOLETE("")
100  T* findWidget(const std::string& _name, bool _throw = true)
101  {
102  Widget* widget = findWidgetT(_name, _throw);
103  if (nullptr == widget) return nullptr;
104  return widget->castType<T>(_throw);
105  }
106 
107  template <typename T>
108  MYGUI_OBSOLETE("")
109  T* findWidget(const std::string& _name, const std::string& _prefix, bool _throw = true)
110  {
111  return findWidget<T>(_prefix + _name, _throw);
112  }
113 
114 #endif // MYGUI_DONT_USE_OBSOLETE
115 
116  protected:
118  //MapWidgetPtr mWidgets;
120 
121  // список менеджеров для отписки при удалении
123 
124  // список виджетов для отписки
126  };
127 
128 } // namespace MyGUI
129 
130 #endif // __MYGUI_WIDGET_MANAGER_H__