X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_Operation.h;h=208e3503581df161ca6895fc7981cc60a8da9818;hb=32e205a228d74cdc2627143cb32360e9a557d7dc;hp=cf92faa43ae2191e0419561c1bd3cba22089320d;hpb=652a5949418f13aa7db1f1d405a369f4644ba33a;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index cf92faa43..208e35035 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -65,7 +65,7 @@ Q_OBJECT * the operation is not granted. * The method has to be redefined for granted operations. */ - virtual bool isGranted(ModuleBase_Operation* theOperation) const { return false; } + virtual bool isGranted(QString theId) const; /// Sets a list of model widgets, according to the operation feature xml definition /// \param theXmlRepresentation an xml feature definition @@ -110,11 +110,11 @@ Q_OBJECT /// Returns True if the current operation works with the given object (feature or result) virtual bool hasObject(ObjectPtr theObj) const; - virtual void keyReleased(const int theKey) {}; + //virtual void keyReleased(const int theKey) {}; /// If operation needs to redisplay its result during operation /// then this method has to return True - virtual bool hasPreview() const { return false; } + //virtual bool hasPreview() const { return false; } /// Initialisation of operation with preliminary selection /// \param theSelected the list of selected presentations @@ -130,12 +130,19 @@ Q_OBJECT /// Activates widgets by preselection if it is accepted virtual bool activateByPreselection(); + /// If the operation works with feature which is sub-feature of another one + /// then this variable has to be initialised by parent feature + /// before operation feature creating + void setParentFeature(CompositeFeaturePtr theParent) { myParentFeature = theParent; } + CompositeFeaturePtr parentFeature() const { return myParentFeature; } + signals: void started(); /// the operation is started void aborted(); /// the operation is aborted void committed(); /// the operation is committed void stopped(); /// the operation is aborted or committed void resumed(); /// the operation is resumed + void postponed(); /// the operation is postponed public slots: /// Starts operation @@ -145,6 +152,10 @@ signals: /// be better to inherit own operator from base one and redefine startOperation method /// instead. void start(); + + /// Deactivates current operation which can be resumed later. + void postpone(); + /// Resumes operation /// Public slot. Verifies whether operation can be started and starts operation. /// This slot is not virtual and cannot be redefined. Redefine startOperation method @@ -152,10 +163,12 @@ signals: /// be better to inherit own operator from base one and redefine startOperation method /// instead. void resume(); + /// Aborts operation /// Public slot. Aborts operation. This slot is not virtual and cannot be redefined. /// Redefine abortOperation method to change behavior of operation instead void abort(); + /// Commits operation /// Public slot. Commits operation. This slot is not virtual and cannot be redefined. /// Redefine commitOperation method to change behavior of operation instead @@ -169,31 +182,35 @@ signals: // Data model methods. /// Stores a custom value in model. - virtual void storeCustomValue(); + //virtual void storeCustomValue(); /// Slots which listen the mode widget activation /// \param theWidget the model widget - virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget); + //virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget); protected: /// Virtual method called when operation started (see start() method for more description) /// Default impl calls corresponding slot and commits immediately. - virtual void startOperation(); + virtual void startOperation() {} + + /// Implementation of specific steps on postpone operation + virtual void postponeOperation() {} /// Virtual method called when operation stopped - committed or aborted. - virtual void stopOperation(); + virtual void stopOperation() {} /// Virtual method called when operation aborted (see abort() method for more description) - virtual void abortOperation(); + virtual void abortOperation() {} /// Virtual method called when operation committed (see commit() method for more description) - virtual void commitOperation(); + virtual void commitOperation() {} /// Virtual method called after operation committed (see commit() method for more description) - virtual void afterCommitOperation(); + virtual void afterCommitOperation() {} /// Send update message by loop - void flushUpdated(); + //void flushUpdated(); + /// Send created message by loop void flushCreated(); @@ -201,22 +218,21 @@ signals: /// \param theFlushMessage the flag whether the create message should be flushed /// \param theCompositeFeature the feature that must be used for adding the created object or null /// \returns the created - virtual FeaturePtr createFeature(const bool theFlushMessage = true, - CompositeFeaturePtr theCompositeFeature = CompositeFeaturePtr()); + virtual FeaturePtr createFeature(const bool theFlushMessage = true); /// Verifies whether this operator can be commited. /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled virtual bool canBeCommitted() const; /// Returns pointer to the root document. - boost::shared_ptr document() const; + std::shared_ptr document() const; /// Set value to the active widget /// \param theFeature the feature /// \param theX the horizontal coordinate /// \param theY the vertical coordinate /// \return true if the point is set - virtual bool setWidgetValue(ObjectPtr theFeature, double theX, double theY); + //virtual bool setWidgetValue(ObjectPtr theFeature, double theX, double theY); /// Return a widget value point by the selection and the viewer position /// The default realization returns false @@ -252,6 +268,12 @@ signals: /// Access to property panel ModuleBase_IPropertyPanel* myPropertyPanel; + + /// If the operation works with feature which is sub-feature of another one + /// then this variable has to be initialised by parent feature + /// before operation feature creating + CompositeFeaturePtr myParentFeature; + }; #endif