Salome HOME
Fix for issue #1174
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetCreatorFactory.h
index 40db320086f97470c398c924a2febeee4522331c..98f4d211d1b514d8f5d6f83e70766e6da8f1b0b0 100755 (executable)
@@ -17,6 +17,8 @@
 #include <ModuleBase_IWidgetCreator.h>
 
 class ModuleBase_ModelWidget;
+class ModuleBase_PageBase;
+class ModuleBase_IWorkshop;
 
 class QWidget;
 
@@ -38,18 +40,36 @@ class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory
   /// \param theCreator a new widget creator
   void registerCreator(const WidgetCreatorPtr& theCreator);
 
+  /// Returns true if there is a creator, which can make a page by the type
+  /// \param theType a type
+  bool hasPageWidget(const std::string& theType);
+
+  /// Create page by its type
+  /// \param theType a type
+  /// \param theParent a parent widget
+  ModuleBase_PageBase* createPageByType(const std::string& theType,
+                                        QWidget* theParent,
+                                        Config_WidgetAPI* theWidgetApi,
+                                        std::string theParentId);
+
   /// Create widget by its type
   /// \param theType a type
   /// \param theParent a parent widget
   ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
-                                             QWidget* theParent = NULL);
+                                             QWidget* theParent,
+                                             Config_WidgetAPI* theWidgetApi,
+                                             std::string theParentId,
+                                             ModuleBase_IWorkshop* theWorkshop);
 
 private:
   /// Constructor is hidden
   ModuleBase_WidgetCreatorFactory();
 
-  /// List of created model widgets
-  QMap<std::string, WidgetCreatorPtr> myModelWidgets;
+  /// Map of widget type in XML to creator
+  QMap<std::string, WidgetCreatorPtr> myCreators;
+
+  /// Map of widget page in XML to creator
+  QMap<std::string, WidgetCreatorPtr> myPageToCreator;
 };
 
 typedef std::shared_ptr<ModuleBase_WidgetCreatorFactory> WidgetCreatorFactoryPtr;