Salome HOME
Issue #1368: Creation of a Qt panel. Widget creator interface correction to manage...
[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   /// \returns list of type names
35   virtual const std::set<std::string>& panelTypes();
36
37   /// Returns a container of possible page types, which this creator can process
38   /// \returns list of type names
39   virtual const std::set<std::string>& pageTypes();
40
41   /// Returns a container of possible widget types, which this creator can process
42   /// \returns list of type names
43   virtual const std::set<std::string>& widgetTypes();
44
45   /// Create panel control by its type.
46   /// \param theType a panel type
47   /// \param theParent a parent widget
48   /// \return created widget or null
49   virtual QWidget* createPanelByType(const std::string& theType,
50                                      QWidget* theParent) {};
51
52   /// Create page by its type
53   /// \param theType a type
54   /// \param theParent a parent widget
55   /// \param theData a low-level API for reading xml definitions of widgets
56   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
57                                                 QWidget* theParent,
58                                                 Config_WidgetAPI* theWidgetApi) {};
59
60   /// Create widget by its type
61   /// \param theType a type
62   /// \param theParent a parent widget
63   /// \param theData a low-level API for reading xml definitions of widgets
64   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
65                                                      QWidget* theParent,
66                                                      Config_WidgetAPI* theWidgetApi,
67                                                      ModuleBase_IWorkshop* theWorkshop) {};
68 };
69
70 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
71
72
73 #endif