Salome HOME
SMH: Add again in binary mode
[modules/gui.git] / src / CAF / CAF_Operation.cxx
1 // CAF_Operation.cxx: implementation of the CAF_Operation class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #include "CAF_Operation.h"
6 #include "CAF_Application.h"
7 #include "CAF_Study.h"
8
9
10 //////////////////////////////////////////////////////////////////////
11 // Construction/Destruction
12 //////////////////////////////////////////////////////////////////////
13
14 CAF_Operation::CAF_Operation(SUIT_Application* theApp)
15 :SUIT_Operation(theApp)
16 {
17 }
18
19 CAF_Operation::~CAF_Operation()
20 {
21 }
22
23 /*!
24     Sets the name of this operation.
25     This name is displayed in 'Undo'/'Redo' list. [ public ]
26 */
27 void CAF_Operation::setName( const QString& name )
28 {
29         myName = name;
30 }
31
32 /*!
33     Returns the name of this operation.
34     This name is displayed in 'Undo'/'Redo' list. [ public ]
35 */
36 const QString& CAF_Operation::getName() const
37 {
38         return myName;
39 }
40
41 void CAF_Operation::startOperation()
42 {
43   myIsDataChanged = true;
44   CAF_Study* cafStudy = dynamic_cast<CAF_Study*>( study() );
45         if ( cafStudy )
46           cafStudy->startOperation();
47 }
48
49 void CAF_Operation::abortOperation()
50 {
51   CAF_Study* cafStudy = dynamic_cast<CAF_Study*>( study() );
52         if ( cafStudy )
53           cafStudy->abortOperation();
54 }
55
56 void CAF_Operation::commitOperation()
57 {
58   CAF_Study* cafStudy = dynamic_cast<CAF_Study*>( study() );
59   if ( cafStudy )
60   {
61           cafStudy->commitOperation();
62     if ( myIsDataChanged )
63       cafStudy->doModified();
64         }
65 }