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);
87 const QString& getTitle() const;
89 const QString& getPath() const;
90 void setTitle( const QString& title);
91 void updateCaptions();
93 QAD_Application* getApp() const;
98 /* operation management */
99 OperationState getOperationState() const;
100 int getOperationsCount() const;
101 QAD_Operation* getOperation( unsigned i );
102 QAD_Operation* getFirstOperation();
103 QAD_Operation* getLastOperation();
105 void abortAllOperations();
106 void resumeAllOperations();
107 void suspendAllOperations();
109 bool onOperationStarted( QAD_Operation* );
110 void onOperationFinished( QAD_Operation* );
111 void onOperationSuspended( QAD_Operation* );
112 void onOperationResumed( QAD_Operation* );
113 void onOperationAborted( QAD_Operation* );
115 /* standard CAF document */
116 SALOMEDS::Study_var getStudyDocument();
120 bool canUndo() const;
121 bool canRedo() const;
123 QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
124 void showFrame(QAD_StudyFrame* theFrame);
126 void setMessage(const char* message);
128 void updateObjBrowser( bool updateSelection = true );
129 void updateUseCaseBrowser( bool updateSelection = true );
130 void update3dViewers();
132 /* interactive object management */
133 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
134 bool highlight, bool immediatly=true );
135 void unHighlightAll();
137 void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
139 int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
141 bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
142 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
143 bool isInViewer(const char* anEntry,
144 const char* StudyFrameEntry);
147 void Selection( QString aSelection );
148 QString getSelection();
150 /* python interpreter */
151 QAD_PyInterp* get_PyInterp(void);
153 QString getNextStudyFrameName();
155 /* Child widgets handling (not QAD_StudyFrame) */
156 void addChildWidget( QWidget* child );
157 void removeChildWidget( QWidget* child );
160 void docClosing( QAD_Study* );
161 void docOperationTerminated( bool );
165 void onStudyFrameActivated( QAD_StudyFrame* );
166 void onStudyDeactivated();
167 void onLastStudyFrameClosing( QAD_StudyFrame* );
170 void addStudyFrame( QAD_StudyFrame* );
171 bool initOperation( QAD_Operation* );
172 void clearOperation( QAD_Operation* );
175 SALOMEDS::Study_var myStudy;
177 QList<QAD_Operation> myOperations;
178 OperationState myOperationState;
180 QAD_Application* myApp;
181 QList<QAD_StudyFrame> myStudyFrames;
182 QAD_StudyFrame* myActiveStudyFrame;
183 int myStudyFrameCount;
185 QList<QWidget> myChildWidgets;
199 QAD_PyInterp* myInterp;
200 TInitStudyThread* myInitStudyThread;