Salome HOME
7084165a520ba6843f5bc829e217dbaba970bb63
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFeatureOrAttribute.h
1 // File:        ModuleBase_WidgetFeatureOrAttribute.h
2 // Created:     25 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef ModuleBase_WidgetFeatureOrAttribute_H
6 #define ModuleBase_WidgetFeatureOrAttribute_H
7
8 #include <ModuleBase.h>
9 #include "ModuleBase_WidgetFeature.h"
10
11 #include <QObject>
12
13 class ModuleBase_WidgetValue;
14 class ModelAPI_Attribute;
15
16 /**\class ModuleBase_WidgetFeatureOrAttribute
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_WidgetFeatureOrAttribute : public ModuleBase_WidgetFeature
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_WidgetFeatureOrAttribute(QWidget* theParent, const Config_WidgetAPI* theData);
29   /// Destructor
30   virtual ~ModuleBase_WidgetFeatureOrAttribute();
31
32   /// Set the given wrapped value to the current widget
33   /// This value should be processed in the widget according to the needs
34   /// \param theValue the wrapped widget value
35   virtual bool setValue(ModuleBase_WidgetValue* theValue);
36
37   /// Saves the internal parameters to the given feature
38   /// \param theFeature a model feature to be changed
39   virtual bool storeValue(FeaturePtr theFeature) const;
40
41   virtual bool restoreValue(FeaturePtr theFeature);
42
43 protected:
44   /// Set the attribute
45   /// \param theAttribute value
46   /// \return the boolean result of the attribute set
47   bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute);
48
49 protected:
50   boost::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute
51 };
52
53 #endif