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 email : webmaster.salome@opencascade.com<mailto: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   /// \return created widget or null
72   virtual QWidget* createPanelByType(const std::string& theType,
73                                      QWidget* theParent,
74                                      const FeaturePtr& theFeature);
75
76   /// Create page by its type
77   /// The default implementation is empty
78   /// \param theType a type
79   /// \param theParent a parent widget
80   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
81   virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
82                                                 QWidget* theParent,
83                                                 Config_WidgetAPI* theWidgetApi);
84
85   /// Create widget by its type
86   /// The default implementation is empty
87   /// \param theType a type
88   /// \param theParent a parent widget
89   /// \param theWidgetApi a low-level API for reading xml definitions of widgets
90   /// \param theWorkshop a workshop class instance
91   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
92                                                      QWidget* theParent,
93                                                      Config_WidgetAPI* theWidgetApi,
94                                                      ModuleBase_IWorkshop* theWorkshop);
95 };
96
97 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
98
99
100 #endif