1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #ifndef ModuleBase_IWidgetCreator_H
4 #define ModuleBase_IWidgetCreator_H
6 #include "ModuleBase.h"
12 class ModuleBase_ModelWidget;
13 class ModuleBase_PageBase;
14 class ModuleBase_IWorkshop;
16 class Config_WidgetAPI;
22 * Interface to WidgetCreator which can create specific widgets by type
24 class MODULEBASE_EXPORT ModuleBase_IWidgetCreator
27 /// Default constructor
28 ModuleBase_IWidgetCreator();
30 /// Virtual destructor
31 ~ModuleBase_IWidgetCreator();
33 /// Returns a container of possible page types, which this creator can process
34 /// The default implementation is empty
35 /// \param theTypes a list of type names
36 virtual void panelTypes(std::set<std::string>& theTypes) {}
38 /// Returns a container of possible page types, which this creator can process
39 /// The default implementation is empty
40 /// \param a list of type names
41 virtual void pageTypes(std::set<std::string>& theTypes) {}
43 /// Returns a container of possible widget types, which this creator can process
44 /// \param a list of type names
45 virtual void widgetTypes(std::set<std::string>& theTypes) {}
47 /// Create panel control by its type.
48 /// The default implementation is empty
49 /// \param theType a panel type
50 /// \param theParent a parent widget
51 /// \return created widget or null
52 virtual QWidget* createPanelByType(const std::string& theType,
55 /// Create page by its type
56 /// The default implementation is empty
57 /// \param theType a type
58 /// \param theParent a parent widget
59 /// \param theData a low-level API for reading xml definitions of widgets
60 virtual ModuleBase_PageBase* createPageByType(const std::string& theType,
62 Config_WidgetAPI* theWidgetApi);
64 /// Create widget by its type
65 /// The default implementation is empty
66 /// \param theType a type
67 /// \param theParent a parent widget
68 /// \param theData a low-level API for reading xml definitions of widgets
69 virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
71 Config_WidgetAPI* theWidgetApi,
72 ModuleBase_IWorkshop* theWorkshop);
75 typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;