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,
29 const std::string& theParentId);
31 virtual ~ModuleBase_WidgetFeatureOrAttribute();
33 /// Set the given wrapped value to the current widget
34 /// This value should be processed in the widget according to the needs
35 /// \param theValue the wrapped widget value
36 virtual bool setValue(ModuleBase_WidgetValue* theValue);
38 /// Saves the internal parameters to the given feature
39 /// \param theFeature a model feature to be changed
40 virtual bool storeValue() const;
42 virtual bool restoreValue();
43 /// Defines if it is supposed that the widget should interact with the viewer.
44 virtual bool isViewerSelector() { return true; }
47 /// Returns the feature attribute if it can be found by the given value
48 /// \param theValue the widget value
49 /// \return an attribute or null
50 boost::shared_ptr<ModelAPI_Attribute> findAttribute(ModuleBase_WidgetValue* theValue);
53 /// \param theAttribute value
54 /// \return the boolean result of the attribute set
55 bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent =
59 boost::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute