Salome HOME
Update classes documentation
[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 "ModelAPI_Feature.h"
9
10 #include <set>
11 #include <string>
12 #include <memory>
13
14 class ModuleBase_ModelWidget;
15 class ModuleBase_PageBase;
16 class ModuleBase_IWorkshop;
17
18 class Config_WidgetAPI;
19
20 class QWidget;
21
22 /** 
23 * \ingroup GUI
24 * Interface to WidgetCreator which can create specific widgets by type
25 */
26 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
27 {
28 public:
29   /// Default constructor
30   ModuleBase_IWidgetCreator();
31
32   /// Virtual destructor
33   ~ModuleBase_IWidgetCreator();
34
35   /// Returns a container of possible page types, which this creator can process
36   /// The default implementation is empty
37   /// \param theTypes a list of type names
38   virtual void panelTypes(std::set<std::string>& theTypes) {}
39
40   /// Returns a container of possible page types, which this creator can process
41   /// The default implementation is empty
42   /// \param theTypes a list of type names
43   virtual void pageTypes(std::set<std::string>& theTypes) {}
44
45   /// Returns a container of possible widget types, which this creator can process
46   /// \param theTypes a list of type names
47   virtual void widgetTypes(std::set<std::string>& theTypes) {}
48
49   /// Create panel control by its type.
50   /// The default implementation is empty
51   /// \param theType a panel type
52   /// \param theParent a parent widget
53   /// \param theFeature a feature modified in the panel
54   /// \return created widget or null
55   virtual QWidget* createPanelByType(const std::string& theType,
56                                      QWidget* theParent,
57                                      const FeaturePtr& theFeature);
58
59   /// Create page by its type
60   /// The default implementation is empty
61   /// \param theType a type
62   /// \param theParent a parent widget
63   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
64   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
65                                                 QWidget* theParent,
66                                                 Config_WidgetAPI* theWidgetApi);
67
68   /// Create widget by its type
69   /// The default implementation is empty
70   /// \param theType a type
71   /// \param theParent a parent widget
72   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
73   /// \param theWorkshop a workshop class instance
74   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
75                                                      QWidget* theParent,
76                                                      Config_WidgetAPI* theWidgetApi,
77                                                      ModuleBase_IWorkshop* theWorkshop);
78 };
79
80 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
81
82
83 #endif