Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / ModuleBase / ModuleBase_ModelWidget.h
index 968f5960ce72bb7fc891563b8839712009d4dc83..7e77804ac36a440d483d726af92e7b29b97d0fac 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <QObject>
 
-#include <boost/shared_ptr.hpp>
+#include <memory>
 
 class Config_WidgetAPI;
 class ModuleBase_WidgetValue;
@@ -32,29 +32,31 @@ Q_OBJECT
   /// Constructor
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData,
+  ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData,
                          const std::string& theParentId);
   /// Destructor
   virtual ~ModuleBase_ModelWidget()
   {
   }
 
-  /// Set the given wrapped value to the current widget
-  /// This value should be processed in the widget according to the needs
-  /// \param theValue the wrapped widget value
-  virtual bool setValue(ModuleBase_WidgetValue* theValue)
-  {
-    return false;
-  }
-
   /// Returns the state whether the attribute of the feature is initialized
   /// \param theObject a model feature to be checked
   /// \return the boolean result
   bool isInitialized(ObjectPtr theObject) const;
 
-  bool isComputedDefault()
+  /// Returns true, if default value of the widget should be computed
+  /// on operation's execute, like radius for circle's constraint (can not be zero)
+  bool isComputedDefault() { return myIsComputedDefault; }
+
+  /// Defines if it is supposed that the widget should interact with the viewer.
+  virtual bool isViewerSelector() { return false; }
+
+  /// Set the given wrapped value to the current widget
+  /// This value should be processed in the widget according to the needs
+  /// \param theValue the wrapped widget value
+  virtual bool setValue(ModuleBase_WidgetValue* theValue)
   {
-    return myIsComputedDefault;
+    return false;
   }
 
   /// Saves the internal parameters to the given feature
@@ -68,13 +70,23 @@ Q_OBJECT
   /// \return the state whether the widget can accept the focus
   virtual bool focusTo();
 
+  /// Returns the internal parent wiget control, that can be shown anywhere
+  /// \returns the widget
+  virtual QWidget* getControl() const = 0;
+
   /// Returns list of widget controls
   /// \return a control list
   virtual QList<QWidget*> getControls() const = 0;
 
+
   /// FocusIn events processing
   virtual bool eventFilter(QObject* theObject, QEvent *theEvent);
 
+
+  void enableFocusProcessing();
+
+  void setHighlighted(bool isHighlighted);
+
   /// Returns the attribute name
   /// \returns the string value
   std::string attributeID() const
@@ -93,14 +105,12 @@ Q_OBJECT
   {
     return myFeature;
   }
+
   void setFeature(const FeaturePtr& theFeature)
   {
     myFeature = theFeature;
   }
 
-  /// Defines if it is supposed that the widget should interact with the viewer.
-  virtual bool isViewerSelector() { return false; }
-
 signals:
   /// The signal about widget values changed
   void valuesChanged();
@@ -125,18 +135,13 @@ signals:
 
   void updateObject(ObjectPtr theObj) const;
 
-  /// Let the widget process FocusIn events
-  void processFocus(QWidget* theWidget);
-
-  std::string myAttributeID;  /// the attribute name of the model feature
+ protected:
+  std::string myAttributeID; /// the attribute name of the model feature
   std::string myParentId;    /// name of parent
   FeaturePtr myFeature;
 
-  bool myIsComputedDefault;
-
- private:
-   /// Contains a list of widgets that may accept focus
-   QList<QWidget*> myFocusInWidgets;
+  bool myIsComputedDefault; /// Value should be computed on execute,
+                            /// like radius for circle's constraint (can not be zero)
 };
 
 #endif