Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFeature.h
1 // File:        ModuleBase_WidgetFeature.h
2 // Created:     25 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef ModuleBase_WidgetFeature_H
6 #define ModuleBase_WidgetFeature_H
7
8 #include <ModuleBase.h>
9 #include "ModuleBase_ModelWidget.h"
10
11 #include <QObject>
12 #include <QStringList>
13
14 class ModelAPI_Feature;
15
16 /**\class ModuleBase_WidgetFeature
17  * \ingroup GUI
18  * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
19  */
20 class MODULEBASE_EXPORT ModuleBase_WidgetFeature : public ModuleBase_ModelWidget
21 {
22   Q_OBJECT
23 public:
24   /// Constructor
25   /// \theParent the parent object
26   /// \theParent the parent object
27   /// \theData the widget configuation. The attribute of the model widget is obtained from
28   ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData);
29   /// Destructor
30   virtual ~ModuleBase_WidgetFeature();
31
32   /// Fill the widget values by given point
33   /// \param thePoint the point
34   bool setFeature(const FeaturePtr& theFeature);
35
36   /// Saves the internal parameters to the given feature
37   /// \param theFeature a model feature to be changed
38   virtual bool storeValue(FeaturePtr theFeature) const;
39
40   virtual bool restoreValue(FeaturePtr theFeature);
41
42   /// Returns the internal parent wiget control, that can be shown anywhere
43   /// \returns the widget
44   QWidget* getControl() const;
45
46   /// Returns list of widget controls
47   /// \return a control list
48   virtual QList<QWidget*> getControls() const;
49
50 private:
51   FeaturePtr myFeature; ///< the current widget feature
52   QStringList myFeatureKinds; ///< the kinds of possible features
53 };
54
55 #endif