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 class SALOME_PYQT_XmlHandler;
25 class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module
29 /******************************
31 ******************************/
34 typedef std::map<int, SALOME_PYQT_PyInterp*> InterpMap;
36 /* study-to-subinterpreter map */
37 static InterpMap myInterpMap;
38 /* current Python subinterpreter */
39 SALOME_PYQT_PyInterp* myInterp;
40 /* Python GUI module loaded */
41 PyObjWrapper myModule;
43 typedef QPtrList<QAction> ActionList;
45 /* own actions list */
46 ActionList myMenuActionList;
47 ActionList myPopupActionList;
48 ActionList myToolbarActionList;
50 enum PyQtGUIAction { PYQT_ACTION_MENU = 10000000,
51 PYQT_ACTION_TOOLBAL = 20000000,
52 PYQT_ACTION_POPUP = 30000000 };
54 /* XML resource file parser */
55 SALOME_PYQT_XmlHandler* myXmlHandler;
57 QMap<int, int> myWindowsMap;
58 /* compatible view managers list */
59 QStringList myViewMgrList;
61 /******************************
62 * Construction/destruction
63 ******************************/
69 ~SALOME_PYQT_Module();
71 /******************************
72 * Inherited from CAM_Module
73 ******************************/
77 void initialize ( CAM_Application* );
79 /* getting windows list */
80 void windows ( QMap<int, int>& ) const;
81 /* getting compatible viewer managers list */
82 void viewManagers( QStringList& ) const;
84 /* context popup menu request */
85 void contextMenuPopup( const QString&, QPopupMenu*, QString& );
88 /* data model creation */
89 CAM_DataModel* createDataModel();
93 void activateModule ( SUIT_Study* );
95 void deactivateModule( SUIT_Study* );
97 /******************************
99 ******************************/
102 /* GUI action processing slot */
104 /* desktop activation slot */
105 void onDesktopActivated();
108 /* internal initizalition */
109 void init ( CAM_Application* );
110 /* internal activation */
111 void activate ( SUIT_Study* );
112 /* internal deactivation */
113 void deactivate ( SUIT_Study* );
114 /* study activation */
115 void studyChanged( SUIT_Study* );
116 /* context popup menu processing */
117 void contextMenu( const QString&, QPopupMenu* );
118 /* GUI event processing */
119 void guiEvent( const int );
121 /* add action to the private action map */
122 void addAction ( const PyQtGUIAction, QAction* );
124 /* initialize a Python subinterpreter */
125 void initInterp ( int );
126 /* import a Python GUI module */
128 /* set workspace to Python GUI module */
131 friend class SALOME_PYQT_XmlHandler;
134 #endif // SALOME_PYQT_MODULE_H