1 //=============================================================================
2 // File : SALOME_PYQT_Module.h
4 // Author : Vadim SANDLER
6 // Copyright : 2003-2005 CEA/DEN, EDF R&D
8 //=============================================================================
10 #ifndef SALOME_PYQT_MODULE_H
11 #define SALOME_PYQT_MODULE_H
13 #include "SALOME_PYQT_GUI.h"
15 #include "SALOME_PYQT_PyInterp.h" // this include must be first (see PyInterp_base.h)!
16 #include "SalomeApp_Module.h"
20 #include <qstringlist.h>
23 #include <SALOMEconfig.h>
24 #include CORBA_CLIENT_HEADER(SALOME_Component)
26 class SALOME_PYQT_XmlHandler;
28 class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module
32 /******************************
34 ******************************/
37 typedef std::map<int, SALOME_PYQT_PyInterp*> InterpMap;
39 /* study-to-subinterpreter map */
40 static InterpMap myInterpMap;
41 /* current Python subinterpreter */
42 SALOME_PYQT_PyInterp* myInterp;
43 /* Python GUI module loaded */
44 PyObjWrapper myModule;
46 typedef QPtrList<QAction> ActionList;
48 /* own actions list */
49 ActionList myMenuActionList;
50 ActionList myPopupActionList;
51 ActionList myToolbarActionList;
53 enum PyQtGUIAction { PYQT_ACTION_MENU = 10000000,
54 PYQT_ACTION_TOOLBAL = 20000000,
55 PYQT_ACTION_POPUP = 30000000 };
57 /* XML resource file parser */
58 SALOME_PYQT_XmlHandler* myXmlHandler;
60 QMap<int, int> myWindowsMap;
61 /* compatible view managers list */
62 QStringList myViewMgrList;
64 /******************************
65 * Construction/destruction
66 ******************************/
72 ~SALOME_PYQT_Module();
74 /* get module engine */
75 Engines::Component_var getEngine() const;
77 /******************************
78 * Inherited from CAM_Module
79 ******************************/
83 void initialize ( CAM_Application* );
85 /* getting windows list */
86 void windows ( QMap<int, int>& ) const;
87 /* getting compatible viewer managers list */
88 void viewManagers( QStringList& ) const;
90 /* context popup menu request */
91 void contextMenuPopup( const QString&, QPopupMenu*, QString& );
93 /* get module engine IOR */
94 virtual QString engineIOR() const;
97 /* data model creation */
98 CAM_DataModel* createDataModel();
102 void activateModule( SUIT_Study* );
104 void deactivateModule( SUIT_Study* );
106 /******************************
108 ******************************/
111 /* GUI action processing slot */
113 /* desktop activation slot */
114 void onDesktopActivated();
117 /* internal initizalition */
118 void init ( CAM_Application* );
119 /* internal activation */
120 void activate ( SUIT_Study* );
121 /* internal deactivation */
122 void deactivate ( SUIT_Study* );
123 /* study activation */
124 void studyChanged( SUIT_Study* );
125 /* context popup menu processing */
126 void contextMenu( const QString&, QPopupMenu* );
127 /* GUI event processing */
128 void guiEvent( const int );
130 /* add action to the private action map */
131 void addAction ( const PyQtGUIAction, QAction* );
133 /* initialize a Python subinterpreter */
134 void initInterp ( int );
135 /* import a Python GUI module */
137 /* set workspace to Python GUI module */
140 friend class SALOME_PYQT_XmlHandler;
143 #endif // SALOME_PYQT_MODULE_H