i6engine  1.0
GUIFactory.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_MODULES_GUIFACTORY_H__
26 #define __I6ENGINE_MODULES_GUIFACTORY_H__
27 
28 #include <map>
29 #include <string>
30 
31 #include "boost/function.hpp"
32 
33 namespace i6e {
34 namespace api {
35  class GUIWidget;
36 } /* namespace api */
37 namespace modules {
38 
39  class GUICanvas;
40  class GUIManager;
41 
42  typedef boost::function<api::GUIWidget * (const std::string & name, const std::string & style)> GUIWidget_factory;
43 
48  class GUIFactory {
49  friend class GUICanvas;
50  friend class GUIManager;
51 
52  private:
53  std::map<std::string, GUIWidget_factory> _templates;
54 
58  GUIFactory();
59 
63  ~GUIFactory();
64 
71  api::GUIWidget * createGUIWidget(const std::string & name, const std::string & type, const std::string & style) const;
72 
79  void registerGUIWidgetTemplate(const std::string & name, const GUIWidget_factory & createFunc);
80 
84  GUIFactory(const GUIFactory &) = delete;
85 
89  GUIFactory & operator=(const GUIFactory &) = delete;
90  };
91 
92 } /* namespace modules */
93 } /* namespace i6e */
94 
95 #endif /* __I6ENGINE_MODULES_GUIFACTORY_H__ */
96 
This class provides methods for creating different kinds of GUI elements.
Definition: GUIFactory.h:48
boost::function< api::GUIWidget *(const std::string &name, const std::string &style)> GUIWidget_factory
Definition: GUIFactory.h:40
This class provides method to load a canvas file.
Definition: GUICanvas.h:48
Superclass for all GUI widgets.
Definition: GUIWidget.h:65
This class interacts with CEGUI. It's methods are executed in the OGRE / CEGUI thread.
Definition: GUIManager.h:77