Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / SALOMEGUI / QAD_Study.h
1 //  File      : QAD_Study.cxx
2 //  Created   : UI team, 05.09.00
3 //  Descrip   : Study for QAD-based application
4
5 //  Modified  : Mon Dec 03 15:37:21 2001
6 //  Author    : Nicolas REJNERI
7 //  Project   : SALOME
8 //  Module    : SALOMEGUI
9 //  Copyright : Open CASCADE 2001
10 //  $Header$
11
12 #ifndef QAD_STUDY_H
13 #define QAD_STUDY_H
14
15 #include "QAD_Operation.h"
16 #include "QAD_StudyFrame.h"
17
18 #include "SALOME_InteractiveObject.hxx"
19
20 // IDL Headers
21 #include <SALOMEconfig.h>
22 #include CORBA_SERVER_HEADER(SALOMEDS)
23
24 // QT Includes
25 #include <qdict.h>
26 #include <qobject.h>
27 #include <qstring.h>
28
29 class QAD_Application;
30 class QAD_PyInterp;
31
32 class QAD_EXPORT QAD_Study : public QObject
33 {
34   Q_OBJECT
35
36 public:
37   QAD_Study(QAD_Application* app,
38             SALOMEDS::Study_var aStudy,
39             const QString& title);
40   ~QAD_Study();
41
42   /* Event filter */
43   bool eventFilter( QObject* o, QEvent* e);
44
45 public:
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;
56   
57   bool             getResult();
58
59   /* document state management */
60   bool             isActive() const;
61   bool             isSaved() const;
62   bool             isModified() const;
63   bool             isReadOnly() const;
64   void             setReadOnly(bool state);
65   const QString&   getTitle() const;
66   int              getStudyId();
67   const QString&   getPath() const;
68   void             setTitle( const QString& title);
69   void             updateCaptions();
70   void             close();
71   QAD_Application* getApp() const;
72
73   /* visualization */
74   void             show();
75
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();
82
83   void             abortAllOperations();
84   void             resumeAllOperations();
85   void             suspendAllOperations();
86
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* );
92
93   /* standard CAF document */
94   SALOMEDS::Study_var      getStudyDocument();
95
96   bool            undo();
97   bool            redo();
98   bool            canUndo() const;
99   bool            canRedo() const;
100
101   QAD_StudyFrame* newWindow3d(QString name = "", ViewType theViewType = VIEW_TYPE_MAX, bool toShow = true);
102   void            showFrame(QAD_StudyFrame* theFrame);
103
104   void            setMessage(const char* message);
105
106   void            updateObjBrowser( bool updateSelection = true );
107   void            updateUseCaseBrowser( bool updateSelection = true );
108   void            update3dViewers();
109
110   /*  interactive object management */
111   void            highlight( const Handle(SALOME_InteractiveObject)& IObject, 
112                              bool highlight, bool immediatly=true );
113   void            unHighlightAll();
114
115   void            renameIObject( const Handle(SALOME_InteractiveObject)& IObject,
116                                  QString newName );
117   int             typeIObject( const Handle(SALOME_InteractiveObject)& IObject );
118
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);
123
124   /* selection */
125   void            Selection( QString aSelection );
126   QString         getSelection();
127
128   /* python interpreter */
129   QAD_PyInterp*   get_PyInterp(void);
130
131   QString  getNextStudyFrameName();
132
133   /* Child widgets handling (not QAD_StudyFrame) */
134   void            addChildWidget( QWidget* child );
135   void            removeChildWidget( QWidget* child );
136
137 signals:
138   void            docClosing( QAD_Study* );
139   void            docOperationTerminated( bool );
140
141 public slots:
142   void            onStudyFrameActivated( QAD_StudyFrame* );
143   void            onStudyDeactivated();
144   void            onLastStudyFrameClosing( QAD_StudyFrame* );
145
146 private:
147   void            addStudyFrame( QAD_StudyFrame* );
148   bool            initOperation( QAD_Operation* );
149   void            clearOperation( QAD_Operation* );
150
151 private:
152   SALOMEDS::Study_var       myStudy;
153
154   QList<QAD_Operation>      myOperations;
155   OperationState            myOperationState;
156
157   QAD_Application*          myApp;
158   QList<QAD_StudyFrame>     myStudyFrames;
159   QAD_StudyFrame*           myActiveStudyFrame;
160   int                       myStudyFrameCount;
161
162   QList<QWidget>            myChildWidgets;
163
164   QString                   myPath;
165   QString                   myTitle;
166
167   QString                   mySelection;
168
169   bool                      myIsActive;
170   bool                      myIsSaved;
171   bool                      myIsModified;
172   bool                      myIsReadOnly;
173   bool                      myResult;
174   QAD_PyInterp*             _interp;
175 };
176
177 #endif
178