SHAPER 9.16.0
ModuleBase_WidgetCreatorFactory.h
1// Copyright (C) 2014-2026 CEA, EDF
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_WIDGETCREATORFACTORY_H_
21#define MODULEBASE_WIDGETCREATORFACTORY_H_
22
23#include <ModuleBase.h>
24
25#include <memory>
26#include <string>
27
28#include <QMap>
29
30#include <ModuleBase_IWidgetCreator.h>
31
32#include <ModelAPI_Feature.h>
33
37
38class QWidget;
39
45class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory
46{
47 public:
49 static std::shared_ptr<ModuleBase_WidgetCreatorFactory> get();
50
53
57 void registerCreator(const WidgetCreatorPtr& theCreator);
58
62 bool hasPanelWidget(const std::string& theType);
63
71 QWidget* createPanelByType(const std::string& theType, QWidget* theParent,
72 const FeaturePtr& theFeature,
73 Config_WidgetAPI* theWidgetApi = 0);
74
78 bool hasPageWidget(const std::string& theType);
79
86 ModuleBase_PageBase* createPageByType(const std::string& theType,
87 QWidget* theParent,
88 Config_WidgetAPI* theWidgetApi);
89
97 ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
98 QWidget* theParent,
99 Config_WidgetAPI* theWidgetApi,
100 ModuleBase_IWorkshop* theWorkshop);
101
102private:
105
107 QMap<std::string, WidgetCreatorPtr> myPanelToCreator;
108
110 QMap<std::string, WidgetCreatorPtr> myPageToCreator;
111
113 QMap<std::string, WidgetCreatorPtr> myCreators;
114};
115
116typedef std::shared_ptr<ModuleBase_WidgetCreatorFactory> WidgetCreatorFactoryPtr;
117
118#endif /* MODULEBASE_WIDGETCREATORFACTORY_H_ */
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
Definition: ModuleBase_PageBase.h:35
A class for creation of widgets instances in for property panel using XML deskription of a feature.
Definition: ModuleBase_WidgetCreatorFactory.h:46