Salome HOME
Task #3235: Projection without link to source shape
[modules/shaper.git] / src / ModuleBase / ModuleBase_IWidgetCreator.h
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef ModuleBase_IWidgetCreator_H
21 #define ModuleBase_IWidgetCreator_H
22
23 #include "ModuleBase.h"
24
25 #include "ModelAPI_Feature.h"
26
27 #include <set>
28 #include <string>
29 #include <memory>
30
31 class ModuleBase_ModelWidget;
32 class ModuleBase_PageBase;
33 class ModuleBase_IWorkshop;
34
35 class Config_WidgetAPI;
36
37 class QWidget;
38
39 /** 
40 * \ingroup GUI
41 * Interface to WidgetCreator which can create specific widgets by type
42 */
43 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
44 {
45 public:
46   /// Default constructor
47   ModuleBase_IWidgetCreator();
48
49   /// Virtual destructor
50   ~ModuleBase_IWidgetCreator();
51
52   /// Returns a container of possible page types, which this creator can process
53   /// The default implementation is empty
54   /// \param theTypes a list of type names
55   virtual void panelTypes(std::set<std::string>& theTypes) {}
56
57   /// Returns a container of possible page types, which this creator can process
58   /// The default implementation is empty
59   /// \param theTypes a list of type names
60   virtual void pageTypes(std::set<std::string>& theTypes) {}
61
62   /// Returns a container of possible widget types, which this creator can process
63   /// \param theTypes a list of type names
64   virtual void widgetTypes(std::set<std::string>& theTypes) {}
65
66   /// Create panel control by its type.
67   /// The default implementation is empty
68   /// \param theType a panel type
69   /// \param theParent a parent widget
70   /// \param theFeature a feature modified in the panel
71   /// \param theWidgetApi a low-level API for reading xml definitions of widget
72   /// \return created widget or null
73   virtual QWidget* createPanelByType(const std::string& theType,
74                                      QWidget* theParent,
75                                      const FeaturePtr& theFeature,
76                                      Config_WidgetAPI* theWidgetApi = 0);
77
78   /// Create page by its type
79   /// The default implementation is empty
80   /// \param theType a type
81   /// \param theParent a parent widget
82   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
83   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
84                                                 QWidget* theParent,
85                                                 Config_WidgetAPI* theWidgetApi);
86
87   /// Create widget by its type
88   /// The default implementation is empty
89   /// \param theType a type
90   /// \param theParent a parent widget
91   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
92   /// \param theWorkshop a workshop class instance
93   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
94                                                      QWidget* theParent,
95                                                      Config_WidgetAPI* theWidgetApi,
96                                                      ModuleBase_IWorkshop* theWorkshop);
97 };
98
99 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
100
101
102 #endif