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);
44 /// Returns list of model widgets
45 QList<ModuleBase_ModelWidget*> getModelWidgets() const
47 return myModelWidgets;
51 /// check if ModuleBase_Widget has expandable widgets in getControls
52 bool hasExpandingControls(QWidget* theParent);
53 /// Create widget by its type
54 /// \param theType a type
55 /// \param theParent a parent widget
56 QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL);
58 /// Create a widget of container type
59 /// \param theType a type
60 /// \param theParent a parent widget
61 QWidget* createContainer(const std::string& theType, QWidget* theParent);
63 /// Create label widget
64 /// \param theParent a parent widget
65 QWidget* labelControl(QWidget* theParent);
67 /// Create double spin box widget
68 /// \param theParent a parent widget
69 QWidget* doubleSpinBoxControl(QWidget* theParent);
71 /// Create double value editor widget
72 /// \param theParent a parent widget
73 QWidget* doubleValueEditor(QWidget* theParent);
75 /// Create shape selector widget
76 /// \param theParent a parent widget
77 QWidget* shapeSelectorControl(QWidget* theParent);
79 /// Create boolean input widget
80 /// \param theParent a parent widget
81 QWidget* booleanControl(QWidget* theParent);
83 /// Create file selector widget
84 /// \param theParent a parent widget
85 QWidget* fileSelectorControl(QWidget* theParent);
87 /// Create choice widget (combo box)
88 /// \param theParent a parent widget
89 QWidget* choiceControl(QWidget* theParent);
91 /// Create line edit widget
92 /// \param theParent a parent widget
93 QWidget* lineEditControl(QWidget* theParent);
95 /// Create multi selector widget
96 /// \param theParent a parent widget
97 QWidget* multiSelectorControl(QWidget* theParent);
99 /// Convert STD string to QT string
100 /// \param theStdString is STD string
101 static QString qs(const std::string& theStdString);
104 /// API object for XML reading
105 Config_WidgetAPI* myWidgetApi;
107 /// Reference to workshop
108 ModuleBase_IWorkshop* myWorkshop;
110 /// List of created model widgets
111 QList<ModuleBase_ModelWidget*> myModelWidgets;
113 /// Id of current parent
114 std::string myParentId;
117 #endif /* ModuleBase_WidgetFactory_H_ */