1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_Operation.cxx
31 \class QAD_Operation QAD_Operation.h
32 \brief Base class for OCAF operations in QAD-based application.
36 #include "QAD_Operation.h"
37 #include "QAD_Study.h"
38 #include "QAD_Application.h"
41 #include <qapplication.h>
46 QAD_Operation::QAD_Operation (QAD_Study* doc) :
49 /* this class is useless without valid doc */
50 QAD_ASSERT_DEBUG_ONLY( myDoc );
56 QAD_Operation::~QAD_Operation ()
61 Returns reference to the document
63 QAD_Study* QAD_Operation::getDoc() const
69 Returns reference to the application
71 QAD_Application* QAD_Operation::getApp() const
73 return myDoc->getApp();
77 Checks compatibility with the other launched operations.
78 Returns \true if appointed operation can be performed.
79 By default returns \false for all operations.
81 bool QAD_Operation::compatibleWith( QAD_Operation* op ) const
87 Returns true if operation can be aborted by pressing "Escape" key
90 bool QAD_Operation::supportCancelByEscape() const
96 Returns true if operation changes document data. In this case it won't be
97 launched if document is opened as "read only". Value by default is true.
99 bool QAD_Operation::changesData() const
105 Starts this operation.
107 bool QAD_Operation::start()
109 /* open transaction */
110 if ( !myDoc->onOperationStarted( this ) )
119 Called after operation started. Does nothing by default.
120 Override to set a desired behaviour.
122 void QAD_Operation::onStartOperation()
129 void QAD_Operation::finish()
131 QApplication::setOverrideCursor( Qt::waitCursor );
133 onFinishOperation(); /* customization */
134 myDoc->onOperationFinished( this ); /* close transaction */
136 QApplication::restoreOverrideCursor();
140 Called after operation finished. Does nothing by default.
141 Override to set a desired behaviour.
143 void QAD_Operation::onFinishOperation()
148 Suspends operation process when the document is deactivated.
150 void QAD_Operation::suspend()
152 onSuspendOperation(); /* customization */
153 myDoc->onOperationSuspended( this ); /* notification */
157 Called after operation suspended. Does nothing by default.
158 Override to set a desired behaviour.
160 void QAD_Operation::onSuspendOperation()
165 Resumes operation performing process when the document became active
166 (if the operation wasn't aborted earlier).
168 void QAD_Operation::resume()
170 onResumeOperation(); /* customization */
171 myDoc->onOperationResumed( this ); /* notification */
175 Called after operation resumed. Does nothing by default.
176 Override to set a desired behaviour.
178 void QAD_Operation::onResumeOperation()
183 Cancels operation performing process without ending.
185 void QAD_Operation::abort()
187 QApplication::setOverrideCursor( Qt::waitCursor );
189 onAbortOperation(); /* customization */
190 myDoc->onOperationAborted( this ); /* abort transaction */
192 QApplication::restoreOverrideCursor();
196 Called after operation aborted. Does nothing by default.
197 Override to set a desired behaviour.
199 void QAD_Operation::onAbortOperation()