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