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 // File : SALOME_PYQT_Module.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 #ifndef SALOME_PYQT_MODULE_H
26 #define SALOME_PYQT_MODULE_H
28 #include "SALOME_PYQT_GUI.h"
29 #include "SALOME_PYQT_PyInterp.h" // this include must be first (see PyInterp_Interp.h)!
31 #include <SalomeApp_Module.h>
33 #include <QStringList>
38 #include <SALOMEconfig.h>
39 #include CORBA_CLIENT_HEADER(SALOME_Component)
41 class SALOME_PYQT_PyInterp;
42 class SUIT_ViewWindow;
47 class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module
54 //! study to Python subinterpreter map
55 typedef QMap<int, SALOME_PYQT_PyInterp*> InterpMap;
57 static InterpMap myInterpMap; //!< study to Python subinterpreter map
58 SALOME_PYQT_PyInterp* myInterp; //!< current Python subinterpreter
59 PyObjWrapper myModule; //!< Python GUI module
60 static SALOME_PYQT_Module* myInitModule; //!< Python GUI being initialized (not zero only during the initialization)
62 XmlHandler* myXmlHandler; //!< XML resource file parser
63 QMap<int, int> myWindowsMap; //!< windows map
64 QStringList myViewMgrList;//!< compatible view managers list
66 bool myLastActivateStatus; //!< latest module activation status
70 ~SALOME_PYQT_Module();
73 static SALOME_PYQT_Module* getInitModule();
75 void initialize( CAM_Application* );
76 void windows( QMap<int, int>& ) const;
77 void viewManagers( QStringList& ) const;
78 void contextMenuPopup( const QString&, QMenu*, QString& );
79 void createPreferences();
80 QString engineIOR() const;
81 void studyActivated();
82 void preferencesChanged( const QString&, const QString& );
84 static int defaultMenuGroup();
86 int createTool( const QString& );
87 int createTool( const int, const int, const int = -1 );
88 int createTool( const int, const QString&, const int = -1 );
89 int createTool( QAction*, const int,
90 const int = -1, const int = -1 );
91 int createTool( QAction*, const QString&,
92 const int = -1, const int = -1 );
94 int createMenu( const QString&, const int,
95 const int = -1, const int = -1, const int = -1 );
96 int createMenu( const QString&, const QString&,
97 const int = -1, const int = -1, const int = -1 );
98 int createMenu( const int, const int,
99 const int = -1, const int = -1 );
100 int createMenu( const int, const QString&,
101 const int = -1, const int = -1 );
102 int createMenu( QAction*, const int,
103 const int = -1, const int = -1, const int = -1 );
104 int createMenu( QAction*, const QString&,
105 const int = -1, const int = -1, const int = -1 );
107 QAction* separator();
109 QAction* action( const int ) const;
110 int actionId( const QAction* ) const;
111 QAction* createAction( const int, const QString&, const QString&,
112 const QString&, const QString&, const int,
113 const bool = false, QObject* = 0 );
114 QtxActionGroup* createActionGroup( const int, const bool );
117 QIcon loadIcon( const QString& fileName );
119 int addGlobalPreference( const QString& );
120 int addPreference( const QString& );
121 int addPreference( const QString&, const int, const int = LightApp_Preferences::Auto,
122 const QString& = QString(),
123 const QString& = QString() );
124 QVariant preferenceProperty( const int, const QString& ) const;
125 void setPreferenceProperty( const int, const QString&,
129 virtual bool activateModule( SUIT_Study* );
130 virtual bool deactivateModule( SUIT_Study* );
131 void preferenceChanged( const QString&,
136 void onActiveViewChanged( SUIT_ViewWindow* );
137 void onViewClosed( SUIT_ViewWindow* );
138 void onViewCloned( SUIT_ViewWindow* );
141 Engines::Component_var getEngine() const;
144 void init( CAM_Application* );
145 void activate( SUIT_Study* );
146 void deactivate( SUIT_Study* );
147 bool lastActivationStatus() const;
148 void customize( SUIT_Study* );
149 void studyChanged( SUIT_Study* );
150 void contextMenu( const QString&, QMenu* );
151 void guiEvent( const int );
152 void initPreferences();
153 void prefChanged( const QString&, const QString& );
155 void initInterp ( int );
159 void activeViewChanged( const SUIT_ViewWindow* );
160 void viewClosed( const SUIT_ViewWindow* );
161 void viewCloned( const SUIT_ViewWindow* );
162 void connectView( const SUIT_ViewWindow* );
164 friend class XmlHandler;
167 #endif // SALOME_PYQT_MODULE_H