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