1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetFactory.h
6 * Created on: Apr 3, 2014
10 #ifndef ModuleBase_WidgetFactory_H_
11 #define ModuleBase_WidgetFactory_H_
13 #include "ModuleBase.h"
14 #include "ModuleBase_ModelWidget.h"
21 class Config_WidgetAPI;
22 class ModuleBase_IWorkshop;
26 * A class for creation of widgets instances in for property panel using XML deskription of
29 class MODULEBASE_EXPORT ModuleBase_WidgetFactory
33 /// \param theXmlRepresentation content of XML file
34 /// \param theWorkshop reference to workshop instance
35 ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
36 ModuleBase_IWorkshop* theWorkshop);
37 virtual ~ModuleBase_WidgetFactory();
39 /// Creates content widget for property panel
40 /// \param theParent a parent widget
41 void createWidget(QWidget* theParent);
43 /// Returns list of model widgets
44 QList<ModuleBase_ModelWidget*> getModelWidgets() const
46 return myModelWidgets;
50 /// Create widget by its type
51 /// \param theType a type
52 /// \param theParent a parent widget
53 QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL);
55 /// Create a widget of container type
56 /// \param theType a type
57 /// \param theParent a parent widget
58 QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL);
60 /// Create label widget
61 /// \param theParent a parent widget
62 QWidget* labelControl(QWidget* theParent);
64 /// Create double spin box widget
65 /// \param theParent a parent widget
66 QWidget* doubleSpinBoxControl(QWidget* theParent);
68 /// Create double value editor widget
69 /// \param theParent a parent widget
70 QWidget* doubleValueEditor(QWidget* theParent);
72 /// Create shape selector widget
73 /// \param theParent a parent widget
74 QWidget* shapeSelectorControl(QWidget* theParent);
76 /// Create boolean input widget
77 /// \param theParent a parent widget
78 QWidget* booleanControl(QWidget* theParent);
80 /// Create file selector widget
81 /// \param theParent a parent widget
82 QWidget* fileSelectorControl(QWidget* theParent);
84 /// Create choice widget (combo box)
85 /// \param theParent a parent widget
86 QWidget* choiceControl(QWidget* theParent);
88 /// Create line edit widget
89 /// \param theParent a parent widget
90 QWidget* lineEditControl(QWidget* theParent);
92 /// Create multi selector widget
93 /// \param theParent a parent widget
94 QWidget* multiSelectorControl(QWidget* theParent);
96 /// Convert STD string to QT string
97 /// \param theStdString is STD string
98 static QString qs(const std::string& theStdString);
101 /// API object for XML reading
102 Config_WidgetAPI* myWidgetApi;
104 /// Reference to workshop
105 ModuleBase_IWorkshop* myWorkshop;
107 /// List of created model widgets
108 QList<ModuleBase_ModelWidget*> myModelWidgets;
110 /// Id of current parent
111 std::string myParentId;
114 #endif /* ModuleBase_WidgetFactory_H_ */