Salome HOME
Issue #3058: Avoid recursive call of object redisplay
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchCreator.h
index d94e0d6d9dee4011ad7e5a44941bf74245095642..f4a880abf6a73a06673de76f797af8302c487f47 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_WidgetSketchCreator.h
-// Created:     08 June 2015
-// Author:      Vitaly SMETANNIKOV
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #ifndef PartSet_WidgetSketchCreator_H
 #define PartSet_WidgetSketchCreator_H
@@ -12,8 +25,8 @@
 #include <ModuleBase_WidgetSelector.h>
 
 class QLabel;
+class QLineEdit;
 class PartSet_Module;
-class ModelAPI_Tools;
 class ModuleBase_Operation;
 class ModuleBase_IWorkshop;
 class PartSet_PreviewPlanes;
@@ -43,7 +56,8 @@ public:
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
-  /// Set focus to the first control of the current widget. The focus policy of the control is checked.
+  /// Set focus to the first control of the current widget.
+  /// The focus policy of the control is checked.
   /// If the widget has the NonFocus focus policy, it is skipped.
   /// \return the state whether the widget can accept the focus
   virtual bool focusTo();
@@ -55,7 +69,7 @@ public:
   /// This value should be processed in the widget according to the needs
   /// \param theValues the wrapped selection values
   /// \param theToValidate a validation of the values flag
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Editing mode depends on mode of current operation. This value is defined by it.
@@ -67,7 +81,7 @@ public:
   /// restored.The valid/invalid value is cashed.
   /// \param theValue a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue);
+  virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
 protected:
   /// If there is no operation in current session, start operation for modify parameters
@@ -77,11 +91,11 @@ protected:
   /// Checks whether the selection presentation contains preview planes
   /// \param theValue a selection information
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& theValue);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
   /// Saves the internal parameters to the given feature
   /// \return True in success
-  virtual bool storeValueCustom() const;
+  virtual bool storeValueCustom();
 
   virtual bool restoreValueCustom();
 
@@ -100,15 +114,15 @@ protected:
 
   /// Retunrs a list of possible shape types
   /// \return a list of shapes
-  virtual QIntList getShapeTypes() const;
+  virtual QIntList shapeTypes() const;
 
   /// Emits model changed info, updates the current control by selection change
   /// \param theDone a state whether the selection is set
   void updateOnSelectionChanged(const bool theDone);
 
-protected slots:
-  /// Slot which is called on selection event
-  virtual void onSelectionChanged();
+protected:
+  /// Returns true if envent is processed.
+  virtual bool processSelection();
 
 private:
   /// Returns true if the selection mode is active. This is when composition feature has no
@@ -127,7 +141,7 @@ private:
   /// Append new Sketch, set the selected plane for the sketch and start Edit operation.
   /// \param theValues a selection list
   /// \return true if the sketch is started
-  bool startSketchOperation(const QList<ModuleBase_ViewerPrs>& theValues);
+  bool startSketchOperation(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Sets the sub-object to list of base.
   static void setSketchObjectToList(const CompositeFeaturePtr& theFeature,
@@ -152,6 +166,8 @@ private:
   /// to store selection and check validation
   bool myIsCustomAttribute;
 
+  QWidget* mySizeOfViewWidget;///< Size of view widget, visualized if preview planes are shown
+  QLineEdit* mySizeOfView; ///< Value of square of size of View
   /// Label of the widget
   QLabel* myLabel;