1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SMESH SMESHGUI : GUI for SMESH component
24 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
30 #include "SMESH_SMESHGUI.hxx"
32 // SALOME GUI includes
33 #include <SalomeApp_Module.h>
34 #include <SALOME_InteractiveObject.hxx>
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Gen)
44 class SUIT_ViewWindow;
45 class SUIT_ResourceMgr;
46 class SUIT_ViewManager;
48 class LightApp_Operation;
49 class SalomeApp_Study;
50 class LightApp_Selection;
51 class LightApp_SelectionMgr;
53 class SMESHGUI_FilterLibraryDlg;
55 //=================================================================================
58 //=================================================================================
59 class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
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 static char* JoinObjectParameters(const QStringList& theParametersList);
75 bool isActiveStudyLocked();
77 static bool automaticUpdate();
79 virtual LightApp_Displayer* displayer();
80 virtual QString engineIOR() const;
81 virtual void initialize( CAM_Application* );
82 virtual void windows( QMap<int, int>& ) const;
83 virtual void viewManagers( QStringList& ) const;
85 QDialog* GetActiveDialogBox();
86 void SetActiveDialogBox( QDialog* );
90 bool DefineDlgPosition( QWidget*, int&, int& );
91 void switchToOperation( int );
93 virtual bool OnGUIEvent( int );
94 virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
95 virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
96 virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
98 virtual LightApp_Selection* createSelection() const;
100 virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
101 SUIT_ViewWindow* = 0 );
103 /* Non modal dialog boxes management */
104 void EmitSignalDeactivateDialog();
105 void EmitSignalStudyFrameChanged();
106 void EmitSignalCloseAllDialogs();
108 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
109 virtual void createPreferences();
110 virtual void preferencesChanged( const QString&, const QString& );
112 virtual void update( const int );
114 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
116 virtual void storeVisualParameters (int savePoint);
117 virtual void restoreVisualParameters(int savePoint);
120 virtual bool deactivateModule( SUIT_Study* );
121 virtual bool activateModule( SUIT_Study* );
122 virtual void studyClosed( SUIT_Study* );
126 void onViewManagerActivated( SUIT_ViewManager* );
127 void onOperationCommited( SUIT_Operation* );
128 void onOperationAborted( SUIT_Operation* );
132 void SignalDeactivateActiveDialog();
133 void SignalStudyFrameChanged();
134 void SignalCloseAllDialogs();
137 void createSMESHAction( const int,
139 const QString& = QString(),
141 const bool = false );
142 void createPopupItem( const int,
145 const QString& = QString(),
148 virtual LightApp_Operation* createOperation( const int ) const;
150 virtual bool isSelectionCompatible();
154 int addVtkFontPref( const QString& label,
156 const QString& param );
159 static SMESH::SMESH_Gen_var myComponentSMESH;
160 QDialog* myActiveDialogBox;
162 QMap<int, QString> myRules;
163 LightApp_Displayer* myDisplayer;
165 SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg;