X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_IModule.h;h=d80620a4895a15befa1605d1c770b1b7b465600d;hb=29dfb8a802f61cacf5f57fb79c62badee00ebcdf;hp=747dda203268c5f65ab386613c268dce9152830c;hpb=e11ae05578690f15d9da81d97cf979b9c8f536f4;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h old mode 100644 new mode 100755 index 747dda203..d80620a48 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -32,6 +32,12 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject { Q_OBJECT public: + /// enumeration to know which objects should be customized + enum ModuleBase_CustomizeFlag { + CustomizeArguments = 0, /// references of other objects referenced to the current feature + CustomizeResults, /// results of the current feature + CustomizeHighlightedObjects /// highlighted objects of the active widget + }; /// Constructor /// \param theParent instance of workshop interface @@ -61,21 +67,21 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Realizes some functionality by an operation start /// \param theOperation a started operation - virtual void onOperationStarted(ModuleBase_Operation* theOperation) {} + virtual void operationStarted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation resume /// By default it emits operationResumed signal /// \param theOperation a resumed operation - virtual void onOperationResumed(ModuleBase_Operation* theOperation); + virtual void operationResumed(ModuleBase_Operation* theOperation); /// Realizes some functionality by an operation stop - virtual void onOperationStopped(ModuleBase_Operation* theOperation) {} + virtual void operationStopped(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation commit - virtual void onOperationCommitted(ModuleBase_Operation* theOperation) {} + virtual void operationCommitted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation abort - virtual void onOperationAborted(ModuleBase_Operation* theOperation) {} + virtual void operationAborted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation start virtual ModuleBase_Operation* currentOperation() const = 0; @@ -101,6 +107,9 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject return 0; } + /// Returns the active widget, by default it is the property panel active widget + virtual ModuleBase_ModelWidget* activeWidget() const = 0; + /// Returns current workshop ModuleBase_IWorkshop* workshop() const { return myWorkshop; } @@ -122,7 +131,7 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Returns True if the current operation can be committed. By default it is true. /// \return a boolean value - virtual bool canCommitOperation() const; + //virtual bool canCommitOperation() const; /// Returns whether the object can be erased. The default realization returns true. /// \param theObject a model object @@ -151,14 +160,30 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// \param theModes a list of modes virtual void activeSelectionModes(QIntList& theModes) {} - /** Update the object presentable properties such as color, lines width and other - * If the object is result with the color attribute value set, it is used, - * otherwise the customize is applyed to the object's feature if it is a custom prs - * \param theObject an object instance - * \param theUpdateViewer the parameter whether the viewer should be update immediately - * \returns true if the object is modified - */ - virtual bool customizeObject(ObjectPtr theObject, const bool theUpdateViewer); + /// Activate custom presentation for the object. Default realization is empty. + /// \param theObject an object instance + /// \param theFlag a flag of level of customization, which means that only part of sub-elements + /// \param theUpdateViewer the parameter whether the viewer should be update immediately + virtual void activateCustomPrs(const FeaturePtr& theFeature, + const ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer) {} + + /// Deactivate custom presentation for the object. Default realization is empty. + /// \param theFlag a flag of level of customization, which means that only part of sub-elements + /// \param theUpdateViewer the parameter whether the viewer should be update immediately + virtual void deactivateCustomPrs(const ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer) {} + + /// Update the object presentable properties such as color, lines width and other + /// If the object is result with the color attribute value set, it is used, + /// otherwise the customize is applyed to the object's feature if it is a custom prs + /// \param theObject an object instance + /// \param theFlag a flag of level of customization, which means that only part of sub-elements + /// should be updated(e.g. only highlighted elements) + /// \param theUpdateViewer the parameter whether the viewer should be update immediately + /// \returns true if the object is modified + virtual bool customizeObject(ObjectPtr theObject, const ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer); /// This method is called on object browser creation for customization of module specific features /// \param theObjectBrowser a pinter on Object Browser widget @@ -191,13 +216,34 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Returns list of granted operation indices virtual void grantedOperationIds(ModuleBase_Operation* theOperation, QStringList& theIds) const; + /// Connects or disconnects to the value changed signal of the property panel widgets + /// \param theWidget a property contol widget + /// \param isToConnect a boolean value whether connect or disconnect + virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) {}; + + /// Validates the operation to change the "Apply" button state. + /// \param thePreviousState the previous state of the widget + virtual void widgetStateChanged(int thePreviousState) {}; + + /// Returns true if the event is processed. + /// \param thePreviousAttributeID an index of the previous active attribute + virtual bool processEnter(const std::string& thePreviousAttributeID) { return false; }; + + /// Performs some GUI actions after an operation transaction is opened + /// Default realization is empty + virtual void beforeOperationStarted(ModuleBase_Operation* theOperation) {}; + + /// Performs some GUI actions before an operation transaction is stopped + /// Default realization is empty + virtual void beforeOperationStopped(ModuleBase_Operation* theOperation) {}; + signals: /// Signal which is emitted when operation is launched void operationLaunched(); /// Segnal emitted when an operation is resumed /// \param theOp a resumed operation - void operationResumed(ModuleBase_Operation* theOp); + void resumed(ModuleBase_Operation* theOp); public slots: /// Called on call of command corresponded to a feature