SHAPER 9.16.0
ModuleBase_Operation.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef ModuleBase_Operation_H
21#define ModuleBase_Operation_H
22
23#include <ModuleBase.h>
24
25#include <QObject>
26#include <QString>
27#include <QStringList>
28
32
33class QKeyEvent;
34
52class MODULEBASE_EXPORT ModuleBase_Operation : public QObject
53{
54Q_OBJECT
55
56 public:
60 ModuleBase_Operation(const QString& theId = "", QObject* theParent = 0);
61
63 virtual ~ModuleBase_Operation();
64
67 ModuleBase_OperationDescription* getDescription() const { return myDescription; }
68
70 const QStringList& grantedOperationIds() const;
71
74 void setGrantedOperationIds(const QStringList& theList);
75
80 virtual bool isGranted(QString theId) const;
81
83 virtual bool isModified() const;
84
86 QString id() const;
87
90 virtual bool isValid() const;
91
94 virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp);
95
97 ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
98
99 QString helpFileName() const { return myHelpFileName; }
100
101 void setHelpFileName(QString theName) {
102 myHelpFileName = theName;
103 }
104
105 void setHideFacesVisible(bool isVisible) { myHideFacesVisibilityState = isVisible; }
106
107 bool isHideFacesVisible() const { return myHideFacesVisibilityState; }
108
109signals:
113 void started();
114
118 void aborted();
119
123 void committed();
124
126 void stopped();
127
129 void resumed();
130
132 void postponed();
133
134 public slots:
142 virtual bool start();
143
145 virtual void postpone();
146
153 virtual void resume();
154
158 virtual void abort();
159
163 virtual bool commit();
164
166 void onValuesChanged();
167
170 void onValueStateChanged(int thePreviousState);
171
172 protected:
175 virtual void startOperation() {}
176
178 virtual void postponeOperation() {}
179
181 virtual void stopOperation() {}
182
184 virtual void abortOperation() {}
185
187 virtual void commitOperation() {};
188
190 virtual void afterCommitOperation() {}
191
193 virtual void resumeOperation() {}
194
197 virtual bool canBeCommitted() const;
198
199private:
201 ModuleBase_OperationDescription* myDescription;
202
204 bool myIsModified;
205
207 QStringList myGrantedIds;
208
210 ModuleBase_IPropertyPanel* myPropertyPanel;
211
212 QString myHelpFileName;
213
215 bool myHideFacesVisibilityState;
216};
217
218#endif
A class for Property panel object definition.
Definition: ModuleBase_IPropertyPanel.h:35
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
Definition: ModuleBase_OperationDescription.h:40
Base class for all operations.
Definition: ModuleBase_Operation.h:53
void beforeStarted()
The operation is started.
virtual void afterCommitOperation()
Virtual method called after operation committed (see commit() method for more description)
Definition: ModuleBase_Operation.h:190
virtual void postponeOperation()
Implementation of specific steps on postpone operation.
Definition: ModuleBase_Operation.h:178
void stopped()
The operation is aborted or committed.
ModuleBase_IPropertyPanel * propertyPanel() const
Definition: ModuleBase_Operation.h:97
virtual void abortOperation()
Virtual method called when operation aborted (see abort() method for more description)
Definition: ModuleBase_Operation.h:184
void committed()
The operation is committed.
void started()
The operation is started.
void resumed()
The operation is resumed.
virtual void commitOperation()
Virtual method called when operation committed (see commit() method for more description)
Definition: ModuleBase_Operation.h:187
void postponed()
The operation is postponed.
virtual void resumeOperation()
Virtual method called after operation resume (see resume() method for more description)
Definition: ModuleBase_Operation.h:193
ModuleBase_OperationDescription * getDescription() const
Returns the operation description /returns the instance of the description class.
Definition: ModuleBase_Operation.h:67
void beforeAborted()
The operation is aborted.
void beforeCommitted()
The operation is committed.
void aborted()
The operation is aborted.
virtual void stopOperation()
Virtual method called when operation stopped - committed or aborted.
Definition: ModuleBase_Operation.h:181
virtual void startOperation()
Virtual method called when operation started (see start() method for more description) Default impl c...
Definition: ModuleBase_Operation.h:175