/*
* ModuleBase_Operation.h
*
- * Created on: May 5, 2014
- * Author: nds
+ * Created on: Apr 2, 2014
+ * Author: sbh
*/
#include <ModuleBase.h>
#include <ModuleBase_IOperation.h>
+#include "ModelAPI_Feature.h"
+
#include <QObject>
#include <QString>
#include <boost/shared_ptr.hpp>
-class ModelAPI_Feature;
class ModelAPI_Document;
+class ModuleBase_ModelWidget;
+
+class QKeyEvent;
/*!
\class ModuleBase_Operation
/// Destructor
virtual ~ModuleBase_Operation();
+ // Returns operations Id from it's description
+ QString id() const;
/// Returns the operation feature
/// \return the feature
- boost::shared_ptr<ModelAPI_Feature> feature() const;
+ FeaturePtr feature() const;
+
+ /// Returns whether the nested operations are enabled.
+ /// The state can depend on the operation current state.
+ /// \return enabled state
+ virtual bool isNestedOperationsEnabled() const;
// Data model methods.
- /// Stores a real value in model.
- /// \param theValue - to store
- void storeReal(double theValue);
/// Stores a custom value in model.
void storeCustomValue();
+ virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {};
+
+ /// Sets the operation feature
+ void setEditingFeature(FeaturePtr theFeature);
+
+ /// Returns True if the current operation works with the given object (feature or result)
+ virtual bool hasObject(ObjectPtr theObj) const;
+
+public slots:
+ /// Slots which listen the mode widget activation
+ /// \param theWidget the model widget
+ virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
+
+signals:
+ /// Signals about the activating of the next widget
+ /// \param theWidget the previous active widget
+ void activateNextWidget(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 abortOperation();
/// Virtual method called when operation committed (see commit() method for more description)
virtual void commitOperation();
+ /// Virtual method called after operation committed (see commit() method for more description)
+ virtual void afterCommitOperation();
+
+ /// Send update message by loop
+ void flushUpdated();
+ /// Send created message by loop
+ void flushCreated();
- /// Creates a new feature and save it in the operation internal field
- virtual void createFeature();
+ /// Creates an operation new feature
+ /// \param theFlushMessage the flag whether the create message should be flushed
+ /// \returns the created feature
+ virtual FeaturePtr createFeature(const bool theFlushMessage = true);
-private:
- boost::shared_ptr<ModelAPI_Feature> myFeature; /// the operation feature to be handled
+protected:
+ /// Sets the operation feature
+ void setFeature(FeaturePtr theFeature);
+
+protected:
+ FeaturePtr myFeature; /// the operation feature to be handled
};
#endif