1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModuleBase_IWidgetCreator_H
21 #define ModuleBase_IWidgetCreator_H
23 #include "ModuleBase.h"
25 #include "ModelAPI_Feature.h"
31 class ModuleBase_ModelWidget;
32 class ModuleBase_PageBase;
33 class ModuleBase_IWorkshop;
35 class Config_WidgetAPI;
41 * Interface to WidgetCreator which can create specific widgets by type
43 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
46 /// Default constructor
47 ModuleBase_IWidgetCreator();
49 /// Virtual destructor
50 ~ModuleBase_IWidgetCreator();
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) {}
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) {}
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) {}
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,
74 const FeaturePtr& theFeature);
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,
83 Config_WidgetAPI* theWidgetApi);
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,
93 Config_WidgetAPI* theWidgetApi,
94 ModuleBase_IWorkshop* theWorkshop);
97 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;