Salome HOME
debug IPAL9411: redefine virtual methods createEmptyStudy and activateModule
[modules/gui.git] / src / CAM / CAM_Module.h
1 #ifndef CAM_MODULE_H
2 #define CAM_MODULE_H
3
4 #include "CAM.h"
5
6 #include <qpixmap.h>
7 #include <qobject.h>
8 #include <qpopupmenu.h>
9
10 class QAction;
11 class SUIT_Study;
12 class CAM_DataModel;
13 class CAM_Application;
14 class QtxActionMenuMgr;
15 class QtxActionToolMgr;
16
17 #ifdef WIN32
18 #pragma warning( disable: 4251 )
19 #endif
20
21 class CAM_EXPORT CAM_Module : public QObject
22 {
23   Q_OBJECT
24
25 public:
26   CAM_Module();
27   CAM_Module( const QString& );
28   virtual ~CAM_Module();
29
30   virtual void           initialize( CAM_Application* );
31
32   QString                moduleName() const;
33   QPixmap                moduleIcon() const;
34
35   CAM_DataModel*         dataModel() const;
36   CAM_Application*       application() const;
37
38   virtual void           contextMenuPopup( const QString&, QPopupMenu*, QString& title ) {};
39   virtual void           updateCommandsStatus() {};
40
41 public slots:
42   virtual bool           activateModule( SUIT_Study* );
43   virtual bool           deactivateModule( SUIT_Study* );
44
45   virtual void           studyClosed( SUIT_Study* );
46   virtual void           studyChanged( SUIT_Study*, SUIT_Study* );
47
48 protected: 
49   virtual CAM_DataModel* createDataModel();
50
51   virtual void           setModuleName( const QString& );
52   virtual void           setModuleIcon( const QPixmap& );
53
54   QtxActionMenuMgr*      menuMgr() const;
55   QtxActionToolMgr*      toolMgr() const;
56
57   int                    createTool( const QString& );
58   int                    createTool( const int, const int, const int = -1 );
59   int                    createTool( const int, const QString&, const int = -1 );
60   int                    createTool( QAction*, const int, const int = -1, const int = -1 );
61   int                    createTool( QAction*, const QString&, const int = -1, const int = -1 );
62
63   int                    createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
64   int                    createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
65   int                    createMenu( const int, const int, const int = -1, const int = -1 );
66   int                    createMenu( const int, const QString&, const int = -1, const int = -1 );
67   int                    createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
68   int                    createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
69
70   void                   setMenuShown( const bool );
71   void                   setMenuShown( QAction*, const bool );
72   void                   setMenuShown( const int, const bool );
73
74   void                   setToolShown( const bool );
75   void                   setToolShown( QAction*, const bool );
76   void                   setToolShown( const int, const bool );
77
78   static QAction*        separator();
79
80   QAction*               action( const int ) const;
81   int                    actionId( const QAction* ) const;
82
83   int                    registerAction( const int, QAction* );
84   QAction*               createAction( const int, const QString&, const QIconSet&, const QString&,
85                                        const QString&, const int, QObject* = 0,
86                                        const bool = false, QObject* = 0, const char* = 0 );
87
88 private:
89   CAM_Application*       myApp;
90   QString                myName;
91   QPixmap                myIcon;
92   CAM_DataModel*         myDataModel;
93   QMap<int, QAction*>    myActionMap;
94
95   friend class CAM_Application;
96 };
97
98 #ifdef WIN32
99 #pragma warning( default: 4251 )
100 #endif
101
102 extern "C" {
103   typedef CAM_Module* (*GET_MODULE_FUNC)();
104 }
105
106 #define GET_MODULE_NAME "createModule"
107
108 #endif