Salome HOME
0020501: EDF 1098 SMESH: Display only groups, edit a group: can't select face from...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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 // SMESH SMESHGUI : GUI for SMESH component
23 // File   : SMESHGUI.h
24 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
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   
74   bool                            isActiveStudyLocked();
75
76   static bool                     automaticUpdate();
77
78   virtual LightApp_Displayer*     displayer();
79   virtual QString                 engineIOR() const;
80   virtual void                    initialize( CAM_Application* );
81   virtual void                    windows( QMap<int, int>& ) const;
82   virtual void                    viewManagers( QStringList& ) const;
83
84   QDialog*                        GetActiveDialogBox();
85   void                            SetActiveDialogBox( QDialog* );
86
87   void                            ResetState();
88   void                            SetState( int );
89   bool                            DefineDlgPosition( QWidget*, int&, int& );
90   void                            switchToOperation( int );
91
92   virtual bool                    OnGUIEvent( int );
93   virtual bool                    OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
94   virtual bool                    OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
95   virtual bool                    OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
96
97   virtual LightApp_Selection*     createSelection() const;
98
99   virtual void                    BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
100                                                       SUIT_ViewWindow* = 0 );
101
102   /* Non modal dialog boxes management */
103   void                            EmitSignalDeactivateDialog();
104   void                            EmitSignalStudyFrameChanged();
105   void                            EmitSignalCloseAllDialogs();
106   void                            EmitSignalVisibilityChanged();
107
108   virtual void                    contextMenuPopup( const QString&, QMenu*, QString& );
109   virtual void                    createPreferences();
110   virtual void                    preferencesChanged( const QString&, const QString& );
111
112   virtual void                    update( const int );
113
114   static SALOMEDS::Color          getUniqueColor( const QList<SALOMEDS::Color>& );
115
116   virtual void                    storeVisualParameters  (int savePoint);
117   virtual void                    restoreVisualParameters(int savePoint);
118
119 public slots:
120   virtual bool                    deactivateModule( SUIT_Study* );
121   virtual bool                    activateModule( SUIT_Study* );
122   virtual void                    studyClosed( SUIT_Study* );
123
124 private slots:
125   void                            OnGUIEvent();
126   void                            onViewManagerActivated( SUIT_ViewManager* );
127   void                            onOperationCommited( SUIT_Operation* );
128   void                            onOperationAborted( SUIT_Operation* );
129   void                            onHypothesisEdit( int result );
130
131 signals:
132   void                            SignalDeactivateActiveDialog();
133   void                            SignalStudyFrameChanged();
134   void                            SignalCloseAllDialogs();
135   void                            SignalVisibilityChanged();
136
137 protected:
138   void                            createSMESHAction( const int,
139                                                      const QString&,
140                                                      const QString& = QString(),
141                                                      const int = 0,
142                                                      const bool = false );
143   void                            createPopupItem( const int,
144                                                    const QString&,
145                                                    const QString&,
146                                                    const QString& = QString(),
147                                                    const int = -1 );
148
149   virtual LightApp_Operation*     createOperation( const int ) const;
150
151   virtual bool                    isSelectionCompatible();
152
153 private:
154   void                            OnEditDelete();
155   int                             addVtkFontPref( const QString& label, 
156                                                   const int pId, 
157                                                   const QString& param );
158
159 private :
160   static SMESH::SMESH_Gen_var     myComponentSMESH;
161   QDialog*                        myActiveDialogBox;
162   int                             myState;
163   QMap<int, QString>              myRules;
164   LightApp_Displayer*             myDisplayer;
165
166   SMESHGUI_FilterLibraryDlg*      myFilterLibraryDlg;
167 };
168
169 #endif // SMESHGUI_H