Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ModuleBase / ModuleBase_IWidgetCreator.h
1 // Copyright (C) 2014-2017  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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef ModuleBase_IWidgetCreator_H
22 #define ModuleBase_IWidgetCreator_H
23
24 #include "ModuleBase.h"
25
26 #include "ModelAPI_Feature.h"
27
28 #include <set>
29 #include <string>
30 #include <memory>
31
32 class ModuleBase_ModelWidget;
33 class ModuleBase_PageBase;
34 class ModuleBase_IWorkshop;
35
36 class Config_WidgetAPI;
37
38 class QWidget;
39
40 /** 
41 * \ingroup GUI
42 * Interface to WidgetCreator which can create specific widgets by type
43 */
44 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
45 {
46 public:
47   /// Default constructor
48   ModuleBase_IWidgetCreator();
49
50   /// Virtual destructor
51   ~ModuleBase_IWidgetCreator();
52
53   /// Returns a container of possible page types, which this creator can process
54   /// The default implementation is empty
55   /// \param theTypes a list of type names
56   virtual void panelTypes(std::set<std::string>& theTypes) {}
57
58   /// Returns a container of possible page types, which this creator can process
59   /// The default implementation is empty
60   /// \param theTypes a list of type names
61   virtual void pageTypes(std::set<std::string>& theTypes) {}
62
63   /// Returns a container of possible widget types, which this creator can process
64   /// \param theTypes a list of type names
65   virtual void widgetTypes(std::set<std::string>& theTypes) {}
66
67   /// Create panel control by its type.
68   /// The default implementation is empty
69   /// \param theType a panel type
70   /// \param theParent a parent widget
71   /// \param theFeature a feature modified in the panel
72   /// \return created widget or null
73   virtual QWidget* createPanelByType(const std::string& theType,
74                                      QWidget* theParent,
75                                      const FeaturePtr& theFeature);
76
77   /// Create page by its type
78   /// The default implementation is empty
79   /// \param theType a type
80   /// \param theParent a parent widget
81   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
82   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
83                                                 QWidget* theParent,
84                                                 Config_WidgetAPI* theWidgetApi);
85
86   /// Create widget by its type
87   /// The default implementation is empty
88   /// \param theType a type
89   /// \param theParent a parent widget
90   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
91   /// \param theWorkshop a workshop class instance
92   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
93                                                      QWidget* theParent,
94                                                      Config_WidgetAPI* theWidgetApi,
95                                                      ModuleBase_IWorkshop* theWorkshop);
96 };
97
98 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
99
100
101 #endif