1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_WidgetCreatorFactory.cpp
4 // Created: 03 Dec 2015
5 // Author: Natalia ERMOLAEVA
7 #ifndef MODULEBASE_WIDGETCREATORFACTORY_H_
8 #define MODULEBASE_WIDGETCREATORFACTORY_H_
10 #include <ModuleBase.h>
17 #include <ModuleBase_IWidgetCreator.h>
19 class ModuleBase_ModelWidget;
25 * A class for creation of widgets instances in for property panel using XML deskription of
28 class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory
31 // Returns an singular instance of the class if it exists or create it
32 static std::shared_ptr<ModuleBase_WidgetCreatorFactory> get();
35 virtual ~ModuleBase_WidgetCreatorFactory();
37 /// The creator is added to the internal container to be used when the createWidgetByType is called
38 /// \param theCreator a new widget creator
39 void registerCreator(const WidgetCreatorPtr& theCreator);
41 /// Create widget by its type
42 /// \param theType a type
43 /// \param theParent a parent widget
44 ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
45 QWidget* theParent = NULL);
48 /// Constructor is hidden
49 ModuleBase_WidgetCreatorFactory();
51 /// List of created model widgets
52 QMap<std::string, WidgetCreatorPtr> myModelWidgets;
55 typedef std::shared_ptr<ModuleBase_WidgetCreatorFactory> WidgetCreatorFactoryPtr;
57 #endif /* MODULEBASE_WIDGETCREATORFACTORY_H_ */