1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #ifndef ModuleBase_IWidgetCreator_H
4 #define ModuleBase_IWidgetCreator_H
6 #include "ModuleBase.h"
8 #include "ModelAPI_Feature.h"
14 class ModuleBase_ModelWidget;
15 class ModuleBase_PageBase;
16 class ModuleBase_IWorkshop;
18 class Config_WidgetAPI;
24 * Interface to WidgetCreator which can create specific widgets by type
26 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
29 /// Default constructor
30 ModuleBase_IWidgetCreator();
32 /// Virtual destructor
33 ~ModuleBase_IWidgetCreator();
35 /// Returns a container of possible page types, which this creator can process
36 /// The default implementation is empty
37 /// \param theTypes a list of type names
38 virtual void panelTypes(std::set<std::string>& theTypes) {}
40 /// Returns a container of possible page types, which this creator can process
41 /// The default implementation is empty
42 /// \param theTypes a list of type names
43 virtual void pageTypes(std::set<std::string>& theTypes) {}
45 /// Returns a container of possible widget types, which this creator can process
46 /// \param theTypes a list of type names
47 virtual void widgetTypes(std::set<std::string>& theTypes) {}
49 /// Create panel control by its type.
50 /// The default implementation is empty
51 /// \param theType a panel type
52 /// \param theParent a parent widget
53 /// \param theFeature a feature modified in the panel
54 /// \return created widget or null
55 virtual QWidget* createPanelByType(const std::string& theType,
57 const FeaturePtr& theFeature);
59 /// Create page by its type
60 /// The default implementation is empty
61 /// \param theType a type
62 /// \param theParent a parent widget
63 /// \param theWidgetApi a low-level API for reading xml definitions of widgets
64 virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
66 Config_WidgetAPI* theWidgetApi);
68 /// Create widget by its type
69 /// The default implementation is empty
70 /// \param theType a type
71 /// \param theParent a parent widget
72 /// \param theWidgetApi a low-level API for reading xml definitions of widgets
73 /// \param theWorkshop a workshop class instance
74 virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
76 Config_WidgetAPI* theWidgetApi,
77 ModuleBase_IWorkshop* theWorkshop);
80 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;