MyGUI  3.2.0
MyGUI_GenericFactory.h
Go to the documentation of this file.
1 
6 #ifndef __MYGUI_GENERIC_FACTORY_H__
7 #define __MYGUI_GENERIC_FACTORY_H__
8 
9 #include "MyGUI_Prerequest.h"
10 #include "MyGUI_Types.h"
11 #include "MyGUI_Delegate.h"
12 
13 namespace MyGUI
14 {
15 
16  template <typename Type>
18  {
19  public:
21  static typename Delegate::IDelegate* getFactory()
22  {
23  return newDelegate(createFromFactory);
24  }
25 
26  private:
27  static void createFromFactory(IObject*& _instance)
28  {
29  _instance = new Type();
30  }
31  };
32 
33 } // namespace MyGUI
34 
35 #endif // __MYGUI_GENERIC_FACTORY_H__