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;
49 class QAD_EXPORT QAD_Study : public QObject
54 QAD_Study(QAD_Application* app,
55 SALOMEDS::Study_var aStudy,
56 const QString& title);
60 bool eventFilter( QObject* o, QEvent* e);
63 /* studyframes management */
64 QAD_StudyFrame* createStudyFrame(const QString& name, ViewType theViewType = VIEW_TYPE_MAX);
65 void removeStudyFrame( QAD_StudyFrame* );
66 int getStudyFramesCount() const;
67 const QList<QAD_StudyFrame>& getStudyFrames() const;
68 QAD_StudyFrame* getStudyFrameByName( const QString& name );
69 QAD_StudyFrame* getFirstStudyFrame();
70 QAD_StudyFrame* getLastStudyFrame();
71 QAD_StudyFrame* getStudyFrame( unsigned i );
72 QAD_StudyFrame* getActiveStudyFrame() const;
76 /* document state management */
77 bool isActive() const;
79 bool isModified() const;
80 bool isReadOnly() const;
81 void setReadOnly(bool state);
82 const QString& getTitle() const;
84 const QString& getPath() const;
85 void setTitle( const QString& title);
86 void updateCaptions();
88 QAD_Application* getApp() const;
93 /* operation management */
94 OperationState getOperationState() const;
95 int getOperationsCount() const;
96 QAD_Operation* getOperation( unsigned i );
97 QAD_Operation* getFirstOperation();
98 QAD_Operation* getLastOperation();
100 void abortAllOperations();
101 void resumeAllOperations();
102 void suspendAllOperations();
104 bool onOperationStarted( QAD_Operation* );
105 void onOperationFinished( QAD_Operation* );
106 void onOperationSuspended( QAD_Operation* );
107 void onOperationResumed( QAD_Operation* );
108 void onOperationAborted( QAD_Operation* );
110 /* standard CAF document */
111 SALOMEDS::Study_var getStudyDocument();
115 bool canUndo() const;
116 bool canRedo() const;
118 QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
119 void showFrame(QAD_StudyFrame* theFrame);
121 void setMessage(const char* message);
123 void updateObjBrowser( bool updateSelection = true );
124 void updateUseCaseBrowser( bool updateSelection = true );
125 void update3dViewers();
127 /* interactive object management */
128 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
129 bool highlight, bool immediatly=true );
130 void unHighlightAll();
132 void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
134 int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
136 bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
137 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
138 bool isInViewer(const char* anEntry,
139 const char* StudyFrameEntry);
142 void Selection( QString aSelection );
143 QString getSelection();
145 /* python interpreter */
146 QAD_PyInterp* get_PyInterp(void);
148 QString getNextStudyFrameName();
150 /* Child widgets handling (not QAD_StudyFrame) */
151 void addChildWidget( QWidget* child );
152 void removeChildWidget( QWidget* child );
155 void docClosing( QAD_Study* );
156 void docOperationTerminated( bool );
159 void onStudyFrameActivated( QAD_StudyFrame* );
160 void onStudyDeactivated();
161 void onLastStudyFrameClosing( QAD_StudyFrame* );
164 void addStudyFrame( QAD_StudyFrame* );
165 bool initOperation( QAD_Operation* );
166 void clearOperation( QAD_Operation* );
169 SALOMEDS::Study_var myStudy;
171 QList<QAD_Operation> myOperations;
172 OperationState myOperationState;
174 QAD_Application* myApp;
175 QList<QAD_StudyFrame> myStudyFrames;
176 QAD_StudyFrame* myActiveStudyFrame;
177 int myStudyFrameCount;
179 QList<QWidget> myChildWidgets;
191 QAD_PyInterp* _interp;