Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[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 #include "SMESH_SMESHGUI.hxx"
33
34 // SALOME Includes
35 #include <SalomeApp_Module.h>
36 #include <SALOME_InteractiveObject.hxx>
37
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Gen)
40
41 class QDialog;
42
43 class SUIT_Desktop;
44 class SUIT_Study;
45 class SUIT_ViewWindow;
46 class SUIT_ResourceMgr;
47 class SUIT_ViewManager;
48
49 class LightApp_Operation;
50 class SalomeApp_Study;
51 class LightApp_SelectionMgr;
52
53 class SMESHGUI_FilterLibraryDlg;
54
55
56 //=================================================================================
57 // class    : SMESHGUI
58 // purpose  :
59 //=================================================================================
60 class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
61 {
62   Q_OBJECT;
63
64 public :
65   SMESHGUI();
66   ~SMESHGUI();
67
68   static SMESH::SMESH_Gen_var     GetSMESHGen();
69   static SMESHGUI*                GetSMESHGUI();
70   static LightApp_SelectionMgr*   selectionMgr();
71   static SUIT_ResourceMgr*        resourceMgr();
72   static SUIT_Desktop*            desktop() ;
73   static SalomeApp_Study*         activeStudy();
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* aDlg) ;
86
87   void                ResetState() ;
88   void                SetState(int aState) ;
89   bool                DefineDlgPosition(QWidget* aDlg, int& x, int& y) ;
90   void                switchToOperation(int id) ;
91
92   virtual bool OnGUIEvent        ( int id );
93   virtual bool OnMousePress      ( QMouseEvent*, SUIT_ViewWindow* );
94   virtual bool OnMouseMove       ( QMouseEvent*, SUIT_ViewWindow* );
95   virtual bool OnKeyPress        ( QKeyEvent*, SUIT_ViewWindow* );
96
97   virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
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
107   virtual void                createPreferences();
108   virtual void                preferencesChanged( const QString&, const QString& );
109   
110   virtual void                update( const int );
111
112   static SALOMEDS::Color      getUniqueColor( const QValueList<SALOMEDS::Color>& );
113
114 public slots:
115   virtual bool                deactivateModule( SUIT_Study* );
116   virtual bool                activateModule( SUIT_Study* );
117   virtual void                studyClosed( SUIT_Study* );
118
119 private slots:
120   void                        OnGUIEvent();
121   void                        onViewManagerActivated( SUIT_ViewManager* );
122   void                        onOperationCommited( SUIT_Operation* );
123   void                        onOperationAborted( SUIT_Operation* );
124
125
126 signals:
127   void SignalDeactivateActiveDialog() ;
128   void SignalStudyFrameChanged() ;
129   void SignalCloseAllDialogs() ;
130
131 protected:
132   void createSMESHAction( const int, const QString&, const QString& = QString(""),
133                           const int = 0, const bool = false );
134   void createPopupItem( const int, const QString&, const QString&,
135                         const QString& = QString::null, const int = -1 );
136   
137   virtual LightApp_Operation*      createOperation( const int ) const;
138
139 private:
140   void OnEditDelete();
141
142 private :
143   static SMESH::SMESH_Gen_var      myComponentSMESH;
144   QDialog*                         myActiveDialogBox;
145   int                              myState;
146   QMap<int,QString>                myRules;
147   LightApp_Displayer*              myDisplayer;
148
149   SMESHGUI_FilterLibraryDlg*       myFilterLibraryDlg;
150 };
151
152 #endif