Salome HOME
Issue #1368: Creation of a Qt panel. Code improvement.
[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 types
35   virtual const std::set<std::string>& pageTypes() = 0;
36
37   /// Returns a container of possible widget types, which this creator can process
38   /// \returns types
39   virtual const std::set<std::string>& widgetTypes() = 0;
40
41   /// Create page by its type
42   /// \param theType a type
43   /// \param theParent a parent widget
44   /// \param theData a low-level API for reading xml definitions of widgets
45   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
46                                                 QWidget* theParent,
47                                                 Config_WidgetAPI* theWidgetApi) = 0;
48
49   /// Create widget by its type
50   /// \param theType a type
51   /// \param theParent a parent widget
52   /// \param theData a low-level API for reading xml definitions of widgets
53   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
54                                                      QWidget* theParent,
55                                                      Config_WidgetAPI* theWidgetApi,
56                                                      ModuleBase_IWorkshop* theWorkshop) = 0;
57 };
58
59 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
60
61
62 #endif