1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModuleBase_IWidgetCreator_H
22 #define ModuleBase_IWidgetCreator_H
24 #include "ModuleBase.h"
26 #include "ModelAPI_Feature.h"
32 class ModuleBase_ModelWidget;
33 class ModuleBase_PageBase;
34 class ModuleBase_IWorkshop;
36 class Config_WidgetAPI;
42 * Interface to WidgetCreator which can create specific widgets by type
44 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
47 /// Default constructor
48 ModuleBase_IWidgetCreator();
50 /// Virtual destructor
51 ~ModuleBase_IWidgetCreator();
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) {}
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) {}
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) {}
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,
75 const FeaturePtr& theFeature);
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,
84 Config_WidgetAPI* theWidgetApi);
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,
94 Config_WidgetAPI* theWidgetApi,
95 ModuleBase_IWorkshop* theWorkshop);
98 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;