Salome HOME
Object Browser tree needed method implementation
[modules/shaper.git] / src / XGUI / XGUI_OperationMgr.h
index 04505fed023b8cd29576f60dae71a8e308734a81..80c457b2b2823edeeddb36ae7c91c4ea85aeb682 100644 (file)
@@ -17,6 +17,8 @@
 
 class QKeyEvent;
 
+class ModuleBase_IWorkshop;
+
 /**\class XGUI_OperationMgr
  * \ingroup GUI
  * \brief Operation manager. Servers to manipulate to the workshop operations. Contains a stack
@@ -32,10 +34,13 @@ Q_OBJECT
  public:
   /// Constructor
   /// \param theParent the parent
-  XGUI_OperationMgr(QObject* theParent);
+  XGUI_OperationMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
   /// Destructor
   virtual ~XGUI_OperationMgr();
 
+  void setWorkshop(ModuleBase_IWorkshop* theWorkshop)
+  { myWorkshop = theWorkshop; };
+
   /// Returns the current operation or NULL
   /// \return the current operation
   ModuleBase_Operation* currentOperation() const;
@@ -50,6 +55,9 @@ Q_OBJECT
   /// Returns true is operation manager has an operation with given Id.
   bool hasOperation(const QString& theId) const;
 
+  /// Returns true if the operation can be aborted
+  bool canStopOperation();
+
   /// Find and return operation by its Id.
   ModuleBase_Operation* findOperation(const QString& theId) const;
 
@@ -71,9 +79,6 @@ Q_OBJECT
   /// \return the state whether the current operation is started
   bool startOperation(ModuleBase_Operation* theOperation);
 
-  /// Abort all operations
-  bool abortAllOperations();
-
   /// Returns whether the operation can be started. Check if there is already started operation and
   /// the granted parameter of the launched operation
   /// \param theId id of the operation which is going to start
@@ -81,26 +86,31 @@ Q_OBJECT
 
   /// Blocking/unblocking enabling of Ok button in property panel.
   /// It is used when operation can not be validated even all attributes are valid
-  void setLockValidating(bool toLock) { myIsValidationLock = toLock; }
+  void setLockValidating(bool toLock);
 
   /// Returns state of validation locking
   bool isValidationLocked() const { return myIsValidationLock; }
 
-  /// Sets apply state to the value and emit signal about this state is changed
-  /// \param theEnabled the state value
-  void setApplyEnabled(const bool theEnabled);
-
   /// Returns enable apply state 
   /// \return theEnabled a boolean value
   bool isApplyEnabled() const;
 
-  public slots:
+  /// Returns valid state of the parent operation. If the current operation is the last one
+  /// it returns the valid state of the operation
+  /// \return boolean value
+  bool isParentOperationValid() const;
+
+public slots:
   /// Slot that commits the current operation.
   void onCommitOperation();
   /// Slot that aborts the current operation.
   void onAbortOperation();
   /// Slot that validates the current operation using the validateOperation method.
   void onValidateOperation();
+  /// Commit all operations
+  bool commitAllOperations();
+  /// Abort all operations
+  bool abortAllOperations();
 
 signals:
   /// Signal about an operation is started. It is emitted after the start() of operation is done.
@@ -120,7 +130,10 @@ signals:
   void operationAborted(ModuleBase_Operation* theOperation);
 
   /// Signal is emitted after the apply enable state changed.
-  void applyEnableChanged(bool);
+  void validationStateChanged(bool);
+
+  /// Signal is emitted after the apply enable state changed.
+  void nestedStateChanged(bool);
 
   /// Signal is emitted after the current operation is filled with existing preselection.
   void operationActivatedByPreselection();
@@ -128,10 +141,10 @@ signals:
   /// Signal is emitted after the key released click.
   void keyEnterReleased();
 
-
  protected:
-  /// Returns true if the operation can be aborted
-  bool canStopOperation();
+  /// Sets apply state to the value and emit signal about this state is changed
+  /// \param theEnabled the state value
+  void setApplyEnabled(const bool theEnabled);
 
   /// Commits the current operatin if it is valid
   bool commitOperation();
@@ -162,11 +175,18 @@ signals:
   /// Slot called on operation resume
   void onOperationResumed();
 
+  /// Slot called on operation triggered
+  void onOperationTriggered(bool theState);
+
  private:
   typedef QList<ModuleBase_Operation*> Operations;  ///< definition for a list of operations
   Operations myOperations;  ///< a stack of started operations. The active operation is on top,
                             // others are suspended and started by the active is finished
 
+  /// Current workshop
+  ModuleBase_IWorkshop* myWorkshop;
+
+
   /// Lock/Unlock access to Ok button in property panel
   bool myIsValidationLock;
   /// Lock/Unlock access to Ok button in property panel