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