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_Study.cxx
25 // Author : Nicolas REJNERI
32 #include "QAD_Operation.h"
33 #include "QAD_StudyFrame.h"
35 #include "SALOME_InteractiveObject.hxx"
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOMEDS)
46 class QAD_Application;
50 class TInitStudyThread;
53 class QAD_EXPORT QAD_Study : public QObject
58 QAD_Study(QAD_Application* app,
59 SALOMEDS::Study_var aStudy,
60 const QString& title);
65 bool eventFilter( QObject* o, QEvent* e);
68 /* studyframes management */
69 QAD_StudyFrame* createStudyFrame(const QString& name, ViewType theViewType = VIEW_TYPE_MAX);
70 void removeStudyFrame( QAD_StudyFrame* );
71 int getStudyFramesCount() const;
72 const QList<QAD_StudyFrame>& getStudyFrames() const;
73 QAD_StudyFrame* getStudyFrameByName( const QString& name );
74 QAD_StudyFrame* getFirstStudyFrame();
75 QAD_StudyFrame* getLastStudyFrame();
76 QAD_StudyFrame* getStudyFrame( unsigned i );
77 QAD_StudyFrame* getActiveStudyFrame() const;
81 /* document state management */
82 bool isActive() const;
84 bool isModified() const;
85 bool isReadOnly() const;
86 void setReadOnly(bool state);
88 const QString& getTitle() const;
90 const QString& getPath() const;
91 void setTitle( const QString& title);
92 void updateCaptions();
94 QAD_Application* getApp() const;
99 /* operation management */
100 OperationState getOperationState() const;
101 int getOperationsCount() const;
102 QAD_Operation* getOperation( unsigned i );
103 QAD_Operation* getFirstOperation();
104 QAD_Operation* getLastOperation();
106 void abortAllOperations();
107 void resumeAllOperations();
108 void suspendAllOperations();
110 bool onOperationStarted( QAD_Operation* );
111 void onOperationFinished( QAD_Operation* );
112 void onOperationSuspended( QAD_Operation* );
113 void onOperationResumed( QAD_Operation* );
114 void onOperationAborted( QAD_Operation* );
116 /* standard CAF document */
117 SALOMEDS::Study_var getStudyDocument();
121 bool canUndo() const;
122 bool canRedo() const;
124 QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
125 void showFrame(QAD_StudyFrame* theFrame);
127 void setMessage(const char* message);
129 void updateObjBrowser( bool updateSelection = true );
130 void updateUseCaseBrowser( bool updateSelection = true );
131 void update3dViewers();
133 /* interactive object management */
134 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
135 bool highlight, bool immediatly=true );
136 void unHighlightAll();
138 void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
140 int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
142 bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
143 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
144 bool isInViewer(const char* anEntry,
145 const char* StudyFrameEntry);
148 void Selection( QString aSelection );
149 QString getSelection() const;
151 /* python interpreter */
152 QAD_PyInterp* get_PyInterp(void);
154 QString getNextStudyFrameName();
156 /* Child widgets handling (not QAD_StudyFrame) */
157 void addChildWidget( QWidget* child );
158 void removeChildWidget( QWidget* child );
161 void docClosing( QAD_Study* );
162 void docOperationTerminated( bool );
164 void supervStudyFrameClosing( QAD_ViewFrame* );
167 void onStudyFrameActivated( QAD_StudyFrame* );
168 void onStudyDeactivated();
169 void onLastStudyFrameClosing( QAD_StudyFrame* );
172 void addStudyFrame( QAD_StudyFrame* );
173 bool initOperation( QAD_Operation* );
174 void clearOperation( QAD_Operation* );
177 SALOMEDS::Study_var myStudy;
179 QList<QAD_Operation> myOperations;
180 OperationState myOperationState;
182 QAD_Application* myApp;
183 QList<QAD_StudyFrame> myStudyFrames;
184 QAD_StudyFrame* myActiveStudyFrame;
185 int myStudyFrameCount;
187 QList<QWidget> myChildWidgets;
201 QAD_PyInterp* myInterp;
202 TInitStudyThread* myInitStudyThread;