Salome HOME
Merge with PythonAPI branch
[modules/shaper.git] / src / ModuleBase / ModuleBase_IWidgetCreator.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef ModuleBase_IWidgetCreator_H
4 #define ModuleBase_IWidgetCreator_H
5
6 #include "ModuleBase.h"
7
8 #include <set>
9 #include <string>
10 #include <memory>
11
12 class ModuleBase_ModelWidget;
13 class ModuleBase_PageBase;
14
15 class QWidget;
16
17 /** 
18 * \ingroup GUI
19 * Interface to WidgetCreator which can create specific widgets by type
20 */
21 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
22 {
23 public:
24   /// Default constructor
25   ModuleBase_IWidgetCreator();
26
27   /// Virtual destructor
28   ~ModuleBase_IWidgetCreator();
29
30   /// Returns a container of possible page types, which this creator can process
31   /// \returns types
32   virtual const std::set<std::string>& pageTypes() = 0;
33
34   /// Returns a container of possible widget types, which this creator can process
35   /// \returns types
36   virtual const std::set<std::string>& widgetTypes() = 0;
37
38   /// Create page by its type
39   /// \param theType a type
40   /// \param theParent a parent widget
41   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
42                                                 QWidget* theParent) = 0;
43
44   /// Create widget by its type
45    /// \param theType a type
46    /// \param theParent a parent widget
47   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
48                                                      QWidget* theParent = NULL) = 0;
49 };
50
51 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
52
53
54 #endif