Salome HOME
SALOME PAL V1_4_1
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGUI.h
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 #ifndef SUPERVGUI_H
29 #define SUPERVGUI_H
30
31 // Acces a l'ihm de SALOME
32 // -----------------------
33
34 #include "QAD_Desktop.h"
35
36
37 #include "SUPERVGUI_Def.h"
38 #include "SUPERVGUI_Service.h"
39 #include "SUPERVGUI_Main.h"
40 //#include "SUPERVGUI_Information.h"
41
42
43 // Definition de la classe principale du module de supervision
44 // -----------------------------------------------------------
45
46 class SUPERVGUI: public QObject {
47   Q_OBJECT
48
49   public:
50     SUPERVGUI();
51     virtual ~SUPERVGUI();
52
53     QAD_Desktop*       getDesktop();
54     SUPERV_Engine      getEngine();
55     QAD_Study*         getActiveStudy() 
56       { return study; };
57
58     SUPERVGUI_Service* getBrowser();
59     QCursor            getCursor();
60     //bool information(SUPERV_CNode node, bool isReadOnly);
61     void putInfo(const char* mess);
62
63     void importDataflow();
64     void exportDataflow();
65     void newDataflow();
66     void modifyDataflow();
67     void reloadDataflow();
68     void runDataflow();
69     void stepByStep();
70     void killDataflow();
71     void suspendResumeDataflow();
72     void showComponents();
73
74     void init(QAD_Desktop* parent);
75     SUPERVGUI_Main* getMain();
76     void customPopup(QPopupMenu* popup);
77     void activeStudyChanged();
78
79     bool isContains(QAD_Study* theStudy, const QString theKey);
80
81     void registerGraph(QString theName, SUPERVGUI_Main* theGraph);
82     void unregisterGraph(SUPERVGUI_Main* theGraph);
83     QAD_StudyFrame* createGraph();
84
85     /** Returns:
86         theIsOwner = true if Selected object belongs to Suipervision.
87         theIsDataflow = true if Selected object is Dataflow
88     */
89     void whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, bool& theIsOwner, bool& theIsDataflow);
90
91   private slots:
92     void setMain(QWidget* w);
93     void displayDataflow();
94     void renameDataflow();
95     void deleteObject();
96     void onGraphClosed(QAD_StudyFrame* );
97
98   private:
99     void loadEngine(SALOME_NamingService* namingService);
100
101     static int             factory;
102     QAD_Desktop*           desktop;
103     QAD_Study*             study;
104     SUPERV_Engine          engine;
105     SUPERVGUI_Service*     browser;
106     //SUPERVGUI_Information* info;
107     QCursor                cursor;
108
109     SUPERVGUI_Main*        main;  // active main    
110     QPtrList<SUPERVGUI_Main> myGraphList;
111 };
112
113
114 // Acces a l'instance unique de la classe du module de l'interface graphique de la supervision
115 // -------------------------------------------------------------------------------------------
116 extern SUPERVGUI Supervision;
117
118 #endif