1 // File: ModuleBase_WidgetFeatureOrAttribute.h
2 // Created: 25 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef ModuleBase_WidgetFeatureOrAttribute_H
6 #define ModuleBase_WidgetFeatureOrAttribute_H
8 #include <ModuleBase.h>
9 #include "ModuleBase_WidgetFeature.h"
13 class ModuleBase_WidgetValue;
14 class ModelAPI_Attribute;
16 /**\class ModuleBase_WidgetFeatureOrAttribute
18 * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
20 class MODULEBASE_EXPORT ModuleBase_WidgetFeatureOrAttribute : public ModuleBase_WidgetFeature
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, const std::string& theParentId);
30 virtual ~ModuleBase_WidgetFeatureOrAttribute();
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);
37 /// Saves the internal parameters to the given feature
38 /// \param theFeature a model feature to be changed
39 virtual bool storeValue(ObjectPtr theFeature) const;
41 virtual bool restoreValue(ObjectPtr theFeature);
45 /// \param theAttribute value
46 /// \return the boolean result of the attribute set
47 bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute,
48 bool theSendEvent = true);
51 boost::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute