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;
25 * A class for creation of widgets instances in for property panel using XML deskription of
28 class MODULEBASE_EXPORT ModuleBase_WidgetFactory
32 /// \param theXmlRepresentation content of XML file
33 /// \param theWorkshop reference to workshop instance
34 ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
35 ModuleBase_IWorkshop* theWorkshop);
36 virtual ~ModuleBase_WidgetFactory();
38 /// Creates content widget for property panel
39 /// \param theParent a parent widget
40 void createWidget(QWidget* theParent);
42 /// Returns list of model widgets
43 QList<ModuleBase_ModelWidget*> getModelWidgets() const
45 return myModelWidgets;
49 /// Create widget by its type
50 /// \param theType a type
51 /// \param theParent a parent widget
52 QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL);
54 /// Create a widget of container type
55 /// \param theType a type
56 /// \param theParent a parent widget
57 QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL);
59 /// Create label widget
60 /// \param theParent a parent widget
61 QWidget* labelControl(QWidget* theParent);
63 /// Create double spin box widget
64 /// \param theParent a parent widget
65 QWidget* doubleSpinBoxControl(QWidget* theParent);
67 /// Create double value editor widget
68 /// \param theParent a parent widget
69 QWidget* doubleValueEditor(QWidget* theParent);
71 /// Create shape selector widget
72 /// \param theParent a parent widget
73 QWidget* shapeSelectorControl(QWidget* theParent);
75 /// Create boolean input widget
76 /// \param theParent a parent widget
77 QWidget* booleanControl(QWidget* theParent);
79 /// Create file selector widget
80 /// \param theParent a parent widget
81 QWidget* fileSelectorControl(QWidget* theParent);
83 /// Create choice widget (combo box)
84 /// \param theParent a parent widget
85 QWidget* choiceControl(QWidget* theParent);
87 /// Create line edit widget
88 /// \param theParent a parent widget
89 QWidget* lineEditControl(QWidget* theParent);
91 /// Create multi selector widget
92 /// \param theParent a parent widget
93 QWidget* multiSelectorControl(QWidget* theParent);
95 /// Convert STD string to QT string
96 /// \param theStdString is STD string
97 static QString qs(const std::string& theStdString);
100 /// API object for XML reading
101 Config_WidgetAPI* myWidgetApi;
103 /// Reference to workshop
104 ModuleBase_IWorkshop* myWorkshop;
106 /// List of created model widgets
107 QList<ModuleBase_ModelWidget*> myModelWidgets;
109 /// Id of current parent
110 std::string myParentId;
113 #endif /* ModuleBase_WidgetFactory_H_ */