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