Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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 //
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
47 class LightApp_Operation;
48 class SalomeApp_Study;
49 class LightApp_SelectionMgr;
50
51 class SMESHGUI_FilterLibraryDlg;
52
53
54 //=================================================================================
55 // class    : SMESHGUI
56 // purpose  :
57 //=================================================================================
58 class SMESHGUI : public SalomeApp_Module
59 {
60   Q_OBJECT;
61
62 public :
63   SMESHGUI();
64   ~SMESHGUI();
65
66   static SMESH::SMESH_Gen_var     GetSMESHGen();
67   static SMESHGUI*                GetSMESHGUI();
68   static LightApp_SelectionMgr*   selectionMgr();
69   static SUIT_ResourceMgr*        resourceMgr();
70   static SUIT_Desktop*            desktop() ;
71   static SalomeApp_Study*         activeStudy();
72   bool                            isActiveStudyLocked();
73
74   static bool                     automaticUpdate();
75
76   virtual LightApp_Displayer*     displayer();
77   virtual QString     engineIOR() const;
78   virtual void        initialize( CAM_Application* );
79   virtual void        windows( QMap<int, int>& ) const;
80   virtual void        viewManagers( QStringList& ) const;
81
82   QDialog*            GetActiveDialogBox() ;
83   void                SetActiveDialogBox(QDialog* aDlg) ;
84
85   void                ResetState() ;
86   void                SetState(int aState) ;
87   bool                DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
88   void                switchToOperation(int id) ;
89
90   virtual bool OnGUIEvent        ( int id );
91   virtual bool OnMousePress      ( QMouseEvent*, SUIT_ViewWindow* );
92   virtual bool OnMouseMove       ( QMouseEvent*, SUIT_ViewWindow* );
93   virtual bool OnKeyPress        ( QKeyEvent*, SUIT_ViewWindow* );
94
95   virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
96
97   virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
98                                    SUIT_ViewWindow* = 0 );
99
100   /* Non modal dialog boxes management */
101   void EmitSignalDeactivateDialog() ;
102   void EmitSignalStudyFrameChanged() ;
103   void EmitSignalCloseAllDialogs() ;
104
105   virtual void                createPreferences();
106   virtual void                preferencesChanged( const QString&, const QString& );
107   
108   virtual void                update( const int );
109
110 public slots:
111   virtual bool                deactivateModule( SUIT_Study* );
112   virtual bool                activateModule( SUIT_Study* );
113
114 private slots:
115   void                        OnGUIEvent();
116   void                        onViewManagerActivated( SUIT_ViewManager* );
117   void                        onOperationCommited( SUIT_Operation* );
118   void                        onOperationAborted( SUIT_Operation* );
119
120
121 signals:
122   void SignalDeactivateActiveDialog() ;
123   void SignalStudyFrameChanged() ;
124   void SignalCloseAllDialogs() ;
125
126 protected:
127   void createSMESHAction( const int, const QString&, const QString& = QString(""),
128                           const int = 0, const bool = false );
129   void createPopupItem( const int, const QString&, const QString&,
130                         const QString& = QString::null, const int = -1 );
131   
132   virtual LightApp_Operation*      createOperation( const int ) const;
133
134 private:
135   void OnEditDelete();
136
137 private :
138   static SMESH::SMESH_Gen_var      myComponentSMESH;
139   QDialog*                         myActiveDialogBox;
140   int                              myState;
141   QMap<int,QString>                myRules;
142   LightApp_Displayer*              myDisplayer;
143
144   SMESHGUI_FilterLibraryDlg*       myFilterLibraryDlg;
145 };
146
147 #endif