Salome HOME
Bug IPAL19361 - Qt4 porting. It is impossible showing ID of elements in 3D Viewer...
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : SMESHGUI.h
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
24 //
25
26 #ifndef SMESHGUI_H
27 #define SMESHGUI_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31
32 // SALOME GUI includes
33 #include <SalomeApp_Module.h>
34 #include <SALOME_InteractiveObject.hxx>
35
36 // IDL includes
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Gen)
39
40 class QDialog;
41
42 class SUIT_Desktop;
43 class SUIT_Study;
44 class SUIT_ViewWindow;
45 class SUIT_ResourceMgr;
46 class SUIT_ViewManager;
47
48 class LightApp_Operation;
49 class SalomeApp_Study;
50 class LightApp_Selection;
51 class LightApp_SelectionMgr;
52
53 class SMESHGUI_FilterLibraryDlg;
54
55 //=================================================================================
56 // class    : SMESHGUI
57 // purpose  :
58 //=================================================================================
59 class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
60 {
61   Q_OBJECT;
62
63 public :
64   SMESHGUI();
65   ~SMESHGUI();
66
67   static SMESH::SMESH_Gen_var     GetSMESHGen();
68   static SMESHGUI*                GetSMESHGUI();
69   static LightApp_SelectionMgr*   selectionMgr();
70   static SUIT_ResourceMgr*        resourceMgr();
71   static SUIT_Desktop*            desktop();
72   static SalomeApp_Study*         activeStudy();
73   bool                            isActiveStudyLocked();
74
75   static bool                     automaticUpdate();
76
77   virtual LightApp_Displayer*     displayer();
78   virtual QString                 engineIOR() const;
79   virtual void                    initialize( CAM_Application* );
80   virtual void                    windows( QMap<int, int>& ) const;
81   virtual void                    viewManagers( QStringList& ) const;
82
83   QDialog*                        GetActiveDialogBox();
84   void                            SetActiveDialogBox( QDialog* );
85
86   void                            ResetState();
87   void                            SetState( int );
88   bool                            DefineDlgPosition( QWidget*, int&, int& );
89   void                            switchToOperation( int );
90
91   virtual bool                    OnGUIEvent( int );
92   virtual bool                    OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
93   virtual bool                    OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
94   virtual bool                    OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
95
96   virtual LightApp_Selection*     createSelection() const;
97
98   virtual void                    BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
99                                                       SUIT_ViewWindow* = 0 );
100
101   /* Non modal dialog boxes management */
102   void                            EmitSignalDeactivateDialog();
103   void                            EmitSignalStudyFrameChanged();
104   void                            EmitSignalCloseAllDialogs();
105
106   virtual void                    createPreferences();
107   virtual void                    preferencesChanged( const QString&, const QString& );
108   
109   virtual void                    update( const int );
110
111   static SALOMEDS::Color          getUniqueColor( const QList<SALOMEDS::Color>& );
112
113 public slots:
114   virtual bool                    deactivateModule( SUIT_Study* );
115   virtual bool                    activateModule( SUIT_Study* );
116   virtual void                    studyClosed( SUIT_Study* );
117
118 private slots:
119   void                            OnGUIEvent();
120   void                            onViewManagerActivated( SUIT_ViewManager* );
121   void                            onOperationCommited( SUIT_Operation* );
122   void                            onOperationAborted( SUIT_Operation* );
123
124
125 signals:
126   void                            SignalDeactivateActiveDialog();
127   void                            SignalStudyFrameChanged();
128   void                            SignalCloseAllDialogs();
129
130 protected:
131   void                            createSMESHAction( const int, 
132                                                      const QString&, 
133                                                      const QString& = QString(),
134                                                      const int = 0, 
135                                                      const bool = false );
136   void                            createPopupItem( const int, 
137                                                    const QString&, 
138                                                    const QString&,
139                                                    const QString& = QString(), 
140                                                    const int = -1 );
141   
142   virtual LightApp_Operation*     createOperation( const int ) const;
143
144 private:
145   void                            OnEditDelete();
146
147 private :
148   static SMESH::SMESH_Gen_var     myComponentSMESH;
149   QDialog*                        myActiveDialogBox;
150   int                             myState;
151   QMap<int, QString>              myRules;
152   LightApp_Displayer*             myDisplayer;
153
154   SMESHGUI_FilterLibraryDlg*      myFilterLibraryDlg;
155 };
156
157 #endif // SMESHGUI_H