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;
52 class QAD_EXPORT QAD_Study : public QObject
57 QAD_Study(QAD_Application* app,
58 SALOMEDS::Study_var aStudy,
59 const QString& title);
64 bool eventFilter( QObject* o, QEvent* e);
67 /* studyframes management */
68 QAD_StudyFrame* createStudyFrame(const QString& name, ViewType theViewType = VIEW_TYPE_MAX);
69 void removeStudyFrame( QAD_StudyFrame* );
70 int getStudyFramesCount() const;
71 const QList<QAD_StudyFrame>& getStudyFrames() const;
72 QAD_StudyFrame* getStudyFrameByName( const QString& name );
73 QAD_StudyFrame* getFirstStudyFrame();
74 QAD_StudyFrame* getLastStudyFrame();
75 QAD_StudyFrame* getStudyFrame( unsigned i );
76 QAD_StudyFrame* getActiveStudyFrame() const;
80 /* document state management */
81 bool isActive() const;
83 bool isModified() const;
84 bool isReadOnly() const;
85 void setReadOnly(bool state);
86 const QString& getTitle() const;
88 const QString& getPath() const;
89 void setTitle( const QString& title);
90 void updateCaptions();
92 QAD_Application* getApp() const;
97 /* operation management */
98 OperationState getOperationState() const;
99 int getOperationsCount() const;
100 QAD_Operation* getOperation( unsigned i );
101 QAD_Operation* getFirstOperation();
102 QAD_Operation* getLastOperation();
104 void abortAllOperations();
105 void resumeAllOperations();
106 void suspendAllOperations();
108 bool onOperationStarted( QAD_Operation* );
109 void onOperationFinished( QAD_Operation* );
110 void onOperationSuspended( QAD_Operation* );
111 void onOperationResumed( QAD_Operation* );
112 void onOperationAborted( QAD_Operation* );
114 /* standard CAF document */
115 SALOMEDS::Study_var getStudyDocument();
119 bool canUndo() const;
120 bool canRedo() const;
122 QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
123 void showFrame(QAD_StudyFrame* theFrame);
125 void setMessage(const char* message);
127 void updateObjBrowser( bool updateSelection = true );
128 void updateUseCaseBrowser( bool updateSelection = true );
129 void update3dViewers();
131 /* interactive object management */
132 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
133 bool highlight, bool immediatly=true );
134 void unHighlightAll();
136 void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
138 int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
140 bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
141 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
142 bool isInViewer(const char* anEntry,
143 const char* StudyFrameEntry);
146 void Selection( QString aSelection );
147 QString getSelection();
149 /* python interpreter */
150 QAD_PyInterp* get_PyInterp(void);
152 QString getNextStudyFrameName();
154 /* Child widgets handling (not QAD_StudyFrame) */
155 void addChildWidget( QWidget* child );
156 void removeChildWidget( QWidget* child );
159 void docClosing( QAD_Study* );
160 void docOperationTerminated( bool );
164 void onStudyFrameActivated( QAD_StudyFrame* );
165 void onStudyDeactivated();
166 void onLastStudyFrameClosing( QAD_StudyFrame* );
169 void addStudyFrame( QAD_StudyFrame* );
170 bool initOperation( QAD_Operation* );
171 void clearOperation( QAD_Operation* );
174 SALOMEDS::Study_var myStudy;
176 QList<QAD_Operation> myOperations;
177 OperationState myOperationState;
179 QAD_Application* myApp;
180 QList<QAD_StudyFrame> myStudyFrames;
181 QAD_StudyFrame* myActiveStudyFrame;
182 int myStudyFrameCount;
184 QList<QWidget> myChildWidgets;
198 QAD_PyInterp* myInterp;
199 TInitStudyThread* myInitStudyThread;