1 // File : QAD_Study.cxx
2 // Created : UI team, 05.09.00
3 // Descrip : Study for QAD-based application
5 // Modified : Mon Dec 03 15:37:21 2001
6 // Author : Nicolas REJNERI
9 // Copyright : Open CASCADE 2001
15 #include "QAD_Operation.h"
16 #include "QAD_StudyFrame.h"
18 #include "SALOME_InteractiveObject.hxx"
21 #include <SALOMEconfig.h>
22 #include CORBA_SERVER_HEADER(SALOMEDS)
29 class QAD_Application;
32 class QAD_EXPORT QAD_Study : public QObject
37 QAD_Study(QAD_Application* app,
38 SALOMEDS::Study_var aStudy,
39 const QString& title);
43 bool eventFilter( QObject* o, QEvent* e);
46 /* studyframes management */
47 QAD_StudyFrame* createStudyFrame(const QString& name, ViewType theViewType = VIEW_TYPE_MAX);
48 void removeStudyFrame( QAD_StudyFrame* );
49 int getStudyFramesCount() const;
50 const QList<QAD_StudyFrame>& getStudyFrames() const;
51 QAD_StudyFrame* getStudyFrameByName( const QString& name );
52 QAD_StudyFrame* getFirstStudyFrame();
53 QAD_StudyFrame* getLastStudyFrame();
54 QAD_StudyFrame* getStudyFrame( unsigned i );
55 QAD_StudyFrame* getActiveStudyFrame() const;
59 /* document state management */
60 bool isActive() const;
62 bool isModified() const;
63 bool isReadOnly() const;
64 void setReadOnly(bool state);
65 const QString& getTitle() const;
67 const QString& getPath() const;
68 void setTitle( const QString& title);
69 void updateCaptions();
71 QAD_Application* getApp() const;
76 /* operation management */
77 OperationState getOperationState() const;
78 int getOperationsCount() const;
79 QAD_Operation* getOperation( unsigned i );
80 QAD_Operation* getFirstOperation();
81 QAD_Operation* getLastOperation();
83 void abortAllOperations();
84 void resumeAllOperations();
85 void suspendAllOperations();
87 bool onOperationStarted( QAD_Operation* );
88 void onOperationFinished( QAD_Operation* );
89 void onOperationSuspended( QAD_Operation* );
90 void onOperationResumed( QAD_Operation* );
91 void onOperationAborted( QAD_Operation* );
93 /* standard CAF document */
94 SALOMEDS::Study_var getStudyDocument();
101 QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
102 void showFrame(QAD_StudyFrame* theFrame);
104 void setMessage(const char* message);
106 void updateObjBrowser( bool updateSelection = true );
107 void updateUseCaseBrowser( bool updateSelection = true );
108 void update3dViewers();
110 /* interactive object management */
111 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
112 bool highlight, bool immediatly=true );
113 void unHighlightAll();
115 void renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
117 int typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
119 bool isInStudy( const Handle(SALOME_InteractiveObject)& IObject );
120 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
121 bool isInViewer(const char* anEntry,
122 const char* StudyFrameEntry);
125 void Selection( QString aSelection );
126 QString getSelection();
128 /* python interpreter */
129 QAD_PyInterp* get_PyInterp(void);
131 QString getNextStudyFrameName();
133 /* Child widgets handling (not QAD_StudyFrame) */
134 void addChildWidget( QWidget* child );
135 void removeChildWidget( QWidget* child );
138 void docClosing( QAD_Study* );
139 void docOperationTerminated( bool );
142 void onStudyFrameActivated( QAD_StudyFrame* );
143 void onStudyDeactivated();
144 void onLastStudyFrameClosing( QAD_StudyFrame* );
147 void addStudyFrame( QAD_StudyFrame* );
148 bool initOperation( QAD_Operation* );
149 void clearOperation( QAD_Operation* );
152 SALOMEDS::Study_var myStudy;
154 QList<QAD_Operation> myOperations;
155 OperationState myOperationState;
157 QAD_Application* myApp;
158 QList<QAD_StudyFrame> myStudyFrames;
159 QAD_StudyFrame* myActiveStudyFrame;
160 int myStudyFrameCount;
162 QList<QWidget> myChildWidgets;
174 QAD_PyInterp* _interp;