Salome HOME
Portation on new based dialog
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.h
1 //  SMESH SMESHGUI : GUI for SMESH 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   : SMESHGUI.h
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef SMESHGUI_HeaderFile
30 #define SMESHGUI_HeaderFile
31
32 // SALOME Includes
33 #include <SalomeApp_Module.h>
34 #include <SALOME_InteractiveObject.hxx>
35
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Gen)
38
39 class QDialog;
40
41 class SUIT_Desktop;
42 class SUIT_Study;
43 class SUIT_ViewWindow;
44 class SUIT_ResourceMgr;
45 class SUIT_ViewManager;
46 class SUIT_Operation;
47
48 class SalomeApp_Study;
49 class SalomeApp_SelectionMgr;
50 class SalomeApp_Operation;
51
52
53 //=================================================================================
54 // class    : SMESHGUI
55 // purpose  :
56 //=================================================================================
57 class SMESHGUI : public SalomeApp_Module
58 {
59   Q_OBJECT;
60
61 public :
62   SMESHGUI();
63   virtual ~SMESHGUI();
64
65   static SMESH::SMESH_Gen_var       GetSMESHGen();
66   static SMESHGUI*                  GetSMESHGUI();
67   static SalomeApp_SelectionMgr*    selectionMgr();
68   static SUIT_ResourceMgr*          resourceMgr();
69   static SUIT_Desktop*              desktop();
70   static SalomeApp_Study*           activeStudy();
71   bool                              isActiveStudyLocked();
72
73   static bool                       automaticUpdate();
74
75   virtual QString                   engineIOR() const;
76   virtual void                      initialize( CAM_Application* );
77   virtual void                      windows( QMap<int, int>& ) const;
78   virtual void                      viewManagers( QStringList& ) const;
79
80   QDialog*                          GetActiveDialogBox();
81   void                              SetActiveDialogBox(QDialog* aDlg);
82
83   void                              ResetState();
84   void                              SetState( int aState );
85   bool                              DefineDlgPosition( QWidget* aDlg, int& x, int& y);
86
87   virtual bool                      OnGUIEvent( int id );
88   virtual bool                      OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
89   virtual bool                      OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
90   virtual bool                      OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
91
92   virtual void                      contextMenuPopup( const QString&, QPopupMenu*, QString& );
93
94   virtual bool                      SetSettings( SUIT_Desktop* );
95   virtual void                      BuildPresentation( const Handle(SALOME_InteractiveObject)&,
96                                                        SUIT_ViewWindow* = 0 );
97
98   /* Non modal dialog boxes management */
99   void                              EmitSignalDeactivateDialog();
100   void                              EmitSignalStudyFrameChanged();
101   void                              EmitSignalCloseAllDialogs();
102
103   virtual void                      createPreferences();
104   virtual void                      preferencesChanged( const QString&, const QString& );
105
106   virtual void                      update( const int );
107
108 public slots:
109
110   virtual bool                      deactivateModule( SUIT_Study* );
111   virtual bool                      activateModule( SUIT_Study* );
112
113 private slots:
114
115   void                              OnGUIEvent();
116   void                              onViewManagerAdded( SUIT_ViewManager* );
117   void                              onOperationCommited( SUIT_Operation* );
118   void                              onOperationAborted( SUIT_Operation* );
119
120 signals:
121   void                              SignalDeactivateActiveDialog();
122   void                              SignalStudyFrameChanged();
123   void                              SignalCloseAllDialogs();
124
125 protected:
126   virtual SalomeApp_Operation*      createOperation( const int ) const;
127
128   void                              createSMESHAction( const int,
129                                                        const QString&,
130                                                        const QString& = "",
131                                                        const int = 0,
132                                                        const bool = false );
133   void                              createPopupItem( const int,
134                                                      const QString&,
135                                                      const QString&,
136                                                      const QString& = QString::null,
137                                                      const int = -1 );
138
139   SalomeApp_Operation*             getOperation( const int );
140   virtual void                     updateControls();
141
142 private :
143   static SMESH::SMESH_Gen_var      myComponentSMESH;
144   QDialog*                         myActiveDialogBox;
145   int                              myState;
146   QMap<int,QString>                myRules;
147   QMap<int, SalomeApp_Operation*>  myOperations;
148 };
149
150 #endif